From 83ac7f7bc2eb9272002403906d0ce6c214f85165 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 28 Aug 2020 13:46:21 +0200 Subject: [PATCH] * Nim Deathmantle - Fixed that creature was not returned to battlefield (fixes #7018). --- .../src/mage/cards/n/NimDeathmantle.java | 14 +++-- .../cards/single/som/NimDeathmantleTest.java | 56 +++++++++++++++++++ 2 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/som/NimDeathmantleTest.java diff --git a/Mage.Sets/src/mage/cards/n/NimDeathmantle.java b/Mage.Sets/src/mage/cards/n/NimDeathmantle.java index 005c8c843b0..6198990341e 100644 --- a/Mage.Sets/src/mage/cards/n/NimDeathmantle.java +++ b/Mage.Sets/src/mage/cards/n/NimDeathmantle.java @@ -38,8 +38,6 @@ public final class NimDeathmantle extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); this.subtype.add(SubType.EQUIPMENT); - this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(4))); - // Equipped creature gets +2/+2, has intimidate, and is a black Zombie. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 2))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(IntimidateAbility.getInstance(), AttachmentType.EQUIPMENT))); @@ -48,6 +46,10 @@ public final class NimDeathmantle extends CardImpl { // Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {4}. If you do, return that card to the battlefield and attach Nim Deathmantle to it. this.addAbility(new NimDeathmantleTriggeredAbility()); + + // Equip {4} + this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(4))); + } public NimDeathmantle(final NimDeathmantle card) { @@ -91,7 +93,7 @@ class NimDeathmantleTriggeredAbility extends TriggeredAbilityImpl { && !(permanent instanceof PermanentToken) && permanent.isCreature()) { - getEffects().get(0).setTargetPointer(new FixedTarget(permanent, game)); + getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game) +1)); return true; } return false; @@ -99,7 +101,7 @@ class NimDeathmantleTriggeredAbility extends TriggeredAbilityImpl { @Override public String getRule() { - return "Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {4}. If you do, return that card to the battlefield and attach Nim Deathmantle to it."; + return "Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {4}. If you do, return that card to the battlefield and attach {this} to it."; } } @@ -122,8 +124,8 @@ class NimDeathmantleEffect extends OneShotEffect { Permanent equipment = game.getPermanent(source.getSourceId()); if (controller != null && equipment != null) { if (controller.chooseUse(Outcome.Benefit, equipment.getName() + " - Pay " + cost.getText() + '?', source, game)) { - cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { + cost.clearPaid(); + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { UUID target = targetPointer.getFirst(game, source); if (target != null) { Card card = game.getCard(target); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/som/NimDeathmantleTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/som/NimDeathmantleTest.java new file mode 100644 index 00000000000..f12c796289e --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/som/NimDeathmantleTest.java @@ -0,0 +1,56 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.mage.test.cards.single.som; + +import mage.abilities.keyword.IntimidateAbility; +import mage.constants.CardType; +import mage.constants.PhaseStep; +import mage.constants.SubType; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ +public class NimDeathmantleTest extends CardTestPlayerBase { + + @Test + public void test_Basic() { + setStrictChooseMode(true); + + addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 6); + // Equipped creature gets +2/+2, has intimidate, and is a black Zombie. + // Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {4}. If you do, return that card to the battlefield and attach Nim Deathmantle to it. + addCard(Zone.HAND, playerA, "Nim Deathmantle"); // Artifact Equipment {2} + + addCard(Zone.BATTLEFIELD, playerB, "Mountain"); + addCard(Zone.HAND, playerB, "Lightning Bolt"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nim Deathmantle"); + + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Silvercoat Lion"); + setChoice(playerA, "Yes"); // Message: Nim Deathmantle - Pay {4}? + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertAllCommandsUsed(); + + assertGraveyardCount(playerB, "Lightning Bolt",1); + + assertPermanentCount(playerA, "Nim Deathmantle", 1); + + assertPowerToughness(playerA, "Silvercoat Lion", 4, 4); + assertAbility(playerA, "Silvercoat Lion", IntimidateAbility.getInstance(), true); + assertType("Silvercoat Lion", CardType.CREATURE, SubType.ZOMBIE); + + } +} \ No newline at end of file