From 04b8dd839ccc79115dbfd6cae61314c791cced52 Mon Sep 17 00:00:00 2001 From: SpikesCafe-google Date: Sat, 20 Jan 2018 23:24:10 -0500 Subject: [PATCH 1/4] Fix Reyhan death trigger (fixes #4055) --- .../mage/cards/r/ReyhanLastOfTheAbzan.java | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java b/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java index 90329f64a9f..154a0c20c74 100644 --- a/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java +++ b/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java @@ -108,19 +108,31 @@ class ReyhanLastOfTheAbzanTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if ((((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD || ((ZoneChangeEvent) event).getToZone() == Zone.COMMAND) - && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { - Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (permanent.getControllerId().equals(this.getControllerId()) && permanent.isCreature()) { - int countersOn = permanent.getCounters(game).getCount(CounterType.P1P1); - if (countersOn > 0) { - this.getEffects().clear(); - this.addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(countersOn))); - } - return true; - } + ZoneChangeEvent zcEvent = (ZoneChangeEvent) event; + // Dies or is put in the command zone + if (zcEvent.getFromZone() != Zone.BATTLEFIELD) { + return false; } - return false; + if (zcEvent.getToZone() != Zone.GRAVEYARD && zcEvent.getToZone() != Zone.COMMAND) { + return false; + } + + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + // A creature you control + if (!permanent.getControllerId().equals(this.getControllerId()) || !permanent.isCreature()) { + return false; + } + + // If it had one or more +1/+1 counters on it + int countersOn = permanent.getCounters(game).getCount(CounterType.P1P1); + if (countersOn == 0) { + return false; + } + + // You may put that may +1/+1 counters on target creature + this.getEffects().clear(); + this.addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(countersOn))); + return true; } @Override From b899ca3b5f18c363726f58c52db20faf8d8e29ef Mon Sep 17 00:00:00 2001 From: SpikesCafe-google Date: Sun, 21 Jan 2018 00:16:24 -0500 Subject: [PATCH 2/4] Update ReyhanLastOfTheAbzan.java --- Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java b/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java index 154a0c20c74..641eb5a4c08 100644 --- a/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java +++ b/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java @@ -118,8 +118,9 @@ class ReyhanLastOfTheAbzanTriggeredAbility extends TriggeredAbilityImpl { } Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + Player player = game.getPlayer(source.getControllerId()); // A creature you control - if (!permanent.getControllerId().equals(this.getControllerId()) || !permanent.isCreature()) { + if (player == null || !player.equals(this.getControllerId()) || permanent == null || !permanent.isCreature()) { return false; } From f0e1eaa8e8569e4696ed9db47f2eb1b4fadfe9f2 Mon Sep 17 00:00:00 2001 From: SpikesCafe-google Date: Sun, 21 Jan 2018 00:26:57 -0500 Subject: [PATCH 3/4] Update ReyhanLastOfTheAbzan.java --- Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java b/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java index 641eb5a4c08..07626437995 100644 --- a/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java +++ b/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java @@ -47,6 +47,7 @@ import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; +import mage.players.Player; import mage.target.common.TargetCreaturePermanent; /** From 7d6e9c51e33607ad8f5e4c30f5b872255479428d Mon Sep 17 00:00:00 2001 From: SpikesCafe-google Date: Sun, 21 Jan 2018 10:37:32 -0500 Subject: [PATCH 4/4] Update ReyhanLastOfTheAbzan.java --- Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java b/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java index 07626437995..d6cbdea28b3 100644 --- a/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java +++ b/Mage.Sets/src/mage/cards/r/ReyhanLastOfTheAbzan.java @@ -118,10 +118,15 @@ class ReyhanLastOfTheAbzanTriggeredAbility extends TriggeredAbilityImpl { return false; } + // A creature Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - Player player = game.getPlayer(source.getControllerId()); - // A creature you control - if (player == null || !player.equals(this.getControllerId()) || permanent == null || !permanent.isCreature()) { + if (permanent == null || !permanent.isCreature()) { + return false; + } + + // You control + Player player = game.getPlayer(this.getControllerId()); + if (player == null || !player.getId().equals(this.getControllerId())) { return false; }