Search in sources :

Example 46 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class DC_CounterMaster method getCounterPriority.

public static float getCounterPriority(String counterName, DC_Obj target) {
    if (target instanceof Unit) {
        Unit heroObj = (Unit) target;
        String realName = CounterMaster.findCounter(counterName);
        switch(new EnumMaster<COUNTER>().retrieveEnumConst(COUNTER.class, realName)) {
            case Blaze:
                if (!target.getGame().getRules().getBlazeRule().checkApplies(heroObj)) {
                    return 0;
                }
                break;
            case Bleeding:
                if (!target.getGame().getRules().getBleedingRule().checkApplies(heroObj)) {
                    return 0;
                }
                break;
            case Blight:
                if (!target.getGame().getRules().getBlightRule().checkApplies(heroObj)) {
                    return 0;
                }
                break;
            case Corrosion:
                break;
            case Despair:
                break;
            case Disease:
                if (!target.getGame().getRules().getDiseaseRule().checkApplies(heroObj)) {
                    return 0;
                }
                break;
            case Ensnared:
                if (!target.getGame().getRules().getEnsnareRule().checkApplies(heroObj)) {
                    return 0;
                }
                break;
            case Freeze:
                if (!target.getGame().getRules().getFreezeRule().checkApplies(heroObj)) {
                    return 0;
                }
                break;
            case Hatred:
                break;
            case Lust:
                break;
            case Madness:
                break;
            case Moist:
                break;
            case Poison:
                if (!target.getGame().getRules().getPoisonRule().checkApplies(heroObj)) {
                    return 0;
                }
                break;
            case Rage:
                break;
            case Soul:
                break;
            case Undying:
                break;
            default:
                break;
        }
    }
    return CounterMaster.getCounterPriority(counterName, target);
}
Also used : Unit(eidolons.entity.obj.unit.Unit) COUNTER(main.content.enums.entity.UnitEnums.COUNTER)

Example 47 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class RollMaster method checkRollType.

public static boolean checkRollType(ROLL_TYPES rollType, Ref ref) {
    Unit unit = (Unit) ref.getTargetObj();
    if (unit == null) {
        return false;
    }
    boolean result = true;
    switch(rollType) {
        case MASS:
            if (unit.checkPassive(UnitEnums.STANDARD_PASSIVES.IMMATERIAL)) {
                result = false;
            }
            break;
        case FAITH:
        case MIND_AFFECTING:
            if (!unit.isLiving()) {
                result = false;
            }
            if (unit.checkPassive(UnitEnums.STANDARD_PASSIVES.MIND_AFFECTING_IMMUNE)) {
                result = false;
            }
            break;
        default:
            break;
    }
    if (!result) {
        result = !unit.checkProperty(G_PROPS.IMMUNITIES, rollType.getName());
    }
    if (!result) {
        ref.getGame().getLogManager().logAlert(unit.getName() + " is immune to " + rollType.getName() + " !");
    }
    return result;
}
Also used : Unit(eidolons.entity.obj.unit.Unit)

Example 48 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class UnlockMaster method promptUnlock.

