Search in sources :

Example 21 with ModifyValueEffect

use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.

the class BashEffect method applyThis.

@Override
public boolean applyThis() {
    int mod = 100 - getTarget().getIntParam(PARAMS.BASH_RESISTANCE);
    // generate from force? try inflict skull crush...
    int amount = formulaIni.getInt(ref) * mod / 100;
    if (mod != 0) {
        amount = -amount * mod / 100;
        new ModifyValueEffect(PARAMS.C_INITIATIVE_BONUS, MOD.MODIFY_BY_CONST, "" + amount).apply(ref);
    }
    amount = formulaFocus.getInt(ref) * mod / 100;
    if (mod != 0) {
        amount = -amount * mod / 100;
        new ModifyValueEffect(PARAMS.C_FOCUS, MOD.MODIFY_BY_CONST, "" + amount).apply(ref);
    }
    return true;
}
Also used : ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect)

Example 22 with ModifyValueEffect

use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.

the class DualAttackMaster method createDual.

private static DC_UnitAction createDual(DC_UnitAction main, DC_UnitAction offhand) {
    Costs costs = getDualCosts(main, offhand);
    // cooldown!
    ActiveAbility activateAttacks = new ActiveAbility(main.getTargeting(), new Effects(new ActivateEffect(main.getName(), true), new ActivateEffect(offhand.getName(), true)));
    Ability setCooldown = new ActiveAbility(new AutoTargeting(new PropCondition(G_PROPS.ACTION_TAGS, "Dual", false)), new ModifyValueEffect(PARAMS.C_COOLDOWN, MOD.SET, getCooldown(main.getOwnerObj())));
    Abilities abilities = new Abilities();
    abilities.add(activateAttacks);
    abilities.add(setCooldown);
    ObjType newType = new ObjType("Dual: " + main.getName() + " and " + offhand.getName(), DataManager.getType("Dual Attack", DC_TYPE.ACTIONS));
    for (Cost cost : costs.getCosts()) {
        PARAMETER p = cost.getCostParam();
        if (p == null)
            continue;
        newType.setParam(p, cost.getPayment().getAmountFormula().toString());
    }
    DC_UnitAction dual = new DC_UnitAction(newType, main.getOwner(), main.getGame(), new Ref(main.getOwnerObj()));
    dual.setAbilities(abilities);
    dual.setCosts(costs);
    dual.setTargeting(main.getTargeting());
    dual.getTargeter().setTargetingInitialized(true);
    dual.setConstructed(true);
    return dual;
}
Also used : ActiveAbility(main.ability.ActiveAbility) ActiveAbility(main.ability.ActiveAbility) Ability(main.ability.Ability) AutoTargeting(main.elements.targeting.AutoTargeting) Costs(main.elements.costs.Costs) Abilities(main.ability.Abilities) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Effects(main.ability.effects.Effects) PropCondition(main.elements.conditions.PropCondition) Cost(main.elements.costs.Cost) DC_UnitAction(eidolons.entity.active.DC_UnitAction) Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) ActivateEffect(eidolons.ability.effects.oneshot.activation.ActivateEffect) PARAMETER(main.content.values.parameters.PARAMETER)

Example 23 with ModifyValueEffect

use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.

the class KnockdownRule method knockdown.

public static void knockdown(Unit target) {
    Effects e = new Effects();
    target.getGame().getLogManager().newLogEntryNode(ENTRY_TYPE.KNOCKDOWN, target);
    e.add(new ModifyValueEffect(PARAMS.C_N_OF_ACTIONS, MOD.MODIFY_BY_CONST, "-3"));
    e.add(new ModifyValueEffect(PARAMS.C_FOCUS, MOD.MODIFY_BY_CONST, "-15"));
    (e).apply(Ref.getSelfTargetingRefCopy(target));
    e = new Effects();
    e.add(new ModifyPropertyEffect(G_PROPS.STATUS, MOD_PROP_TYPE.SET, UnitEnums.STATUS.PRONE.toString()));
    // e.add(new ModifyValueEffect(PARAMS.C_FOCUS, MOD.MODIFY_BY_CONST, ));
    e.add(new ModifyValueEffect(PARAMS.DEFENSE_MOD, MOD.MODIFY_BY_CONST, "-50"));
    new AddBuffEffect("Knocked Down", e, 1).apply(Ref.getSelfTargetingRefCopy(target));
    target.getGame().getLogManager().doneLogEntryNode(ENTRY_TYPE.KNOCKDOWN, target);
}
Also used : AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Effects(main.ability.effects.Effects) ModifyPropertyEffect(eidolons.ability.effects.common.ModifyPropertyEffect)

Example 24 with ModifyValueEffect

use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.

the class PriorityManagerImpl method getParamModSpellPriority.

