Some changes to restrained event handling (simultaneous events) (fixes #897).

This commit is contained in:
LevelX2 2015-04-19 10:43:12 +02:00
parent a5967d9b2a
commit 568f62c66f
8 changed files with 1023 additions and 935 deletions

View file

@ -215,14 +215,20 @@ public abstract class AbilityImpl implements Ability {
else {
game.addEffect((ContinuousEffect) effect, this);
}
/**
* All restrained trigger events are fired now.
* To restrain the events is mainly neccessary because of the movement of multiple object at once.
* If the event is fired directly as one object moved, other objects are not already in the correct zone
* to check for their effects. (e.g. Valakut, the Molten Pinnacle)
*/
game.getState().handleSimultaneousEvent(game);
game.resetShortLivingLKI();
/**
* game.applyEffects() has to be done at least for every effect that moves cards/permanent between zones,
* so Static effects work as intened if dependant from the moved objects zone it is in
* Otherwise for example were static abilities with replacement effects deactivated to late
* Example: {@link org.mage.test.cards.replacement.DryadMilitantTest#testDiesByDestroy testDiesByDestroy}
*/
// game.applyEffects();
// some effects must be applied before next effect is resolved, because effect is dependend.
if (effect.applyEffectsAfter()) {
game.applyEffects();
}

File diff suppressed because it is too large Load diff

View file

@ -108,7 +108,7 @@ public class PermanentToken extends PermanentImpl {
if (!game.replaceEvent(new ZoneChangeEvent(this, sourceId, this.getControllerId(), Zone.BATTLEFIELD, Zone.EXILED))) {
game.rememberLKI(objectId, Zone.BATTLEFIELD, this);
if (game.getPlayer(controllerId).removeFromBattlefield(this, game)) {
game.fireEvent(new ZoneChangeEvent(this, sourceId, this.getControllerId(), Zone.BATTLEFIELD, Zone.EXILED));
game.addSimultaneousEvent(new ZoneChangeEvent(this, sourceId, this.getControllerId(), Zone.BATTLEFIELD, Zone.EXILED));
return true;
}
}

View file

@ -201,8 +201,8 @@ public class Spell implements StackObject, Card {
result |= spellAbility.resolve(game);
}
}
game.getState().handleSimultaneousEvent(game);
game.resetShortLivingLKI();
// game.getState().handleSimultaneousEvent(game);
// game.resetShortLivingLKI();
index++;
}
}