Search in sources :

Example 26 with Unit

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

the class ThrowEffect method applyThis.

@Override
public boolean applyThis() {
    if (stormOfMissiles) {
        fromHand = true;
        DC_WeaponObj weapon = (DC_WeaponObj) ref.getObj(KEYS.WEAPON);
        boolean result = throwWeapon(weapon);
        weapon = (DC_WeaponObj) ref.getObj(KEYS.OFFHAND);
        if (weapon != null) {
            offhand = true;
            result = throwWeapon(weapon);
        }
        Unit hero = (Unit) ref.getObj(KEYS.SOURCE);
        fromHand = false;
        for (DC_QuickItemObj q : hero.getQuickItems()) {
            weapon = q.getWrappedWeapon();
            if (weapon != null) {
                result &= throwWeapon(weapon);
            }
        }
        return result;
    }
    DC_WeaponObj weapon = (DC_WeaponObj) ref.getObj(KEYS.WEAPON);
    try {
        if (offhand || ref.getObj(KEYS.ACTIVE).checkProperty(G_PROPS.ACTION_TAGS, "" + ActionEnums.ACTION_TAGS.OFF_HAND)) {
            weapon = (DC_WeaponObj) ref.getObj(KEYS.OFFHAND);
            offhand = true;
        }
    // offhand mods?
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    return throwWeapon(weapon);
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) Unit(eidolons.entity.obj.unit.Unit)

Example 27 with Unit

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

the class ModeEffect method addDispelOnHitTrigger.

private void addDispelOnHitTrigger() {
    Effects effects = new Effects(new RemoveBuffEffect(addBuffEffect.getBuffTypeName()));
    if (!mode.equals(STD_MODES.ALERT)) {
        effects.add(InterruptRule.getEffect());
    } else {
        effects.add(AlertRule.getInterruptEffect());
    }
    if (mode.equals(STD_MODES.CHANNELING)) {
        effects.add(new EffectImpl() {

            @Override
            public boolean applyThis() {
                ChannelingRule.channelingInterrupted((Unit) getRef().getSourceObj());
                return true;
            }
        });
    }
    // TODO
    STANDARD_EVENT_TYPE event_type = STANDARD_EVENT_TYPE.UNIT_IS_DEALT_TOUGHNESS_DAMAGE;
    Condition conditions = (mode.equals(STD_MODES.ALERT)) ? InterruptRule.getConditionsAlert() : InterruptRule.getConditions();
    addBuffEffect.addEffect(new DelayedEffect(event_type, effects, conditions));
}
Also used : Condition(main.elements.conditions.Condition) RefCondition(main.elements.conditions.RefCondition) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) STANDARD_EVENT_TYPE(main.game.logic.event.Event.STANDARD_EVENT_TYPE) Unit(eidolons.entity.obj.unit.Unit)

Example 28 with Unit

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

the class ModeEffect method applyExplorationVersion.

private boolean applyExplorationVersion() {
    /*
        start restoring <?> over time
set mode all the same, just allow breaking it?
while in Mode, restore...

isModeDisablesActions

alert - ?
divination?
         */
    Unit unit = (Unit) getRef().getSourceObj();
    unit.getGame().getDungeonMaster().getExplorationMaster().getTimeMaster().unitActivatesMode(unit);
    unit.getGame().getStateManager().reset(unit);
    return false;
}
Also used : Unit(eidolons.entity.obj.unit.Unit)

Example 29 with Unit

use of eidolons.entity.obj.unit.Unit 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 30 with Unit

use of eidolons.entity.obj.unit.Unit 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)

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