mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
Implementing Blitz mechanic (WIP) (#8835)
* added blitz mechanic (mostly copy/paste of dash) * renamed class * reworked alt cost abilities, greatly reduced redundant code * updated text generation * removed all skips * added test for blitz * changed blitz implementation * [SNC] Implemented Tenacious Underdog
This commit is contained in:
parent
76daf4bd5a
commit
0e3252d256
31 changed files with 620 additions and 722 deletions
|
|
@ -0,0 +1,145 @@
|
|||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class BlitzTest extends CardTestPlayerBase {
|
||||
|
||||
private static final String withBlitz = " with Blitz";
|
||||
private static final String decoy = "Riveteers Decoy";
|
||||
private static final String underdog = "Tenacious Underdog";
|
||||
private static final String will = "Yawgmoth's Will";
|
||||
|
||||
private void assertBlitzed(String cardName, boolean isBlitzed) {
|
||||
assertPermanentCount(playerA, cardName, 1);
|
||||
Permanent permanent = getPermanent(cardName);
|
||||
Assert.assertEquals(
|
||||
"Permanent should " + (isBlitzed ? "" : "not ") + "have haste", isBlitzed,
|
||||
permanent.hasAbility(HasteAbility.getInstance(), currentGame)
|
||||
);
|
||||
Assert.assertEquals(
|
||||
"Permanent should " + (isBlitzed ? "" : "not ") + "have card draw trigger", isBlitzed,
|
||||
permanent
|
||||
.getAbilities(currentGame)
|
||||
.stream()
|
||||
.map(Ability::getRule)
|
||||
.anyMatch("When this creature dies, draw a card."::equals)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBlitz() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
|
||||
addCard(Zone.HAND, playerA, decoy);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, decoy + withBlitz);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, decoy, 1);
|
||||
assertBlitzed(decoy, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBlitzSacrificed() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
|
||||
addCard(Zone.HAND, playerA, decoy);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, decoy + withBlitz);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, decoy, 0);
|
||||
assertGraveyardCount(playerA, decoy, 1);
|
||||
assertHandCount(playerA, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoBlitz() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||
addCard(Zone.HAND, playerA, decoy);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, decoy);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, decoy, 1);
|
||||
assertBlitzed(decoy, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTenaciousUnderdogNormal() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
addCard(Zone.GRAVEYARD, playerA, underdog);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, underdog);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
try {
|
||||
execute();
|
||||
} catch (AssertionError e) {
|
||||
Assert.assertEquals(
|
||||
"Shouldn't be able to cast normally from graveyard",
|
||||
"Missing CAST/ACTIVATE def for turn 1, step PRECOMBAT_MAIN, PlayerA\n" +
|
||||
"Can't find available command - activate:Cast Tenacious Underdog " +
|
||||
"(use checkPlayableAbility for \"non available\" checks)", e.getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
assertGraveyardCount(playerA, underdog, 1);
|
||||
assertLife(playerA, 20);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTenaciousUnderdogBlitz() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
|
||||
addCard(Zone.GRAVEYARD, playerA, underdog);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, underdog + withBlitz);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertBlitzed(underdog, true);
|
||||
assertLife(playerA, 20 - 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTenaciousUnderdogYawgmothsWill() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||
addCard(Zone.HAND, playerA, will);
|
||||
addCard(Zone.GRAVEYARD, playerA, underdog);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, will);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, underdog);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertBlitzed(underdog, false);
|
||||
assertLife(playerA, 20);
|
||||
}
|
||||
}
|
||||
|
|
@ -8,7 +8,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward
|
||||
*/
|
||||
public class DashTest extends CardTestPlayerBase {
|
||||
|
|
@ -31,7 +30,6 @@ public class DashTest extends CardTestPlayerBase {
|
|||
* may cast this spell for its dash cost. If you do, it gains haste, and
|
||||
* it's returned from the battlefield to its owner's hand at the beginning
|
||||
* of the next end step.)
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testDash() {
|
||||
|
|
@ -133,4 +131,21 @@ public class DashTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Warbringer", 2);
|
||||
assertHandCount(playerA, "Warbringer", 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegularCostReduction() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Ruby Medallion");
|
||||
addCard(Zone.HAND, playerA, "Screamreach Brawler");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Screamreach Brawler");
|
||||
setChoice(playerA, true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Ruby Medallion", 1);
|
||||
assertPermanentCount(playerA, "Screamreach Brawler", 1);
|
||||
assertHandCount(playerA, "Screamreach Brawler", 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue