Search in sources :

Example 1 with DC_SpellObj

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

the class UnitResetter method toBase.

@Override
public void toBase() {
    // getEntity().setMode(STD_MODES.NORMAL); ??
    // Chronos.mark(toString() + "to base (values)");
    getEntity().setMode(null);
    if (getEntity().getSpecialEffects() != null) {
        getEntity().getSpecialEffects().clear();
    }
    if (getEntity().getBonusDamage() != null) {
        getEntity().getBonusDamage().clear();
    }
    super.toBase();
    // }
    if (getEntity().isMine()) {
        if (CoreEngine.isLogicTest())
            TestMasterContent.addTestGroupSpells(getEntity());
        if (CoreEngine.isAnimationTestMode()) {
            TestMasterContent.addANIM_TEST_Spells(getEntity());
        } else if (CoreEngine.isGuiTestMode()) {
            TestMasterContent.addGRAPHICS_TEST_Spells(getEntity());
        }
    }
    if (getChecker().checkClassification(UnitEnums.CLASSIFICATIONS.TALL)) {
        getInitializer().addProperty(G_PROPS.STANDARD_PASSIVES, "" + UnitEnums.CLASSIFICATIONS.TALL, true);
    }
    if (getChecker().checkClassification(UnitEnums.CLASSIFICATIONS.SHORT)) {
        getInitializer().addProperty(G_PROPS.STANDARD_PASSIVES, "" + UnitEnums.CLASSIFICATIONS.TALL, true);
    }
    // Chronos.logTimeElapsedForMark(toString() + "to base (values)");
    // Chronos.mark(toString() + "to base (init objects)");
    getInitializer().initHeroObjects();
    // if (mainHero)
    if (!CoreEngine.isArcaneVault()) {
        if (game.isSimulation()) {
            resetObjects();
            resetQuickSlotsNumber();
            String value = "";
            for (DC_SpellObj s : getEntity().getSpells()) {
                if (!s.getProperty(PROPS.SPELL_UPGRADES).isEmpty()) {
                    value += s.getName() + StringMaster.wrapInParenthesis(s.getProperty(PROPS.SPELL_UPGRADES).replace(";", ",")) + ";";
                }
            }
            if (!value.isEmpty()) {
                setProperty(PROPS.SPELL_UPGRADES, value, true);
            }
        }
    }
    if (!getChecker().isBfObj()) {
        if (!getChecker().isNeutral()) {
            if (getChecker().isImmortalityOn()) {
                getEntity().addPassive(UnitEnums.STANDARD_PASSIVES.INDESTRUCTIBLE);
            }
            if (game.isDummyMode()) {
                if (getGame().isDummyPlus()) {
                    getEntity().resetDynamicParam(PARAMS.C_N_OF_COUNTERS);
                    resetParam(PARAMS.C_STAMINA);
                    resetParam(PARAMS.C_FOCUS);
                    resetParam(PARAMS.C_ESSENCE);
                    resetParam(PARAMS.C_FOCUS);
                }
                if (!getEntity().getOwner().isMe()) {
                    setParam(PARAMS.INITIATIVE_MODIFIER, 1);
                }
            }
        }
    }
}
Also used : DC_SpellObj(eidolons.entity.active.DC_SpellObj)

Example 2 with DC_SpellObj

use of eidolons.entity.active.DC_SpellObj 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 3 with DC_SpellObj

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

the class CastNewSpellEffect method applyThis.

