Search in sources :

Example 16 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class ActivesConstructor method setAnimForEffects.

public static void setAnimForEffects(DC_ActiveObj entity) {
    List<ActiveObj> list = new ArrayList<>(entity.getActives());
    for (Active active : list) {
        for (Ability abil : ((AbilityObj) active).getAbilities().getAbils()) {
            for (Effect effect : abil.getEffects().getEffects()) {
                if (effect instanceof EffectImpl) {
                    EffectImpl effect2 = (EffectImpl) effect;
                    effect2.setAnimationActive(entity);
                }
            }
        }
    }
}
Also used : Active(main.entity.obj.Active) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) ActiveObj(main.entity.obj.ActiveObj) EffectImpl(main.ability.effects.EffectImpl) ArrayList(java.util.ArrayList) DC_Effect(eidolons.ability.effects.DC_Effect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) Effect(main.ability.effects.Effect) RayEffect(eidolons.ability.effects.containers.customtarget.RayEffect) WaveEffect(eidolons.ability.effects.containers.customtarget.WaveEffect) ZoneEffect(eidolons.ability.effects.containers.customtarget.ZoneEffect)

Example 17 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class SneakCondition method checkSneak.

public boolean checkSneak(Ref ref) {
    if (!(ref.getObj(key) instanceof Unit)) {
        return false;
    }
    Unit attacked = (Unit) ref.getObj(key);
    if (attacked.isBfObj()) {
        return false;
    }
    if (attacked.checkPassive(UnitEnums.STANDARD_PASSIVES.SNEAK_IMMUNE)) {
        return false;
    }
    if (attacked.checkStatus(UnitEnums.STATUS.IMMOBILE)) {
        return true;
    }
    if (attacked.checkStatus(UnitEnums.STATUS.CHARMED)) {
        return true;
    }
    Unit attacker = (Unit) ref.getSourceObj();
    DC_ActiveObj action = (DC_ActiveObj) ref.getObj(KEYS.ACTIVE);
    if (!attacker.checkInSightForUnit(attacked)) {
        if (// TODO wake up?
        attacked.getMode().equals(STD_MODES.ALERT)) {
            return false;
        }
        if (!action.isRanged()) {
            if (attacker.getActivePlayerVisionStatus() == PLAYER_VISION.UNKNOWN || !VisionManager.checkVisible(attacker)) {
                return true;
            } else {
                // TODO allow sneak in front for specialists
                return FacingMaster.getSingleFacing(attacked, attacker) == UnitEnums.FACING_SINGLE.BEHIND;
            }
        }
    }
    return false;
}
Also used : Unit(eidolons.entity.obj.unit.Unit) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 18 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class DC_EffectManager method checkResistanceAlreadyChecked.

private boolean checkResistanceAlreadyChecked(Effect effect) {
    try {
        DC_ActiveObj spell = (DC_ActiveObj) effect.getRef().getActive();
        boolean resistanceChecked = spell.isResistanceChecked();
        spell.setResistanceChecked(true);
        return resistanceChecked;
    } catch (Exception ignored) {
    }
    return false;
}
Also used : DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 19 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class DC_EffectManager method checkNotResisted.

@Override
public boolean checkNotResisted(Effect effect) {
    if (effect.isIrresistible()) {
        return true;
    }
    if (!checkEffectType(effect)) {
        return true;
    }
    Ref ref = effect.getRef();
    try {
        if (!checkTargeting(effect)) {
            return true;
        }
        if (effect instanceof ReducedEffect) {
            DC_ActiveObj spell = (DC_ActiveObj) ref.getActive();
            if (spell == null) {
                return true;
            }
            if (spell.getResistanceType() != SpellEnums.RESISTANCE_TYPE.IRRESISTIBLE) {
                if (spell.getResistanceType() != SpellEnums.RESISTANCE_TYPE.CHANCE_TO_BLOCK) {
                    int mod = ResistanceRule.getResistanceMod(ref);
                    ((ReducedEffect) effect).setResistanceMod(mod);
                    return true;
                }
            }
        }
        if (checkResistanceAlreadyChecked(effect)) {
            return true;
        }
        return ResistanceRule.checkNotResisted(ref);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
        return true;
    }
}
Also used : Ref(main.entity.Ref) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 20 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class ExtraAttacksRule method getCounterAttacks.

public static List<DC_ActiveObj> getCounterAttacks(DC_ActiveObj triggeringAction, Unit unit) {
    List<DC_ActiveObj> list = new ArrayList<>();
    if (unit.getActionMap().get(ActionEnums.ACTION_TYPE.STANDARD_ATTACK) == null) {
        return list;
    }
    for (DC_UnitAction a : unit.getActionMap().get(ActionEnums.ACTION_TYPE.STANDARD_ATTACK)) {
        // offhand?
        if (a.isMelee() && !a.isAttackGeneric()) // auto-atk range?
        {
            list.add(a);
        }
    }
    SortMaster.sortEntitiesByExpression(list, action -> FutureBuilder.precalculateDamage((DC_ActiveObj) action, triggeringAction.getOwnerObj(), true) * (action.getIntParam(PARAMS.COUNTER_MOD) + action.getIntParam(PARAMS.COUNTER_ATTACK_MOD)));
    return list;
}
Also used : ArrayList(java.util.ArrayList) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) DC_UnitAction(eidolons.entity.active.DC_UnitAction)

Aggregations

DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)73 Unit (eidolons.entity.obj.unit.Unit)22 ArrayList (java.util.ArrayList)17 Obj (main.entity.obj.Obj)15 DC_UnitAction (eidolons.entity.active.DC_UnitAction)12 DC_Obj (eidolons.entity.obj.DC_Obj)12 Ref (main.entity.Ref)9 Action (eidolons.game.battlecraft.ai.elements.actions.Action)8 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)7 ActiveObj (main.entity.obj.ActiveObj)7 Effect (main.ability.effects.Effect)5 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)5 Targeting (main.elements.targeting.Targeting)5 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)4 DC_SpellObj (eidolons.entity.active.DC_SpellObj)4 ActionPath (eidolons.game.battlecraft.ai.tools.path.ActionPath)4 FixedTargeting (main.elements.targeting.FixedTargeting)4 Coordinates (main.game.bf.Coordinates)4 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)3 ActionSequence (eidolons.game.battlecraft.ai.elements.actions.sequence.ActionSequence)3