mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
fixed while on stack effects of copied spells not discarding when copy has left stack
This commit is contained in:
parent
bd92ced539
commit
7d07c220b0
3 changed files with 57 additions and 4 deletions
|
@ -87,7 +87,6 @@ class MeddlingMageReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
MageObject object = game.getObject(event.getSourceId());
|
||||
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
|
||||
return object != null
|
||||
&& !object.isCopy()
|
||||
&& CardUtil.haveSameNames(object, cardName, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package org.mage.test.cards.continuous;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class SplitSecondTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testCounterSpell() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Volcanic Island", 4);
|
||||
addCard(Zone.HAND, playerA, "Sudden Shock");
|
||||
addCard(Zone.HAND, playerA, "Counterspell");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sudden Shock", playerB);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Counterspell", "Sudden Shock");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertHandCount(playerA, "Counterspell", 1);
|
||||
assertGraveyardCount(playerA, "Sudden Shock", 1);
|
||||
assertLife(playerB, 20 - 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopiedSpell() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||
addCard(Zone.HAND, playerA, "Doublecast");
|
||||
addCard(Zone.HAND, playerA, "Sudden Shock");
|
||||
addCard(Zone.HAND, playerA, "Raging Goblin");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Doublecast");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sudden Shock", playerB);
|
||||
|
||||
// No split second spells are on the stack, effect should not apply anymore
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Raging Goblin");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerB, 20 - 2 - 2);
|
||||
assertPermanentCount(playerA, "Raging Goblin", 1);
|
||||
}
|
||||
}
|
|
@ -1965,11 +1965,14 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
// (Isochron Scepter) 12/1/2004: If you don't want to cast the copy, you can choose not to; the copy ceases
|
||||
// to exist the next time state-based actions are checked.
|
||||
Zone zone = state.getZone(copiedCard.getMainCard().getId());
|
||||
if (zone == Zone.BATTLEFIELD || zone == Zone.STACK) {
|
||||
continue;
|
||||
}
|
||||
// TODO: remember LKI of copied cards here after LKI rework
|
||||
switch (zone) {
|
||||
case BATTLEFIELD:
|
||||
continue;
|
||||
case STACK:
|
||||
if (getStack().getStackObject(copiedCard.getId()) != null) {
|
||||
continue;
|
||||
}
|
||||
case GRAVEYARD:
|
||||
for (Player player : getPlayers().values()) {
|
||||
if (player.getGraveyard().contains(copiedCard.getId())) {
|
||||
|
|
Loading…
Reference in a new issue