From df9efa97b6538ccda1242463749c666a6462a00e Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 17 May 2015 22:08:56 +0200 Subject: [PATCH] * Dragonlord Kolaghan - Fixed that morphed cast spells where compared with its origin name with cards in the graveyard. --- .../dragonsoftarkir/DragonlordKolaghan.java | 7 +++-- .../cards/abilities/keywords/MorphTest.java | 29 +++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/DragonlordKolaghan.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/DragonlordKolaghan.java index 0ba24804cc3..26a0f42ae08 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/DragonlordKolaghan.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/DragonlordKolaghan.java @@ -45,6 +45,7 @@ import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.stack.Spell; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -114,12 +115,12 @@ class DragonlordKolaghanTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { Player controller = game.getPlayer(getControllerId()); if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) { - Card card = game.getCard(event.getSourceId()); - if (card != null && (card.getCardType().contains(CardType.CREATURE) || card.getCardType().contains(CardType.PLANESWALKER))) { + Spell spell = game.getStack().getSpell(event.getSourceId()); + if (spell != null && !spell.isFaceDown(game) && (spell.getCardType().contains(CardType.CREATURE) || spell.getCardType().contains(CardType.PLANESWALKER))) { Player opponent = game.getPlayer(event.getPlayerId()); boolean sameName = false; for (Card graveCard :opponent.getGraveyard().getCards(game)) { - if (graveCard.getName().equals(card.getName())) { + if (graveCard.getName().equals(spell.getName())) { sameName = true; break; } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java index f751c9bab89..b3cc3a25c95 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java @@ -585,4 +585,33 @@ public class MorphTest extends CardTestPlayerBase { assertPowerToughness(playerB, "", 2, 2); } + + /** + * Dragonlord Kolaghan passive of 10 damage works when you play a morph creature + * and it isn't suposed to. Because it is nameless. + */ + + @Test + public void testDragonlordKolaghan() { + addCard(Zone.GRAVEYARD, playerA, "Akroma, Angel of Fury", 1); + addCard(Zone.HAND, playerA, "Akroma, Angel of Fury", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); + + // Flying, haste + // Other creatures you control have haste. + // Whenever an opponent casts a creature or planeswalker spell with the same name as a card in his or her graveyard, that player loses 10 life. + addCard(Zone.BATTLEFIELD, playerB, "Dragonlord Kolaghan", 1); + + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akroma, Angel of Fury"); + setChoice(playerA, "Yes"); // cast it face down as 2/2 creature + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerA, 20); + + assertPermanentCount(playerA, "", 1); + + } }