mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Bestow - Fixed a problem that if the target of a bestow enchantment aura got illegal, the bestow permanent did not chnage back to be a creature.
This commit is contained in:
parent
f0f407457e
commit
a85fa82de0
2 changed files with 51 additions and 2 deletions
|
@ -27,11 +27,13 @@
|
|||
*/
|
||||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.abilities.mana.ManaOptions;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
@ -445,4 +447,48 @@ public class BestowTest extends CardTestPlayerBase {
|
|||
assertTapped("Elite Vanguard", true);
|
||||
assertPowerToughness(playerA, "Elite Vanguard", 5, 3); // 2/1 + 3/2 = 5/3
|
||||
}
|
||||
|
||||
/**
|
||||
* When a creature with Nighthowler attatched gets enchanted with Song of
|
||||
* the Dryads, Nightholwer doesn't become a creature and gets turned into a
|
||||
* card without stats.
|
||||
*/
|
||||
@Test
|
||||
public void testEnchantedChangedWithSongOfTheDryads() {
|
||||
// Enchantment Creature — Horror
|
||||
// 0/0
|
||||
// Bestow {2}{B}{B}
|
||||
// Nighthowler and enchanted creature each get +X/+X, where X is the number of creature cards in all graveyards.
|
||||
addCard(Zone.HAND, playerA, "Nighthowler");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // {1}{W} 2/2 creature
|
||||
|
||||
addCard(Zone.GRAVEYARD, playerA, "Pillarfield Ox");
|
||||
addCard(Zone.GRAVEYARD, playerB, "Pillarfield Ox");
|
||||
|
||||
// Enchant permanent
|
||||
// Enchanted permanent is a colorless Forest land.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Forest", 3);
|
||||
addCard(Zone.HAND, playerB, "Song of the Dryads"); // Enchantment Aura {2}{G}
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nighthowler using bestow", "Silvercoat Lion");
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Song of the Dryads", "Silvercoat Lion");
|
||||
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, "Song of the Dryads", 1);
|
||||
|
||||
ManaOptions options = playerA.getAvailableManaTest(currentGame);
|
||||
Assert.assertEquals("Player should be able to create 1 green mana", "{G}", options.get(0).toString());
|
||||
|
||||
assertPermanentCount(playerA, "Nighthowler", 1);
|
||||
assertPowerToughness(playerA, "Nighthowler", 2, 2);
|
||||
assertType("Nighthowler", CardType.CREATURE, true);
|
||||
assertType("Nighthowler", CardType.ENCHANTMENT, true);
|
||||
|
||||
Permanent nighthowler = getPermanent("Nighthowler");
|
||||
Assert.assertFalse("The unattached Nighthowler may not have the aura subtype.", nighthowler.getSubtype(currentGame).contains(SubType.AURA));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1884,6 +1884,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
if (card != null && card.isCreature()) {
|
||||
UUID wasAttachedTo = perm.getAttachedTo();
|
||||
perm.attachTo(null, this);
|
||||
BestowAbility.becomeCreature(perm, this);
|
||||
fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, wasAttachedTo, perm.getId(), perm.getControllerId()));
|
||||
} else if (movePermanentToGraveyardWithInfo(perm)) {
|
||||
somethingHappened = true;
|
||||
|
@ -1909,7 +1910,9 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
if (attachedTo == null
|
||||
|| !((TargetCard) spellAbility.getTargets().get(0)).canTarget(perm.getControllerId(), perm.getAttachedTo(), spellAbility, this)) {
|
||||
if (movePermanentToGraveyardWithInfo(perm)) {
|
||||
attachedTo.removeAttachment(perm.getId(), this);
|
||||
if (attachedTo != null) {
|
||||
attachedTo.removeAttachment(perm.getId(), this);
|
||||
}
|
||||
somethingHappened = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue