Search in sources :

Example 6 with RollEffect

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

the class PriorityManagerImpl method getSpellCustomHostileEffectPriority.

@Override
public int getSpellCustomHostileEffectPriority(DC_Obj target, DC_ActiveObj action, Effect e) {
    if (e instanceof AddBuffEffect) {
        AddBuffEffect buffEffect = (AddBuffEffect) e;
        // duration
        int mod = 100;
        // getDurationPriorityMod(buffEffect.getDurationFormula().getInt(action.getRef()));
        return getSpellCustomHostileEffectPriority(target, action, buffEffect.getEffect()) * mod / 100;
    }
    if (e instanceof Effects) {
        Effects effects = (Effects) e;
        int p = 0;
        for (Effect eff : effects) {
            p += getSpellCustomHostileEffectPriority(target, action, eff);
        }
        return p;
    }
    if (e instanceof RollEffect) {
        RollEffect rollEffect = (RollEffect) e;
        int mod = getRollPriorityMod(rollEffect);
        return getSpellCustomHostileEffectPriority(target, action, rollEffect.getEffect()) * mod / 100;
    }
    if (e instanceof InstantDeathEffect) {
        return 2 * getUnitPriority(target, true);
    }
    if (e instanceof BehaviorModeEffect) {
        int duration = new Formula(action.getParam(G_PARAMS.DURATION)).getInt(action.getRef());
        BehaviorModeEffect behaviorModeEffect = (BehaviorModeEffect) e;
        switch(behaviorModeEffect.getMode()) {
            case BERSERK:
                return getUnitPriority(target, true) * (Math.min(4, duration / 5 * 3));
            case CONFUSED:
                return getUnitPriority(target, true) * (Math.min(2, duration / 2));
            case PANIC:
                return getUnitPriority(target, true) * (Math.min(3, duration / 3 * 2));
            default:
                break;
        }
    }
    if (e instanceof OwnershipChangeEffect) {
        int duration = new Formula(action.getParam(G_PARAMS.DURATION)).getInt(action.getRef());
        return getUnitPriority(target, true) * (Math.min(5, duration));
    }
    return 0;
}
Also used : BehaviorModeEffect(eidolons.ability.effects.continuous.BehaviorModeEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Formula(main.system.math.Formula) RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) InstantDeathEffect(main.ability.effects.oneshot.InstantDeathEffect) OwnershipChangeEffect(main.ability.effects.common.OwnershipChangeEffect) 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) Effects(main.ability.effects.Effects)

Example 7 with RollEffect

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

the class PriorityManagerImpl method getDamagePriority.

@Override
public int getDamagePriority(DC_ActiveObj action, Obj targetObj, boolean attack) {
    int damage = 0;
    List<Effect> effects = EffectFinder.getEffectsOfClass(action, (attack) ? AttackEffect.class : DealDamageEffect.class);
    initRollMap(action, effects);
    for (Effect e : effects) {
        try {
            int mod = 100;
            RollEffect roll = rollMap.get(e);
            if (roll != null) {
                roll.getRef().setTarget(targetObj.getId());
                mod = getRollPriorityMod(roll);
            }
            damage += FutureBuilder.getDamage(action, targetObj, e) * mod / 100;
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    }
    float mod = getConstValue(AiConst.DAMAGE_PRIORITY_MOD);
    if (DamageCalculator.isUnconscious(damage, targetObj)) {
        if (checkKillPrioritized(targetObj, action)) {
            return getUnconsciousDamagePriority() * (int) (mod * 100) / 100;
        }
    }
    if (checkKillPrioritized(targetObj, action)) {
        if (DamageCalculator.isLethal(damage, targetObj)) {
            int p = getLethalDamagePriority();
            if (targetObj instanceof Unit) {
                if (((Unit) targetObj).isUnconscious())
                    p = getConstInt(AiConst.LETHAL_DAMAGE_MOD_VS_UNCONSCIOUS);
            }
            return p * (int) (mod * 100) / 100;
        }
    }
    int e = targetObj.getIntParam(PARAMS.C_ENDURANCE);
    int t = targetObj.getIntParam(PARAMS.C_TOUGHNESS);
    e = MathMaster.getCentimalPercentage(damage, e);
    t = MathMaster.getCentimalPercentage(damage, t);
    // TODO unconscious rule specifics
    return damage + Math.max(e, t * 2 / 3) * (int) (mod * 100) / 100;
}
Also used : RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) AttackEffect(eidolons.ability.effects.oneshot.attack.AttackEffect) DealDamageEffect(eidolons.ability.effects.oneshot.DealDamageEffect) 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) Unit(eidolons.entity.obj.unit.Unit)

Example 8 with RollEffect

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

the class PriorityManagerImpl method getParamModFactor.

@Override
public float getParamModFactor(DC_Obj target, Effect e, PARAMETER param, int amount) {
    boolean valid = false;
    RollEffect roll = rollMap.get(e);
    if (roll != null) {
        roll.getRef().setTarget(target.getId());
    }
    float numericPriority = 0;
    if (!ParamPriorityAnalyzer.isParamIgnored(param, target))
        try {
            numericPriority = getParamPriority(param);
        } catch (Exception ex) {
            main.system.ExceptionMaster.printStackTrace(ex);
        }
    // ParamPriorityAnalyzer.getParamNumericPriority(param, target);
    int mod = 100;
    if (roll != null) {
        mod = getRollPriorityMod(roll);
    }
    int multiplier = Math.abs(Math.round(numericPriority * (amount) * mod / 100));
    if (multiplier != 0) {
        valid = true;
    }
    int percentagePriority = 0;
    if (!ParamAnalyzer.isParamIgnored(getUnit(), param)) {
        percentagePriority = (int) getPriorityConstantMaster().getParamPriority(param) * amount;
    }
    int percentage = MathMaster.getCentimalPercentage(amount, target.getIntParam(param));
    multiplier += MathMaster.getFractionValueCentimal(percentagePriority, percentage) * mod / 100;
    return new Float(multiplier) / 100;
}
Also used : RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect)

Aggregations

RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)8 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)6 Effect (main.ability.effects.Effect)5 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)4 AttackEffect (eidolons.ability.effects.oneshot.attack.AttackEffect)4 Effects (main.ability.effects.Effects)4 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 OwnershipChangeEffect (main.ability.effects.common.OwnershipChangeEffect)3 InstantDeathEffect (main.ability.effects.oneshot.InstantDeathEffect)3 ArrayList (java.util.ArrayList)2 DC_Effect (eidolons.ability.effects.DC_Effect)1 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 RayEffect (eidolons.ability.effects.containers.customtarget.RayEffect)1 WaveEffect (eidolons.ability.effects.containers.customtarget.WaveEffect)1