@Override
public int getParamModSpellPriority(Action action, Boolean buff) {
    DC_ActiveObj spell = action.getActive();
    DC_Obj target = action.getTarget();
    if (buff == null) {
        buff = EffectFinder.check(spell.getAbilities(), AddBuffEffect.class);
    }
    if (buff) {
        if (!spell.checkBool(GenericEnums.STD_BOOLS.STACKING)) {
            try {
                List<ObjType> buffsFromSpell = BuffMaster.getBuffsFromSpell(spell);
                if (buffsFromSpell.isEmpty()) {
                    priority = 0;
                    return 0;
                }
                ObjType objType = buffsFromSpell.get(0);
                if (!objType.checkBool(GenericEnums.STD_BOOLS.STACKING)) {
                    if (target.hasBuff(objType.getName())) {
                        priority = 0;
                        return 0;
                    }
                }
            } catch (Exception e) {
            }
        }
    }
    int priority = (getUnitPriority(target, false));
    boolean ally = target.getOwner().equals(getUnit().getOwner());
    // boolean mod = EffectMaster.preCheck(spell.getAbilities(),
    // ModifyValueEffect.class);
    List<Effect> effects = EffectFinder.getEffectsOfClass(spell.getAbilities(), (buff) ? AddBuffEffect.class : ModifyValueEffect.class);
    if (buff) {
        List<Effect> list = new ArrayList<>();
        for (Effect e : effects) {
            list.addAll(EffectFinder.getBuffEffects(e, ModifyValueEffect.class));
        }
        // TODO count the duration from buffEffect
        effects = list;
    }
    initRollMap(spell, effects);
    boolean valid = false;
    for (Effect e : effects) {
        ModifyValueEffect valueEffect = (ModifyValueEffect) e;
        for (String sparam : StringMaster.open(valueEffect.getParamString())) {
            for (PARAMETER param : DC_ContentManager.getParams(sparam)) {
                // TODO apply generic fix!
                if (param == PARAMS.C_INITIATIVE_BONUS)
                    param = PARAMS.C_INITIATIVE;
                if (TextParser.checkHasValueRefs(valueEffect.getFormula().toString())) {
                    String parsed = TextParser.parse(valueEffect.getFormula().toString(), action.getRef(), TextParser.ACTIVE_PARSING_CODE);
                    parsed = TextParser.replaceCodes(parsed);
                    valueEffect.setFormula(new Formula(parsed));
                }
                int amount = valueEffect.getFormula().getInt(action.getRef());
                if (valueEffect.getMod_type() == MOD.MODIFY_BY_PERCENT) {
                    amount = MathMaster.getFractionValueCentimal(target.getIntParam(param, valueEffect.getFormula().toString().contains(StringMaster.BASE_CHAR)), amount);
                }
                boolean drain = (e instanceof DrainEffect);
                int final_value = target.getIntParam(param) + amount;
                int min_max = valueEffect.initMinMaxAmount(target, amount);
                if (min_max != Integer.MAX_VALUE && min_max != Integer.MIN_VALUE) {
                    if (amount >= 0) {
                        if (final_value > min_max) {
                            amount = min_max - target.getIntParam(param);
                        }
                    } else {
                        if (amount < min_max) {
                            amount = target.getIntParam(param) - min_max;
                        }
                    }
                }
                if (!ally && !drain) {
                    amount = -amount;
                }
                priority = (int) (priority * getParamModFactor(target, e, param, amount));
                if (drain) {
                    // TODO limit the amount!
                    priority = (int) (priority * getParamModFactor(getUnit(), null, param, amount));
                }
            }
        }
        if (!buff) {
            if (!ally && valid) {
                applyResistPenalty(action);
            }
        } else {
            priority = priority * (getDurationMultiplier(action)) / 100;
        }
    }
    if (!valid) {
        return 0;
    // applyMultiplier(0, "Empty");
    }
    return priority;
}
Also used : ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) DC_Obj(eidolons.entity.obj.DC_Obj) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Formula(main.system.math.Formula) ObjType(main.entity.type.ObjType) 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) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) PARAMETER(main.content.values.parameters.PARAMETER) DrainEffect(eidolons.ability.effects.oneshot.mechanic.DrainEffect)

Example 25 with ModifyValueEffect

use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.

the class AI_SpellMaster method getModValueLogic.

private static AI_LOGIC getModValueLogic(DC_ActiveObj spell) {
    Abilities actives = spell.getAbilities();
    List<Effect> effects = EffectFinder.getEffectsOfClass(actives, ModifyValueEffect.class);
    if (effects.isEmpty()) {
        effects = EffectFinder.getEffectsOfClass(actives, ModifyCounterEffect.class);
    }
    if (!effects.isEmpty()) {
        Effect effect = effects.get(0);
        if (effect instanceof ModifyCounterEffect) {
            ModifyCounterEffect counterEffect = (ModifyCounterEffect) effect;
            if (isCounterEffectPositive(spell, counterEffect)) {
                return AiEnums.AI_LOGIC.RESTORE;
            }
            return AiEnums.AI_LOGIC.DEBILITATE;
        }
        if (effect instanceof ModifyValueEffect) {
            if (isModifyValueEffectPositive(spell, effect)) {
                return AiEnums.AI_LOGIC.RESTORE;
            }
            return AiEnums.AI_LOGIC.DEBILITATE;
        }
    }
    return null;
}
Also used : Abilities(main.ability.Abilities) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) 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)

Aggregations

ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)27 Effects (main.ability.effects.Effects)17 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)11 Ref (main.entity.Ref)8 Formula (main.system.math.Formula)7 PARAMETER (main.content.values.parameters.PARAMETER)5 RemoveBuffEffect (eidolons.ability.effects.oneshot.buff.RemoveBuffEffect)4 ActiveAbility (main.ability.ActiveAbility)4 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)3 BehaviorModeEffect (eidolons.ability.effects.continuous.BehaviorModeEffect)3 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)3 DrainEffect (eidolons.ability.effects.oneshot.mechanic.DrainEffect)3 ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)3 RaiseEffect (eidolons.ability.effects.oneshot.unit.RaiseEffect)3 SummonEffect (eidolons.ability.effects.oneshot.unit.SummonEffect)3 Abilities (main.ability.Abilities)3 Effect (main.ability.effects.Effect)3 OwnershipChangeEffect (main.ability.effects.common.OwnershipChangeEffect)3 InstantDeathEffect (main.ability.effects.oneshot.InstantDeathEffect)3 Targeting (main.elements.targeting.Targeting)3