* Repeated Reverberation - fixed rollback error on creatures cast (#7474);

This commit is contained in:
Oleg Agafonov 2021-02-03 10:27:23 +04:00
parent 5077a82585
commit c03279d835
3 changed files with 70 additions and 40 deletions

View file

@ -1,4 +1,3 @@
package org.mage.test.cards.single.m20;
import mage.constants.PhaseStep;
@ -8,23 +7,22 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author Jgray1206
*/
public class RepeatedReverberationTest extends CardTestPlayerBase {
/* Repeated Reverberation {2}{R}{R}
* When you next cast an instant spell, cast a sorcery spell, or activate a loyalty ability this turn, copy that spell or ability twice.
* When you next cast an instant spell, cast a sorcery spell, or activate a loyalty ability this turn, copy that spell or ability twice.
* You may choose new targets for the copies.
*/
String repeatedReverb = "Repeated Reverberation";
/**
* https://github.com/magefree/mage/issues/5882
* Repeated Reverberation was not working with loyalty counter abilities.
*/
@Test
public void testRepeatedReverberationWorksWithLoyaltyAbilities() {
public void test_WorksWithLoyaltyAbilities() {
/* Ajani Goldmane: {2}{W}{W} starts with 4 Loyality counters
* +1: You gain 2 life.
* -1: Put a +1/+1 counter on each creature you control. Those creatures gain vigilance until end of turn.
@ -32,7 +30,7 @@ public class RepeatedReverberationTest extends CardTestPlayerBase {
*/
String ajani = "Ajani Goldmane";
addCard(Zone.HAND, playerA, ajani);
addCard(Zone.HAND, playerA, ajani);
addCard(Zone.HAND, playerA, repeatedReverb);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
@ -41,26 +39,26 @@ public class RepeatedReverberationTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, repeatedReverb);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1: You gain 2 life");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, ajani, 1);
assertGraveyardCount(playerA, repeatedReverb, 1);
assertCounterCount(ajani, CounterType.LOYALTY, 5); // 4 + 1 = 5
assertLife(playerA, 26);
assertAllCommandsUsed();
}
@Test
public void testRepeatedReverberationWorksWithInstants() {
public void test_WorksWithInstants() {
/* Soothing Balm - Instant {1}{W}
* Target player gains 5 life
* Just an arbitrary instant to test reverb with.
*/
String soothingBalm = "Soothing Balm";
addCard(Zone.HAND, playerA, soothingBalm);
addCard(Zone.HAND, playerA, repeatedReverb);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
@ -75,20 +73,20 @@ public class RepeatedReverberationTest extends CardTestPlayerBase {
setChoice(playerA, "Yes"); //Choose new targets?
addTarget(playerA, playerA);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerA, soothingBalm, 1);
assertGraveyardCount(playerA, repeatedReverb, 1);
assertLife(playerA, 30);
assertLife(playerB, 25);
assertAllCommandsUsed();
}
@Test
public void testRepeatedReverberationWorksWithSorceries() {
public void test_WorksWithSorceries() {
/* Soul Feast - Sorcery {3}{B}{B}
* Target player loses 4 life. You gain 4 life.
* Just an arbitrary sorcery to test reverb with.
@ -106,15 +104,40 @@ public class RepeatedReverberationTest extends CardTestPlayerBase {
setChoice(playerA, "No"); //Choose new targets?
setChoice(playerA, "No"); //Choose new targets?
setStopAt(1, PhaseStep.BEGIN_COMBAT);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerA, soulFeast, 1);
assertGraveyardCount(playerA, repeatedReverb, 1);
assertLife(playerA, 32);
assertLife(playerB, 8);
}
@Test
public void test_MustNotWorksWithCreatures() {
addCard(Zone.HAND, playerA, repeatedReverb); // {2}{R}{R}
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
//
addCard(Zone.HAND, playerA, "Balduvian Bears", 1);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
// prepare reverb
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, repeatedReverb);
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
// cast creature
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G}", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Balduvian Bears", 1);
assertGraveyardCount(playerA, repeatedReverb, 1);
}
}