diff --git a/Mage.Sets/src/mage/cards/c/CurseOfVengeance.java b/Mage.Sets/src/mage/cards/c/CurseOfVengeance.java index 8ee74bfcab8..89bf77e96e1 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfVengeance.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfVengeance.java @@ -25,9 +25,9 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.cards.c; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; @@ -50,8 +50,6 @@ import mage.players.Player; import mage.target.TargetPlayer; import mage.target.targetpointer.FixedTarget; -import java.util.UUID; - /** * @author spjspj */ @@ -158,7 +156,7 @@ class CurseOfVengeancePlayerLosesTriggeredAbility extends TriggeredAbilityImpl { @Override public String getRule() { - return "When enchanted player loses the game, you gain X life and draw X cards, where X is the number of spite counters on Curse of Vengeance"; + return "When enchanted player loses the game, you gain X life and draw X cards, where X is the number of spite counters on {this}"; } } @@ -181,13 +179,13 @@ class CurseOfVengeanceDrawLifeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - Permanent sourceObject = (Permanent) source.getSourceObjectIfItStillExists(game); - - if (sourceObject != null) { + Permanent sourceObject = (Permanent) game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (sourceObject != null && controller != null) { if (sourceObject.getCounters(game).containsKey(CounterType.SPITE)) { controller.drawCards(sourceObject.getCounters(game).getCount(CounterType.SPITE), game); controller.gainLife(sourceObject.getCounters(game).getCount(CounterType.SPITE), game); } + return true; } return false; } diff --git a/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameRangeAllTest.java b/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameRangeAllTest.java index 8fc2c393d7a..9e349a728e3 100644 --- a/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameRangeAllTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameRangeAllTest.java @@ -266,4 +266,45 @@ public class PlayerLeftGameRangeAllTest extends CardTestMultiPlayerBase { assertCounterCount(playerA, "Luminarch Ascension", CounterType.QUEST, 1); // 1 from turn 2 } + + /** + * "When playing in a multiplayer match against humans, the aura curse + * "Curse of Vengeance" is supposed to award cards and life to its caster + * when the victim of the spell loses the game. It seems to erroneously + * award those cards to the victim of the curse, who, by that point, is + * already dead, making the spell almost totally useless." + */ + @Test + public void TestCurseOfVengeance() { + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1); + // Whenever enchanted player casts a spell, put a spite counter on Curse of Vengeance. + // When enchanted player loses the game, you gain X life and draw X cards, where X is the number of spite counters on Curse of Vengeance. + addCard(Zone.HAND, playerA, "Curse of Vengeance"); // Enchantment {B} + + addCard(Zone.HAND, playerC, "Lightning Bolt"); + addCard(Zone.BATTLEFIELD, playerC, "Mountain", 1); + + addCard(Zone.HAND, playerD, "Silvercoat Lion", 2); + addCard(Zone.BATTLEFIELD, playerD, "Plains", 4); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Curse of Vengeance", playerD); + + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerD, "Silvercoat Lion"); + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerD, "Silvercoat Lion"); + + castSpell(2, PhaseStep.BEGIN_COMBAT, playerC, "Lightning Bolt", playerD); + + setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertGraveyardCount(playerC, "Lightning Bolt", 1); + assertGraveyardCount(playerA, "Curse of Vengeance", 1); + + assertLife(playerD, -1); + Assert.assertFalse("Player D is no longer in the game", playerD.isInGame()); + + assertHandCount(playerA, 3); + assertLife(playerA, 4); + + } }