use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.
the class WaitEffect method applyThis.
@Override
public boolean applyThis() {
if (ref.getTargetObj() == ref.getSourceObj()) {
ref.getGame().fireEvent(new Event(STANDARD_EVENT_TYPE.UNIT_WAITS, game));
return true;
}
Ref REF = Ref.getCopy(ref);
REF.setValue(KEYS.TARGET2, ref.getTarget() + "");
REF.setTarget(ref.getSource());
boolean result = new AddBuffEffect(getRetainConditions(), getBuffName(), getEffects(REF)).apply(REF);
if (!result) {
return false;
}
try {
WaitRule.addWaitingUnit((Unit) ref.getSourceObj(), (Unit) ref.getTargetObj());
} catch (Exception e) {
return false;
}
return result;
}
use of eidolons.ability.effects.attachment.AddBuffEffect 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.attachment.AddBuffEffect in project Eidolons by IDemiurge.
the class BuffMaster method applyBuff.
public static void applyBuff(String buffName, Effect effect, Obj target, Integer duration) {
AddBuffEffect addBuffEffect = new AddBuffEffect(buffName, effect);
if (duration != null) {
addBuffEffect.setDuration(duration);
}
addBuffEffect.apply(Ref.getSelfTargetingRefCopy(target));
}
use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.
the class TimeRule method addBuff.
private void addBuff(Unit unitObj, boolean preliminary) {
if (unitObj.isBfObj()) {
return;
}
AddStatusEffect effect;
effect = new AddStatusEffect(UnitEnums.STATUS.LATE);
new AddBuffEffect((preliminary) ? BUFF_NAME_PRELIMINARY : BUFF_NAME, effect, 1).apply(Ref.getSelfTargetingRefCopy(unitObj));
}
use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.
the class ClaimRule method initEffects.
@Override
public void initEffects() {
Conditions conditions = new Conditions();
conditions.add(new NumericCondition("0", CLAIM_COUNTERS));
Conditions conditions2 = new Conditions();
conditions2.add(new OwnershipCondition(KEYS.EVENT_TARGET.name(), true));
conditions2.add(nOfCounters);
RemoveBuffEffect removeBuffEffect = new RemoveBuffEffect(buffName);
Effect effect = new OwnershipChangeEffect(false);
AddBuffEffect addBuffEffect = new AddBuffEffect(new NumericCondition("{BASIS_CLAIM_COUNTERS}", "0"), buffName, effect);
effects = new IfElseEffect(removeBuffEffect, conditions, new ConditionalEffect(conditions2, addBuffEffect));
}
Aggregations