use of main.ability.effects.Effect 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));
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class DC_CounterRule method initEffects.
public void initEffects() {
effects = new Effects();
STATUS status = getStatus();
if (status != null) {
effects.add(new AddStatusEffect(status.toString()));
}
Effect e = getEffect();
if (e != null) {
effects.add(e);
}
effects.setForcedLayer(getEffectLayer());
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class DC_CounterRule method newTurn.
public void newTurn() {
for (Unit unit : game.getUnits()) {
if (unit.isDead())
continue;
if (!ExplorationMaster.isExplorationOn())
if (isOutsideCombatIgnored())
if (game.getState().getManager().checkUnitIgnoresReset(unit))
continue;
if (getNumberOfCounters(unit) <= 0) {
continue;
}
applyCountersInteractions(unit);
applyCountersConversions(unit);
applyCountersTranfers(unit);
// log TODO spread
int counterMod = getCounterNumberReductionPerTurn(unit);
if (counterMod != 0) {
log(getCounterModifiedLogString(counterMod));
unit.modifyCounter(getCounterName(), -counterMod);
}
Effect oneshotEffects = getSpecialRoundEffects();
if (oneshotEffects != null) {
oneshotEffects.apply(Ref.getSelfTargetingRefCopy(unit));
}
}
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class Saver method getEffectsNodeXml.
public static String getEffectsNodeXml(DC_GameState state) {
StringBuilder builder = new StringBuilder(3000);
builder.append(XML_Converter.openXml(EFECTS_NODE));
for (Effect sub : state.getEffects()) {
builder.append(sub.toXml());
}
// effect layers?
builder.append(XML_Converter.closeXml(EFECTS_NODE));
return builder.toString();
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class StateCloner method cloneAbility.
private Ability cloneAbility(Ability abilities) {
Effects effects = new Effects();
for (Effect e : abilities.getEffects()) {
effects.add(cloneEffect(e));
}
Ability ability = (abilities instanceof ActiveAbility) ? new ActiveAbility(abilities.getTargeting(), effects) : new PassiveAbility(abilities.getTargeting(), effects);
return ability;
}
Aggregations