Search in sources :

Example 6 with DC_ActiveObj

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

the class DealDamageEffect method applyThis.

@Override
public boolean applyThis() {
    if (ref.getTargetObj() == null) {
        return false;
    }
    if (!(ref.getTargetObj() instanceof Unit)) {
        // TODO if cell, apply damage to corpses?
        return true;
    }
    if (checkDamageMod(DAMAGE_MODIFIER.QUIET)) {
        getRef().setQuiet(true);
    } else {
        getRef().setQuiet(false);
    }
    Unit targetObj = (Unit) ref.getTargetObj();
    int amount = formula.getAppendedByModifier(ref.getValue(KEYS.FORMULA)).getInt(ref);
    DC_ActiveObj active = (DC_ActiveObj) ref.getActive();
    boolean spell = active instanceof DC_SpellObj;
    initDamageType();
    if (!checkDamageMod(DAMAGE_MODIFIER.UNBLOCKABLE)) {
        amount = ArmorMaster.getShieldReducedAmountForDealDamageEffect(this, targetObj, amount, active);
    }
    LogMaster.log(LogMaster.COMBAT_DEBUG, "Effect is dealing damage: " + amount + " to " + ref.getTargetObj().toString());
    saveDamageModsToRef();
    ref.setValue(KEYS.DAMAGE_TYPE, damage_type.getName());
    int damage = DamageDealer.dealDamage(getDamageObject(amount));
    return true;
}
Also used : DC_SpellObj(eidolons.entity.active.DC_SpellObj) Unit(eidolons.entity.obj.unit.Unit) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 7 with DC_ActiveObj

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

the class ActivateEffect method applyThis.

@Override
public boolean applyThis() {
    Unit source = (Unit) ref.getObj(sourceKey);
    Unit target = (Unit) ref.getObj(key);
    DC_ActiveObj active;
    if (!spell) {
        active = source.getAction(name);
    } else {
        active = source.getSpell(name);
    }
    if (free) {
        active.setFree(free);
    }
    try {
        active.activatedOn(Ref.getSelfTargetingRefCopy(target));
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    } finally {
        active.setFree(false);
    }
    return true;
}
Also used : Unit(eidolons.entity.obj.unit.Unit) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 8 with DC_ActiveObj

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

the class AttackOfOpportunityRule method getAttacksOfOpportunity.

private static List<DC_ActiveObj> getAttacksOfOpportunity(Unit unit) {
    List<DC_ActiveObj> list = new ArrayList<>();
    DequeImpl<DC_UnitAction> attacks = unit.getActionMap().get(ActionEnums.ACTION_TYPE.STANDARD_ATTACK);
    if (attacks == null) {
        attacks = new DequeImpl<>();
    }
    if (unit.getActionMap().get(ActionEnums.ACTION_TYPE.SPECIAL_ATTACK) != null) {
        attacks.addAll(unit.getActionMap().get(ActionEnums.ACTION_TYPE.SPECIAL_ATTACK));
    }
    for (DC_UnitAction attack : attacks) {
        if (// TODO same tag?!
        attack.checkProperty(G_PROPS.ACTION_TAGS, ActionEnums.ACTION_TAGS.ATTACK_OF_OPPORTUNITY_ACTION.toString())) {
            list.add(attack);
        }
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) DC_UnitAction(eidolons.entity.active.DC_UnitAction)

Example 9 with DC_ActiveObj

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

the class StackingRule method actionMissed.

public static void actionMissed(DC_ActiveObj action) {
    if (RuleMaster.isRuleOn(RULE.MISSED_ATTACK_REDIRECTION))
        return;
    Ref ref = action.getRef();
    Obj target = ref.getTargetObj();
    List<BattleFieldObject> units = action.getGame().getObjectsAt(action.getOwnerObj().getCoordinates());
    units.addAll(action.getGame().getObjectsAt(target.getCoordinates()));
    units.remove(action.getOwnerObj());
    units.remove(target);
    if (units.isEmpty()) {
        return;
    }
    Map<BattleFieldObject, Integer> map = new HashMap<>();
    for (BattleFieldObject unit : units) {
        map.put(unit, unit.getIntParam(PARAMS.GIRTH));
    }
    BattleFieldObject randomTarget = new RandomWizard<BattleFieldObject>().getObjectByWeight(map);
    ref.setTarget(randomTarget.getId());
    // action.addProperty(G_PROPS.DYNAMIC_BOOLS,
    // DYNAMIC_BOOLS.MISSED_ALREADY); //NO RESTRAINTS! :)
    action.activatedOn(ref);
}
Also used : Ref(main.entity.Ref) BattleFieldObject(eidolons.entity.obj.BattleFieldObject) HashMap(java.util.HashMap) ActiveObj(main.entity.obj.ActiveObj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj)

Example 10 with DC_ActiveObj

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

the class DC_BuffRule method playAnimation.

protected void playAnimation(Ref ref) {
    DC_ActiveObj action = (DC_ActiveObj) ref.getObj(KEYS.ACTIVE);
    if (action == null) {
        action = target.getDummyAction();
    }
    EffectAnimation anim = new EffectAnimation(action);
    anim.addPhase(new AnimPhase(PHASE_TYPE.BUFF, ref.getObj(KEYS.BUFF)));
    getGame().getAnimationManager().newAnimation(anim);
    animationQueued = false;
}
Also used : EffectAnimation(eidolons.system.graphics.EffectAnimation) AnimPhase(main.system.graphics.AnimPhase) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

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