* 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.

This commit is contained in:
LevelX2 2014-04-24 00:26:27 +02:00
parent d95c2627f4
commit 64e0b4d1b9
2 changed files with 15 additions and 0 deletions

View file

@ -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));
}
/**

View file

@ -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<T extends Spell<T>> 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);