public static boolean promptUnlock(PARAMETER param, Entity entity) {
    int masteriesUnlocked = DC_MathManager.getMasteriesUnlocked(entity);
    masteriesUnlocked -= DC_MathManager.getMasteryDiscount(entity);
    // 25 75 150 250 400 500 [500]?
    Unit hero = CharacterCreator.getHeroManager().getHero((ObjType) entity);
    int xpCost = getXpCost(entity, masteriesUnlocked, hero);
    int goldCost = getGoldCost(entity, masteriesUnlocked, hero);
    if (!entity.checkParam(PARAMS.GOLD, goldCost + "") && !entity.checkParam(PARAMS.XP, xpCost + "")) {
        DC_SoundMaster.playStandardSound(STD_SOUNDS.CLICK_BLOCKED);
        return false;
    }
    // gold/xp cost reduction?
    final UnlockDialog view = new UnlockDialog(entity, param, xpCost, goldCost);
    try {
        SwingUtilities.invokeAndWait(new Runnable() {

            @Override
            public void run() {
                view.show();
            }
        });
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    // return result;
    return true;
}
Also used : Unit(eidolons.entity.obj.unit.Unit)

Example 49 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class UnlockMaster method unlock.

public static void unlock(Entity entity, PARAMETER param, boolean gold) {
    int masteriesUnlocked = DC_MathManager.getMasteriesUnlocked(entity);
    masteriesUnlocked -= DC_MathManager.getMasteryDiscount(entity);
    // 25 75 150 250 400 500 [500]?
    Unit hero = CharacterCreator.getHeroManager().getHero((ObjType) entity);
    int cost = gold ? getGoldCost(entity, masteriesUnlocked, hero) : getXpCost(entity, masteriesUnlocked, hero);
    unlock(entity, param, gold, cost);
}
Also used : Unit(eidolons.entity.obj.unit.Unit)

Example 50 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class AnimMaster method bindEvents.

public void bindEvents() {
    DC_SoundMaster.bindEvents();
    GuiEventManager.bind(GuiEventType.ADD_FLOATING_TEXT, p -> {
        FloatingText floatingText = (FloatingText) p.get();
        // if (!floatingText.isInitialized())
        floatingText.init();
        addActor(floatingText);
    });
    GuiEventManager.bind(GuiEventType.MOUSE_HOVER, p -> {
        if (!isOn()) {
            return;
        }
        if (!(p.get() instanceof Unit)) {
            return;
        }
        if (showBuffAnimsOnHoverLength == null) {
            return;
        }
        try {
            mouseHover((Unit) p.get());
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    });
    GuiEventManager.bind(GuiEventType.ACTION_INTERRUPTED, p -> {
        if (!isOn()) {
            return;
        }
        leadAnimation.interrupt();
    });
    GuiEventManager.bind(GuiEventType.ACTION_BEING_RESOLVED, p -> {
    // CompositeAnim animation = constructor.getOrCreate((DC_ActiveObj) portrait.get());
    });
    GuiEventManager.bind(GuiEventType.ACTION_RESOLVES, p -> {
        if (!isOn()) {
            return;
        }
        ActionInput input = (ActionInput) p.get();
        try {
            initActionAnimation(input.getAction(), (AnimContext) input.getContext());
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    });
    // GuiEventManager.bind(GuiEventType.UPDATE_BUFFS, p -> {
    // updateContinuousAnims();
    // });
    // GuiEventManager.bind(GuiEventType.ABILITY_RESOLVES, p -> {
    // if (!isOn()) {
    // return;
    // }
    // Ability ability = (Ability) p.get();
    // what about triggers?
    // getParentAnim(ability.getRef().getActive()).addAbilityAnims(ability);
    // });
    GuiEventManager.bind(GuiEventType.INGAME_EVENT_TRIGGERED, p -> {
        if (!isOn()) {
            return;
        }
        try {
            initEventAnimation((Event) p.get());
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    });
    GuiEventManager.bind(GuiEventType.EFFECT_APPLIED, p -> {
        if (!isOn()) {
            return;
        }
        try {
            initEffectAnimation((Effect) p.get());
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    });
}
Also used : FloatingText(eidolons.libgdx.anims.text.FloatingText) ActionInput(eidolons.game.core.ActionInput) Unit(eidolons.entity.obj.unit.Unit)

Aggregations

Unit (eidolons.entity.obj.unit.Unit)258 Coordinates (main.game.bf.Coordinates)53 Ref (main.entity.Ref)33 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)30 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)26 DC_Obj (eidolons.entity.obj.DC_Obj)26 ArrayList (java.util.ArrayList)26 Obj (main.entity.obj.Obj)26 ObjType (main.entity.type.ObjType)23 DC_SpellObj (eidolons.entity.active.DC_SpellObj)13 DC_Cell (eidolons.entity.obj.DC_Cell)11 Event (main.game.logic.event.Event)11 DC_UnitAction (eidolons.entity.active.DC_UnitAction)10 List (java.util.List)10 DC_Game (eidolons.game.core.game.DC_Game)9 Action (eidolons.game.battlecraft.ai.elements.actions.Action)8 DequeImpl (main.system.datatypes.DequeImpl)8 OUTLINE_TYPE (main.content.enums.rules.VisionEnums.OUTLINE_TYPE)7 Entity (main.entity.Entity)7 DIRECTION (main.game.bf.Coordinates.DIRECTION)7