forked from External/mage
* Fixed that player enchnatments were not correctly removed as they left the battlefield causing problems if they were cast again later in the game (fixes #1006).
This commit is contained in:
parent
a50447c84d
commit
36eebfa317
4 changed files with 71 additions and 5 deletions
|
|
@ -54,7 +54,6 @@ public class CurseOfDeathsHold extends CardImpl {
|
|||
this.subtype.add("Aura");
|
||||
this.subtype.add("Curse");
|
||||
|
||||
|
||||
// Enchant player
|
||||
TargetPlayer auraTarget = new TargetPlayer();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
|
|
@ -106,5 +105,4 @@ class CurseOfDeathsHoldEffect extends ContinuousEffectImpl {
|
|||
public CurseOfDeathsHoldEffect copy() {
|
||||
return new CurseOfDeathsHoldEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,6 +232,63 @@ public class CursesTest extends CardTestPlayerBase {
|
|||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
assertPermanentCount(playerA, "Curse of Misfortunes", 1);
|
||||
assertPermanentCount(playerA, "Curse of Bloodletting", 1); }
|
||||
assertPermanentCount(playerA, "Curse of Bloodletting", 1);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCurseOfDeathsHold() {
|
||||
// Creatures enchanted player controls get -1/-1.
|
||||
addCard(Zone.HAND, playerA, "Curse of Death's Hold");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Curse of Death's Hold", playerB);
|
||||
|
||||
setStopAt(1, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Curse of Death's Hold", 1);
|
||||
|
||||
assertPowerToughness(playerB, "Silvercoat Lion", 1, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCurseOfDeathsHold2() {
|
||||
// Creatures enchanted player controls get -1/-1.
|
||||
addCard(Zone.HAND, playerA, "Curse of Death's Hold");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 7);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Tasigur, the Golden Fang", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Forest", 3);
|
||||
addCard(Zone.HAND, playerB, "Reclamation Sage");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Curse of Death's Hold", playerB);
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Reclamation Sage");
|
||||
addTarget(playerB, "Curse of Death's Hold");
|
||||
|
||||
// {2}{G/U}{G/U}: Put the top two cards of your library into your graveyard, then return a nonland card of an opponent's choice from your graveyard to your hand.
|
||||
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{G/U}{G/U}: Put the top two cards");
|
||||
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Curse of Death's Hold", playerB);
|
||||
|
||||
setStopAt(3, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertGraveyardCount(playerB, "Reclamation Sage", 1);
|
||||
assertPermanentCount(playerA, "Curse of Death's Hold", 1);
|
||||
assertGraveyardCount(playerA, 2);
|
||||
|
||||
assertPowerToughness(playerB, "Silvercoat Lion", 1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2058,6 +2058,11 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
Permanent attachedTo = getPermanent(perm.getAttachedTo());
|
||||
if (attachedTo != null) {
|
||||
attachedTo.removeAttachment(perm.getId(), this);
|
||||
} else {
|
||||
Player attachedToPlayer = getPlayer(perm.getAttachedTo());
|
||||
if (attachedToPlayer != null) {
|
||||
attachedToPlayer.removeAttachment(perm.getId(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
// check if it's a creature and must be removed from combat
|
||||
|
|
|
|||
|
|
@ -789,12 +789,17 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
@Override
|
||||
public boolean removeFromBattlefield(Permanent permanent, Game game) {
|
||||
permanent.removeFromCombat(game, false);
|
||||
game.getBattlefield().removePermanent(permanent.getId());
|
||||
if (permanent.getAttachedTo() != null) {
|
||||
Permanent attachedTo = game.getPermanent(permanent.getAttachedTo());
|
||||
if (attachedTo != null) {
|
||||
attachedTo.removeAttachment(permanent.getId(), game);
|
||||
} else {
|
||||
Player attachedToPlayer = game.getPlayer(permanent.getAttachedTo());
|
||||
if (attachedToPlayer != null) {
|
||||
attachedToPlayer.removeAttachment(permanent.getId(), game);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (permanent.getPairedCard() != null) {
|
||||
Permanent pairedCard = game.getPermanent(permanent.getPairedCard());
|
||||
|
|
@ -802,6 +807,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
pairedCard.clearPairedCard();
|
||||
}
|
||||
}
|
||||
game.getBattlefield().removePermanent(permanent.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue