From 64e0b4d1b968be9c239773857e7a6ac138b2abc9 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 24 Apr 2014 00:26:27 +0200 Subject: [PATCH] * BestowAbility - Fixed that Bestow creatures didn't revert back to creatures, if the enchanted creature left battlefield. Bug introduced with last fix to bestow ability. --- .../mage/test/cards/abilities/keywords/BestowTest.java | 8 ++++++++ Mage/src/mage/game/stack/Spell.java | 7 +++++++ 2 files changed, 15 insertions(+) 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 1daddfaa1f2..ddd2a81fcba 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 @@ -28,6 +28,8 @@ package org.mage.test.cards.abilities.keywords; +import junit.framework.Assert; +import mage.constants.CardType; import mage.constants.PhaseStep; import mage.constants.Zone; import mage.game.permanent.Permanent; @@ -135,6 +137,12 @@ public class BestowTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Silvercoat Lion", 0); assertPermanentCount(playerA, "Hopeful Eidolon", 1); assertPowerToughness(playerA, "Hopeful Eidolon", 1, 1); + + Permanent hopefulEidolon = getPermanent("Hopeful Eidolon", playerA); + Assert.assertTrue("Hopeful Eidolon has to be a creature but is not", hopefulEidolon.getCardType().contains(CardType.CREATURE)); + Assert.assertTrue("Hopeful Eidolon has to be an enchantment but is not", hopefulEidolon.getCardType().contains(CardType.ENCHANTMENT)); + + } /** diff --git a/Mage/src/mage/game/stack/Spell.java b/Mage/src/mage/game/stack/Spell.java index 19068b7a943..18db89d8fbd 100644 --- a/Mage/src/mage/game/stack/Spell.java +++ b/Mage/src/mage/game/stack/Spell.java @@ -58,6 +58,7 @@ import mage.counters.Counters; import mage.game.Game; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; +import mage.game.permanent.PermanentCard; import mage.players.Player; import mage.target.Target; import mage.target.TargetAmount; @@ -208,6 +209,12 @@ public class Spell> implements StackObject, Card { } if (card.putOntoBattlefield(game, fromZone, ability.getId(), controllerId)) { if (bestow) { + // card will be copied during putOntoBattlefield, so the card of CardPermanent has to be changed + // TODO: Find a better way to prevent bestow creatures from being effected by creature affecting abilities + Permanent permanent = game.getPermanent(card.getId()); + if (permanent != null && permanent instanceof PermanentCard) { + ((PermanentCard) permanent).getCard().getCardType().add(CardType.CREATURE); + } card.getCardType().add(CardType.CREATURE); } game.getState().handleSimultaneousEvent(game);