Search in sources :

Example 1 with ModifyCounterEffect

use of eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect in project Eidolons by IDemiurge.

the class PriorityManagerImpl method getCounterModSpellPriority.

@Override
public int getCounterModSpellPriority(Action action) {
    // preCheck immunity? find counter rule by name and preCheck....
    List<Effect> effects = EffectFinder.getEffectsOfClass(action.getActive().getAbilities(), ModifyCounterEffect.class);
    initRollMap(action.getActive(), effects);
    for (Effect e : effects) {
        if (e instanceof ModifyCounterEffect) {
            ModifyCounterEffect modifyCounterEffect = (ModifyCounterEffect) e;
            float mod = DC_CounterMaster.getCounterPriority(modifyCounterEffect.getCounterName(), action.getTarget());
            if (rollMap.get(e) != null) {
                mod = mod * 100 / getRollPriorityMod(rollMap.get(e));
            }
            int amount = modifyCounterEffect.getFormula().getInt(action.getRef());
            setBasePriority(getUnitPriority(action.getTarget(), true));
            addMultiplier(Math.round(mod * amount), modifyCounterEffect.getCounterName() + StringMaster.wrapInParenthesis(amount + ""));
        }
    }
    applyResistPenalty(action);
    return priority;
}
Also used : ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) Effect(main.ability.effects.Effect) DealDamageEffect(eidolons.ability.effects.oneshot.DealDamageEffect) OwnershipChangeEffect(main.ability.effects.common.OwnershipChangeEffect) InstantDeathEffect(main.ability.effects.oneshot.InstantDeathEffect) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) DrainEffect(eidolons.ability.effects.oneshot.mechanic.DrainEffect) AttackEffect(eidolons.ability.effects.oneshot.attack.AttackEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) RaiseEffect(eidolons.ability.effects.oneshot.unit.RaiseEffect) BehaviorModeEffect(eidolons.ability.effects.continuous.BehaviorModeEffect) SummonEffect(eidolons.ability.effects.oneshot.unit.SummonEffect)

Example 2 with ModifyCounterEffect

use of eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect in project Eidolons by IDemiurge.

the class AI_SpellMaster method getZoneLogic.

private static AI_LOGIC getZoneLogic(DC_ActiveObj spell) {
    List<Effect> zoneEffects = EffectFinder.getEffectsOfClass(spell, SpecialTargetingEffect.class);
    if (!zoneEffects.isEmpty()) {
        for (Effect effect : zoneEffects) {
            SpecialTargetingEffect zoneEffect = (SpecialTargetingEffect) effect;
            if (EffectFinder.check(zoneEffect.getEffect(), DealDamageEffect.class)) {
                if (zoneEffect instanceof WaveEffect) {
                    return AiEnums.AI_LOGIC.AUTO_DAMAGE;
                }
                if (zoneEffect instanceof ShapeEffect) {
                    return AiEnums.AI_LOGIC.AUTO_DAMAGE;
                }
                if (spell.getTargetingMode() == AbilityEnums.TARGETING_MODE.NOVA) {
                    return AiEnums.AI_LOGIC.AUTO_DAMAGE;
                }
                if (spell.getTargetingMode() == AbilityEnums.TARGETING_MODE.SPRAY) {
                    return AiEnums.AI_LOGIC.AUTO_DAMAGE;
                }
                if (spell.getTargetingMode() == AbilityEnums.TARGETING_MODE.WAVE) {
                    return AiEnums.AI_LOGIC.AUTO_DAMAGE;
                }
                return AiEnums.AI_LOGIC.DAMAGE_ZONE;
            }
            if (EffectFinder.check(zoneEffect.getEffect(), ModifyValueEffect.class)) {
                if (isModifyValueEffectPositive(spell, zoneEffect)) {
                    return AiEnums.AI_LOGIC.RESTORE_ZONE;
                } else {
                    return AiEnums.AI_LOGIC.DEBILITATE_ZONE;
                }
            }
            if (EffectFinder.check(zoneEffect.getEffect(), ModifyCounterEffect.class)) {
                Effect e = EffectFinder.getEffectsOfClass(zoneEffect.getEffect(), ModifyCounterEffect.class).get(0);
                ModifyCounterEffect counterEffect = (ModifyCounterEffect) e;
                if (isCounterEffectPositive(spell, counterEffect)) {
                    return AiEnums.AI_LOGIC.RESTORE_ZONE;
                } else {
                    return AiEnums.AI_LOGIC.DEBILITATE_ZONE;
                }
            }
        }
    }
    return null;
}
Also used : ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) SpecialTargetingEffect(main.ability.effects.container.SpecialTargetingEffect) WaveEffect(eidolons.ability.effects.containers.customtarget.WaveEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) WaveEffect(eidolons.ability.effects.containers.customtarget.WaveEffect) DrainEffect(eidolons.ability.effects.oneshot.mechanic.DrainEffect) GatewayEffect(eidolons.ability.effects.oneshot.unit.GatewayEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) ShapeEffect(eidolons.ability.effects.containers.customtarget.ShapeEffect) RaiseEffect(eidolons.ability.effects.oneshot.unit.RaiseEffect) BehaviorModeEffect(eidolons.ability.effects.continuous.BehaviorModeEffect) MoveEffect(eidolons.ability.effects.oneshot.move.MoveEffect) SpecialTargetingEffect(main.ability.effects.container.SpecialTargetingEffect) Effect(main.ability.effects.Effect) DealDamageEffect(eidolons.ability.effects.oneshot.DealDamageEffect) OwnershipChangeEffect(main.ability.effects.common.OwnershipChangeEffect) CreateObjectEffect(eidolons.ability.effects.oneshot.unit.CreateObjectEffect) SummonEffect(eidolons.ability.effects.oneshot.unit.SummonEffect) InstantDeathEffect(main.ability.effects.oneshot.InstantDeathEffect) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) ShapeEffect(eidolons.ability.effects.containers.customtarget.ShapeEffect)

