mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
Implement Mayhem mechanic (#13877)
This commit is contained in:
parent
e8cd6dbdad
commit
1700180455
3 changed files with 137 additions and 15 deletions
|
|
@ -0,0 +1,89 @@
|
|||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class MayhemTest extends CardTestPlayerBase {
|
||||
|
||||
private static final String islanders = "Spider-Islanders";
|
||||
|
||||
@Test
|
||||
public void testCastRegular() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
addCard(Zone.HAND, playerA, islanders);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, islanders);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, islanders, 1);
|
||||
}
|
||||
|
||||
private static final String imp = "Putrid Imp";
|
||||
|
||||
@Test
|
||||
public void testCastDiscarded() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, imp);
|
||||
addCard(Zone.HAND, playerA, islanders);
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Discard");
|
||||
setChoice(playerA, islanders);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, islanders + " with Mayhem");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, islanders, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCantCastGraveyard() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
addCard(Zone.GRAVEYARD, playerA, islanders);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, islanders + " with Mayhem");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
try {
|
||||
execute();
|
||||
} catch (Throwable e) {
|
||||
Assert.assertEquals(
|
||||
"Should fail to be able to cast " + islanders + " with mayhem as it wasn't discarded this turn",
|
||||
"Can't find ability to activate command: Cast " + islanders + " with Mayhem", e.getMessage()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCantCastDiscardedPreviously() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, imp);
|
||||
addCard(Zone.HAND, playerA, islanders);
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Discard");
|
||||
setChoice(playerA, islanders);
|
||||
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, islanders + " with Mayhem");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
try {
|
||||
execute();
|
||||
} catch (Throwable e) {
|
||||
Assert.assertEquals(
|
||||
"Should fail to be able to cast " + islanders + " with mayhem as it wasn't discarded this turn",
|
||||
"Can't find ability to activate command: Cast " + islanders + " with Mayhem", e.getMessage()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue