use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.
the class ModeEffect method addPeriodicEffect.
private void addPeriodicEffect() {
String periodicValues = mode.getPeriodicValues();
if (periodicValues == null)
return;
for (String substring : StringMaster.openContainer(periodicValues)) {
String amount = VariableManager.getVar(substring, 0);
String maxAmount = VariableManager.getVar(substring, 1);
String periodicValue = VariableManager.removeVarPart(substring);
String period = mode.getPeriod();
Formula max = new Formula(maxAmount);
Formula formula = new Formula(amount);
Effect effect = new ModifyValueEffect(periodicValue, MOD.MODIFY_BY_CONST, formula, max);
Effect fx = new PeriodicEffect(period, effect);
fx.setRef(Ref.getSelfTargetingRefCopy(ref.getSourceObj()));
addBuffEffect.addEffect(fx);
}
}
use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.
the class ModeEffect method addEndTurnEffect.
private void addEndTurnEffect() {
Condition condition = new StringComparison(prop, mode.toString(), true);
if (mode == STD_MODES.DIVINATION) {
Effect effect = new DivinationEffect();
addBuffEffect.addEffect(new DelayedEffect(effect, condition));
return;
}
String formula = mode.getFormula();
if (ref.getActive() instanceof DC_ActiveObj) {
DC_ActiveObj activeObj = (DC_ActiveObj) ref.getActive();
if (activeObj.getParam(PARAMS.FORMULA).contains(StringMaster.MOD)) {
formula = StringMaster.wrapInParenthesis(formula) + "*" + activeObj.getParam(PARAMS.FORMULA) + "/100";
} else if (activeObj.getIntParam(PARAMS.FORMULA) != 0) {
formula += "+" + activeObj.getIntParam(PARAMS.FORMULA);
}
}
ModifyValueEffect effect = new ModifyValueEffect(mode.getParameter(), MOD.MODIFY_BY_CONST, new Formula("min(0, " + formula + ")"));
PARAMETER param = ContentManager.getPARAM(mode.getParameter());
effect.setParam(param);
effect.setMaxParam(ContentManager.getBaseParameterFromCurrent(param));
Formula appendedByModifier = new Formula(formula).getAppendedByModifier(timeModifier);
effect.setFormula(appendedByModifier);
addBuffEffect.addEffect(new DelayedEffect(effect, condition));
// new DelayedEffect(effect, condition).apply(ref);
}
use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.
the class RaiseEffect method getRevenantBuff.
private AddBuffEffect getRevenantBuff() {
Effects effect = new Effects();
for (String s : StringMaster.open(getModifiedParam())) {
String varPart = VariableManager.getVarPart(s);
String valueName = s.replace(varPart, "");
String formula = StringMaster.cropParenthesises(varPart) + "*" + // MAX?
getParamModFormula(valueName);
effect.add(new ModifyValueEffect(valueName, MOD.MODIFY_BY_CONST, formula));
}
BuffType buffType = new BuffType(DataManager.getType(BUFF_NAME));
buffType.setName(BUFF_NAME + corpse.getName());
AddBuffEffect e = new AddBuffEffect(buffType, effect);
return e;
}
use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.
the class UnconsciousRule method getWakeUpEffect.
private static Effect getWakeUpEffect(Unit unit) {
Effects e = new Effects();
e.add(new ModifyValueEffect(PARAMS.C_N_OF_ACTIONS, MOD.MODIFY_BY_CONST, "-" + AP_PENALTY));
e.add(new ModifyValueEffect(DC_Engine.isAtbMode() ? PARAMS.C_INITIATIVE : PARAMS.C_INITIATIVE_BONUS, MOD.MODIFY_BY_CONST, "-" + INITIATIVE_PENALTY));
e.add(new RemoveBuffEffect("Unconscious"));
e.setRef(Ref.getSelfTargetingRefCopy(unit));
return e;
}
use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.
the class DiseaseRule method getSpecialRoundEffects.
@Override
protected Effect getSpecialRoundEffects() {
// spread effects could go here! :)
ModifyValueEffect modifyValueEffect = new ModifyValueEffect(PARAMS.C_STAMINA, MOD.MODIFY_BY_CONST, getCounterRef() + "*" + STAMINA_PER_COUNTER);
modifyValueEffect.setMin_max_formula(new Formula("0"));
Effects effects = new Effects(modifyValueEffect);
return effects;
}
Aggregations