use of main.ability.effects.Effects 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;
}
use of main.ability.effects.Effects in project Eidolons by IDemiurge.
the class PriorityManagerImpl method getSpellCustomHostilePriority.
@Override
public int getSpellCustomHostilePriority(Action action) {
Effects effects = EffectFinder.getEffectsFromSpell(action.getActive());
// TODO targets???
for (Effect e : effects) {
addConstant(getSpellCustomHostileEffectPriority(action.getTarget(), action.getActive(), e), e.toString());
}
applyResistPenalty(action);
return priority;
}
use of main.ability.effects.Effects in project Eidolons by IDemiurge.
the class EffectFinder method getBuffEffects.
public static List<Effect> getBuffEffects(Effect e, Class<?> CLASS) {
List<Effect> list = new ArrayList<>();
if (e instanceof AddBuffEffect) {
AddBuffEffect addBuffEffect = (AddBuffEffect) e;
Effect effect = addBuffEffect.getEffect();
if (effect == null) {
return list;
}
if (effect instanceof Effects) {
Effects effects = (Effects) effect;
for (Effect eff : effects) {
if (ClassMaster.isInstanceOf(eff, CLASS)) {
list.add(eff);
}
}
} else if (ClassMaster.isInstanceOf(effect, CLASS)) {
return new ListMaster<Effect>().getList(effect);
}
}
return list;
}
use of main.ability.effects.Effects in project Eidolons by IDemiurge.
the class EffectFinder method initParamModEffects.
public static Effects initParamModEffects(String modString, Ref ref) {
Effects modEffects = new Effects();
Map<PARAMETER, String> map = new RandomWizard<PARAMETER>().constructStringWeightMap(modString, PARAMETER.class);
initParamModEffects(modEffects, map, ref);
return modEffects;
}
use of main.ability.effects.Effects in project Eidolons by IDemiurge.
the class DC_Obj method addSpecialEffect.
public void addSpecialEffect(SPECIAL_EFFECTS_CASE case_type, Effect effects) {
if (effects instanceof Effects) {
Effects effects_ = (Effects) effects;
for (Effect e : effects_.getEffects()) {
addSpecialEffect(case_type, e);
}
return;
}
if (effects instanceof AddSpecialEffects) {
AddSpecialEffects addSpecialEffects = (AddSpecialEffects) effects;
effects = addSpecialEffects.getEffects();
}
if (getSpecialEffects().get(case_type) != null) {
getSpecialEffects().put(case_type, new Effects(getSpecialEffects().get(case_type), effects));
} else {
getSpecialEffects().put(case_type, effects);
}
}
Aggregations