// TODO spellpower/mastery mods!!!
@Override
public boolean applyThis() {
    ObjType type = DataManager.getType(spelltype, DC_TYPE.SPELLS);
    Ref REF = new Ref(ref.getGame(), ref.getSource());
    Obj obj = game.createSpell(type, ref.getSourceObj().getOwner(), REF);
    DC_SpellObj spell = (DC_SpellObj) obj;
    spell.setFree(free);
    spell.setQuietMode(true);
    if (group) {
        REF.setGroup(ref.getGroup());
        return spell.activatedOn(REF);
    }
    if (chooseTarget) {
        spell.getTargeting().select(REF);
    } else {
        REF.setTarget(ref.getId(target_key));
    }
    return spell.activatedOn(REF);
}
Also used : Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) Obj(main.entity.obj.Obj) DC_SpellObj(eidolons.entity.active.DC_SpellObj) DC_SpellObj(eidolons.entity.active.DC_SpellObj)

Example 4 with DC_SpellObj

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

the class AnimationConstructor method preconstructAllForAV.

public static void preconstructAllForAV() {
    for (ObjType type : DataManager.getTypes(DC_TYPE.SPELLS)) {
        DC_SpellObj active = new DC_SpellObj(type, Player.NEUTRAL, DC_Game.game, new Ref());
        AnimData data = null;
        try {
            int i = 0;
            for (ANIM_PART part : ANIM_PART.values()) {
                data = new AnimationConstructor().getStandardData(active, part, i);
                for (ANIM_VALUES val : ANIM_VALUES.values()) {
                    String identifier;
                    switch(val) {
                        case PARTICLE_EFFECTS:
                            identifier = "SFX";
                            break;
                        case SPRITES:
                            identifier = "SPRITE";
                            break;
                        default:
                            continue;
                    }
                    String value = data.getValue(val);
                    if (StringMaster.isEmpty(value))
                        continue;
                    value = value.replace(PathFinder.getImagePath().toLowerCase(), "");
                    i++;
                    PROPERTY prop = ContentManager.findPROP("anim" + "_" + identifier + "_" + part);
                    if (prop == null)
                        continue;
                    type.setProperty(prop, value);
                }
            }
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    }
}
Also used : Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) PROPERTY(main.content.values.properties.PROPERTY) ANIM_VALUES(eidolons.libgdx.anims.AnimData.ANIM_VALUES) DC_SpellObj(eidolons.entity.active.DC_SpellObj)

Example 5 with DC_SpellObj

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

the class ForceRule method isForceEnabled.

private static boolean isForceEnabled(DC_ActiveObj action) {
    if (action.isAttackAny()) {
        return true;
    }
    if (action.isSpell()) {
        Ref ref = action.getRef();
        // TODO won't be initialized here yet!!!
        DC_SpellObj spell = (DC_SpellObj) action;
        if (spell.isDamageSpell()) {
            if (spell.isMissile()) {
                if (spell.getResistanceType() == RESISTANCE_TYPE.REDUCE_DAMAGE) {
                    if (!DamageCalculator.isPeriodic(ref)) {
                        if (!ref.isTriggered()) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
Also used : Ref(main.entity.Ref) DC_SpellObj(eidolons.entity.active.DC_SpellObj)

Aggregations

DC_SpellObj (eidolons.entity.active.DC_SpellObj)22 Unit (eidolons.entity.obj.unit.Unit)8 Ref (main.entity.Ref)6 ObjType (main.entity.type.ObjType)6 ArrayList (java.util.ArrayList)3 DC_UnitAction (eidolons.entity.active.DC_UnitAction)2 SPELL_GROUP (main.content.enums.entity.SpellEnums.SPELL_GROUP)2 PROPERTY (main.content.values.properties.PROPERTY)2 Obj (main.entity.obj.Obj)2 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 DC_QuickItemAction (eidolons.entity.active.DC_QuickItemAction)1 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)1 DC_Cell (eidolons.entity.obj.DC_Cell)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 Action (eidolons.game.battlecraft.ai.elements.actions.Action)1 AiQuickItemAction (eidolons.game.battlecraft.ai.elements.actions.AiQuickItemAction)1 ArenaBattleMaster (eidolons.game.battlecraft.logic.battle.arena.ArenaBattleMaster)1 Wave (eidolons.game.battlecraft.logic.battle.arena.Wave)1