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;
}
Aggregations