Fixed handling and initialization of Fixedtarget object. Fixing a problem of ReturnToBattlefieldUnderYourControlTargetEffect that caused objects to return taht already left the zone they should be moved from.

This commit is contained in:
LevelX2 2015-06-29 18:34:53 +02:00
parent 148fd0e6ae
commit f45c5cedeb
16 changed files with 398 additions and 209 deletions

View file

@ -1401,6 +1401,9 @@ public abstract class GameImpl implements Game, Serializable {
} else {
TriggeredAbility newAbility = ability.copy();
newAbility.newId();
for (Effect effect : newAbility.getEffects()) {
effect.getTargetPointer().init(this, newAbility);
}
state.addTriggeredAbility(newAbility);
}
}
@ -1409,7 +1412,9 @@ public abstract class GameImpl implements Game, Serializable {
public UUID addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility) {
DelayedTriggeredAbility newAbility = delayedAbility.copy();
newAbility.newId();
newAbility.init(this);
// ability.init is called as the ability triggeres not now.
// If a FixedTarget pointer is already set from the effect setting up this delayed ability
// it has to be already initialized so it won't be overwitten as the ability triggers
state.addDelayedTriggeredAbility(newAbility);
return newAbility.getId();
}