From 38f922a200ca68eb1b66cd03786100c7402bcba1 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 7 Apr 2014 13:44:15 +0200 Subject: [PATCH] * Bestow - Fixed a bug that casting a bestow creature as enchantment aura triggered enteres the battlefield events as creatures (e.g. triggering evolve). --- .../cards/abilities/keywords/BestowTest.java | 51 +++++++++++++++++++ .../mage/abilities/keyword/EvolveAbility.java | 2 +- Mage/src/mage/game/stack/Spell.java | 10 ++++ 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/BestowTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/BestowTest.java index 6682f510ba..6ed21a83a1 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/BestowTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/BestowTest.java @@ -86,4 +86,55 @@ public class BestowTest extends CardTestPlayerBase { assertPowerToughness(playerA, "Hopeful Eidolon", 1, 1); } + /** + * Test that cast with bestow does not trigger evolve + */ + @Test + public void bestowEnchantmentDoesNotTriggerEvolve() { + addCard(Zone.BATTLEFIELD, playerA, "Forest", 6); + addCard(Zone.BATTLEFIELD, playerA, "Silent Artisan"); + + addCard(Zone.HAND, playerA, "Experiment One"); + addCard(Zone.HAND, playerA, "Boon Satyr"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Experiment One"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Boon Satyr using bestow", "Silent Artisan"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + // because Boon Satyr is no creature on the battlefield, evolve may not trigger + assertPermanentCount(playerA, "Silent Artisan", 1); + assertPowerToughness(playerA, "Silent Artisan", 7, 7); + assertPermanentCount(playerA, "Experiment One", 1); + assertPowerToughness(playerA, "Experiment One", 1, 1); + } + + /** + * Test that the bestow enchantment becomes a creature if the enchanted creature dies + */ + @Test + public void bestowEnchantmentBecomesCreature() { + addCard(Zone.BATTLEFIELD, playerA, "Plains", 4); + addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); + addCard(Zone.HAND, playerA, "Hopeful Eidolon"); + + addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1); + addCard(Zone.HAND, playerB, "Lightning Bolt"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Hopeful Eidolon using bestow", "Silvercoat Lion"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Silvercoat Lion"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + // because Boon Satyr is no creature on the battlefield, evolve may not trigger + assertLife(playerA, 20); + assertLife(playerB, 20); + + assertPermanentCount(playerA, "Silvercoat Lion", 0); + assertPermanentCount(playerA, "Hopeful Eidolon", 1); + assertPowerToughness(playerA, "Hopeful Eidolon", 1, 1); + } + } diff --git a/Mage/src/mage/abilities/keyword/EvolveAbility.java b/Mage/src/mage/abilities/keyword/EvolveAbility.java index c2537fa222..3710d1368b 100644 --- a/Mage/src/mage/abilities/keyword/EvolveAbility.java +++ b/Mage/src/mage/abilities/keyword/EvolveAbility.java @@ -68,7 +68,7 @@ public class EvolveAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { + if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && !event.getTargetId().equals(this.getSourceId())) { Permanent triggeringCreature = game.getPermanent(event.getTargetId()); if (triggeringCreature != null && triggeringCreature.getCardType().contains(CardType.CREATURE) diff --git a/Mage/src/mage/game/stack/Spell.java b/Mage/src/mage/game/stack/Spell.java index 5c86b1e0c2..630fe4cd62 100644 --- a/Mage/src/mage/game/stack/Spell.java +++ b/Mage/src/mage/game/stack/Spell.java @@ -57,6 +57,7 @@ import mage.counters.Counter; import mage.counters.Counters; import mage.game.Game; import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; import mage.target.TargetAmount; @@ -200,11 +201,20 @@ public class Spell> implements StackObject, Card { if (ability.getTargets().stillLegal(ability, game)) { updateOptionalCosts(0); if (card.putOntoBattlefield(game, fromZone, ability.getId(), controllerId)) { + if (this.getSpellAbility() instanceof BestowAbility) { + Permanent permanent = game.getPermanent(card.getId()); + if (permanent != null) { + // Must be removed first time, after that will be removed by continous effect + // Otherwise effects like evolve trigger from creature comes into play event + permanent.getCardType().remove(CardType.CREATURE); + } + } game.getState().handleSimultaneousEvent(game); return ability.resolve(game); } return false; } + // Aura has no legal target and its a bestow enchantment -> Add it to battlefield as creature if (this.getSpellAbility() instanceof BestowAbility) { updateOptionalCosts(0); result = card.putOntoBattlefield(game, fromZone, ability.getId(), controllerId);