Example 3 with ModifyCounterEffect

use of eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect in project Eidolons by IDemiurge.

the class DC_CounterRule method check.

public boolean check(Unit unit) {
    if (!checkApplies(unit)) {
        return false;
    }
    this.unit = unit;
    if (getNumberOfCounters(unit) <= 0) {
        if (!isAppliedAlways()) {
            // if (checkAlreadyApplied(unit)) TODO that's bullshit!
            // log(getLiftedLogString());
            // removeBuff(unit); // may not be needed now
            removeEffects(unit);
            return false;
        }
    }
    if (ImmunityRule.checkImmune(unit, getCounterName())) {
        return false;
    }
    // if (!checkAlreadyApplied(unit))
    // log(getAppliedLogString());
    Ref ref = unit.getRef().getCopy();
    ref.setTarget(unit.getId());
    initEffects();
    addBuff(unit);
    if (getSpread() != null) {
        new CustomTargetEffect(new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ADJACENT), new ModifyCounterEffect(getCounterName(), MOD.MODIFY_BY_CONST, getSpread())).apply(Ref.getSelfTargetingRefCopy(unit));
    }
    // it only once!
    return true;
// effects.apply(ref);
}
Also used : Ref(main.entity.Ref) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) CustomTargetEffect(main.ability.effects.continuous.CustomTargetEffect) TemplateAutoTargeting(eidolons.ability.targeting.TemplateAutoTargeting)

Example 4 with ModifyCounterEffect

use of eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect in project Eidolons by IDemiurge.

the class ModifyValueEffect method applyThis.

@Override
public boolean applyThis() {
    if (modString != null) {
        return EffectFinder.initParamModEffects(modString, ref).apply(ref);
    }
    if (param == null) {
        this.param = ContentManager.getPARAM(sparam);
        if (param == null) {
            if (param == null) {
                this.param = ContentManager.getMastery(sparam);
            }
        }
        if (param == null) {
            if (StringMaster.openContainer(sparam, StringMaster.AND_SEPARATOR).size() > 1) {
                params = game.getValueManager().getParamsFromContainer(sparam);
            } else {
                params = game.getValueManager().getValueGroupParams(sparam);
            }
        }
    }
    Obj obj = ref.getTargetObj();
    if (obj instanceof DC_Obj) {
        ((DC_Obj) obj).modified(this);
    }
    if (ref.getTargetObj() == null) {
        LogMaster.log(1, "null target!" + this);
        return false;
    }
    Map<PARAMETER, String> map = new HashMap<>();
    if (param == null) {
        if (params == null) {
            // TODO
            return new ModifyCounterEffect(sparam, mod_type, formula.toString()).apply(ref);
        }
        for (PARAMETER p : params) {
            if (p == null) {
                continue;
            }
            param = p;
            modify(obj, map);
        }
        param = null;
        return true;
    }
    // TODO how to determined when formula should be statically parsed?
    // what if some part of the formula depends on the target instead?
    boolean result = modify(obj, map);
    if (result) {
        if (!isAnimationDisabled()) {
            if (map != null) {
                if (!map.isEmpty()) {
                    if (getAnimation() != null) {
                        if (!isContinuousWrapped()) {
                            getAnimation().addPhaseArgs(PHASE_TYPE.PARAM_MODS, map);
                        // getAnimation().start(); // TODO sync?
                        } else {
                            wrapInBuffPhase(map);
                        }
                    }
                }
            }
        }
    }
    return result;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) HashMap(java.util.HashMap) DC_Obj(eidolons.entity.obj.DC_Obj) Obj(main.entity.obj.Obj) PassiveAbilityObj(main.ability.PassiveAbilityObj) PARAMETER(main.content.values.parameters.PARAMETER)

