mirror of
https://github.com/correl/mage.git
synced 2025-03-12 17:00:08 -09:00
This time correct fix for DiesTriggerAbility.
This commit is contained in:
parent
7b6cedacfa
commit
36bc35f7b2
2 changed files with 13 additions and 1 deletions
|
@ -49,7 +49,7 @@ public class TriggeredAbilities extends AbilitiesImpl<TriggeredAbility> {
|
|||
|
||||
public void checkTriggers(GameEvent event, Game game) {
|
||||
for (TriggeredAbility ability: this) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE || ability.isInUseableZone(game)) {
|
||||
if (ability.isInUseableZone(game)) {
|
||||
MageObject object = game.getObject(ability.getSourceId());
|
||||
if (object != null && object.getAbilities().contains(ability)) {
|
||||
if (ability.checkTrigger(event, game)) {
|
||||
|
|
|
@ -29,8 +29,11 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.cards.Card;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
|
@ -54,6 +57,15 @@ public class DiesTriggeredAbility extends ZoneChangeTriggeredAbility<DiesTrigger
|
|||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game) {
|
||||
// check it was previously on battlefield
|
||||
Card before = game.getLastKnownInformation(sourceId, Constants.Zone.BATTLEFIELD);
|
||||
// check now it is in graveyard
|
||||
Zone after = game.getState().getZone(sourceId);
|
||||
return before != null && after != null && Zone.GRAVEYARD.match(after);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiesTriggeredAbility copy() {
|
||||
return new DiesTriggeredAbility(this);
|
||||
|
|
Loading…
Add table
Reference in a new issue