Search in sources :

Example 1 with BehaviorModeEffect

use of eidolons.ability.effects.continuous.BehaviorModeEffect 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)

Aggregations

AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1 BehaviorModeEffect (eidolons.ability.effects.continuous.BehaviorModeEffect)1 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)1 AttackEffect (eidolons.ability.effects.oneshot.attack.AttackEffect)1 DrainEffect (eidolons.ability.effects.oneshot.mechanic.DrainEffect)1 ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)1 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)1 RaiseEffect (eidolons.ability.effects.oneshot.unit.RaiseEffect)1 SummonEffect (eidolons.ability.effects.oneshot.unit.SummonEffect)1 Effect (main.ability.effects.Effect)1 Effects (main.ability.effects.Effects)1 OwnershipChangeEffect (main.ability.effects.common.OwnershipChangeEffect)1 InstantDeathEffect (main.ability.effects.oneshot.InstantDeathEffect)1 Formula (main.system.math.Formula)1