Example 5 with ModifyCounterEffect

use of eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect in project Eidolons by IDemiurge.

the class PriorityManagerImpl method getCoatingPriority.

@Override
public int getCoatingPriority(DC_ActiveObj active, DC_Obj targetObj) {
    List<Effect> effects = EffectFinder.getEffectsOfClass(active, ModifyCounterEffect.class);
    if (effects.isEmpty()) {
        return priority;
    }
    ModifyCounterEffect e = (ModifyCounterEffect) effects.get(0);
    setBasePriority(getUnitPriority(getUnit(), true));
    addConstant(getItemPriority(targetObj), targetObj.getName());
    Integer amount = e.getFormula().getInt(active.getRef());
    int mod = amount;
    mod *= DC_CounterMaster.getCounterPriority(e.getCounterName(), targetObj);
    addMultiplier(mod, e.getCounterName() + " coating " + StringMaster.wrapInParenthesis(amount + ""));
    if (targetObj.getCounter(e.getCounterName()) > 0) {
        addMultiplier(-75 * targetObj.getCounter(e.getCounterName()) / amount, e.getCounterName() + " - Already Coated " + StringMaster.wrapInParenthesis(targetObj.getCounter(e.getCounterName()) + ""));
    }
    // TODO if (quick) if (ammo) if (alreadyCoated)
    return priority;
}
Also used : ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) Effect(main.ability.effects.Effect) DealDamageEffect(eidolons.ability.effects.oneshot.DealDamageEffect) OwnershipChangeEffect(main.ability.effects.common.OwnershipChangeEffect) InstantDeathEffect(main.ability.effects.oneshot.InstantDeathEffect) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) DrainEffect(eidolons.ability.effects.oneshot.mechanic.DrainEffect) AttackEffect(eidolons.ability.effects.oneshot.attack.AttackEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) RaiseEffect(eidolons.ability.effects.oneshot.unit.RaiseEffect) BehaviorModeEffect(eidolons.ability.effects.continuous.BehaviorModeEffect) SummonEffect(eidolons.ability.effects.oneshot.unit.SummonEffect)

Aggregations

ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)7 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)5 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)5 BehaviorModeEffect (eidolons.ability.effects.continuous.BehaviorModeEffect)5 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)5 DrainEffect (eidolons.ability.effects.oneshot.mechanic.DrainEffect)5 RaiseEffect (eidolons.ability.effects.oneshot.unit.RaiseEffect)5 SummonEffect (eidolons.ability.effects.oneshot.unit.SummonEffect)5 Effect (main.ability.effects.Effect)5 OwnershipChangeEffect (main.ability.effects.common.OwnershipChangeEffect)5 InstantDeathEffect (main.ability.effects.oneshot.InstantDeathEffect)5 ShapeEffect (eidolons.ability.effects.containers.customtarget.ShapeEffect)3 WaveEffect (eidolons.ability.effects.containers.customtarget.WaveEffect)3 MoveEffect (eidolons.ability.effects.oneshot.move.MoveEffect)3 CreateObjectEffect (eidolons.ability.effects.oneshot.unit.CreateObjectEffect)3 GatewayEffect (eidolons.ability.effects.oneshot.unit.GatewayEffect)3 SpecialTargetingEffect (main.ability.effects.container.SpecialTargetingEffect)3 AttackEffect (eidolons.ability.effects.oneshot.attack.AttackEffect)2 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)2 TemplateAutoTargeting (eidolons.ability.targeting.TemplateAutoTargeting)2