mirror of
https://github.com/magefree/mage.git
synced 2026-01-22 11:19:55 -08:00
* Affinity abilities - added support of other cost modification effects like combo with commander tax (#5856);
* Affinity abilities - added artifact/land count hints to card;
This commit is contained in:
parent
6157187f07
commit
6e5ba7a446
7 changed files with 181 additions and 21 deletions
|
|
@ -6,7 +6,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class AffinityForArtifactsTest extends CardTestPlayerBase {
|
||||
|
|
@ -22,7 +21,10 @@ public class AffinityForArtifactsTest extends CardTestPlayerBase {
|
|||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Myr Enforcer");
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Myr Enforcer", 4);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
package org.mage.test.commander.duel;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestCommanderDuelBase;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public class CommanderAffinityTest extends CardTestCommanderDuelBase {
|
||||
|
||||
/*
|
||||
Blinkmoth Infusion {12}{U}{U}
|
||||
Affinity for artifacts (This spell costs {1} less to cast for each artifact you control.)
|
||||
Untap all artifacts.
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void test_AffinityNormal() {
|
||||
addCard(Zone.HAND, playerA, "Blinkmoth Infusion", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Abzan Banner", 12);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
|
||||
checkHandCardCount("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Blinkmoth Infusion", 1);
|
||||
|
||||
// cast for UU (12 must be reduced)
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Blinkmoth Infusion");
|
||||
checkHandCardCount("after", 1, PhaseStep.BEGIN_COMBAT, playerA, "Blinkmoth Infusion", 0);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_AffinityCommanderNormalReduction() {
|
||||
addCard(Zone.COMMAND, playerA, "Blinkmoth Infusion", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Abzan Banner", 12);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2 + 2 * 2);
|
||||
|
||||
checkCommandCardCount("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Blinkmoth Infusion", 1);
|
||||
|
||||
// first cast for 12UU (-12 by abzan, -UU by islands)
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Blinkmoth Infusion");
|
||||
setChoice(playerA, "Yes"); // keep commander
|
||||
checkCommandCardCount("after 1", 1, PhaseStep.BEGIN_COMBAT, playerA, "Blinkmoth Infusion", 1);
|
||||
|
||||
// second cast for 12UU + 2 (-12 by abzan, -UU by islands, -2 by islands)
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Blinkmoth Infusion");
|
||||
setChoice(playerA, "No"); // remove commander to grave
|
||||
checkCommandCardCount("after 2", 1, PhaseStep.END_TURN, playerA, "Blinkmoth Infusion", 0);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_AffinityCommanderAdditionalReduction() {
|
||||
addCard(Zone.COMMAND, playerA, "Blinkmoth Infusion", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Abzan Banner", 20);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2 + 2);
|
||||
|
||||
checkCommandCardCount("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Blinkmoth Infusion", 1);
|
||||
|
||||
// first cast for 12UU (-12 by abzan, -UU by islands)
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Blinkmoth Infusion");
|
||||
setChoice(playerA, "Yes"); // keep commander
|
||||
checkCommandCardCount("after 1", 1, PhaseStep.BEGIN_COMBAT, playerA, "Blinkmoth Infusion", 1);
|
||||
|
||||
// second cast for 12UU + 2 (-12 by abzan, -UU by islands, -2 by abzan)
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Blinkmoth Infusion");
|
||||
setChoice(playerA, "No"); // remove commander to grave
|
||||
checkCommandCardCount("after 2", 1, PhaseStep.END_TURN, playerA, "Blinkmoth Infusion", 0);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -683,6 +683,13 @@ public class TestPlayer implements Player {
|
|||
wasProccessed = true;
|
||||
}
|
||||
|
||||
// check command card count: card name, count
|
||||
if (params[0].equals(CHECK_COMMAND_COMMAND_CARD_COUNT) && params.length == 3) {
|
||||
assertCommandCardCount(action, game, computerPlayer, params[1], Integer.parseInt(params[2]));
|
||||
actions.remove(action);
|
||||
wasProccessed = true;
|
||||
}
|
||||
|
||||
// check color: card name, colors, must have
|
||||
if (params[0].equals(CHECK_COMMAND_COLOR) && params.length == 4) {
|
||||
assertColor(action, game, computerPlayer, params[1], params[2], Boolean.parseBoolean(params[3]));
|
||||
|
|
@ -1038,6 +1045,18 @@ public class TestPlayer implements Player {
|
|||
Assert.assertEquals(action.getActionName() + " - hand must contain " + count + " cards of " + cardName, count, realCount);
|
||||
}
|
||||
|
||||
private void assertCommandCardCount(PlayerAction action, Game game, Player player, String cardName, int count) {
|
||||
int realCount = 0;
|
||||
for (UUID cardId : game.getCommandersIds(player)) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.getName().equals(cardName) && Zone.COMMAND.equals(game.getState().getZone(cardId))) {
|
||||
realCount++;
|
||||
}
|
||||
}
|
||||
|
||||
Assert.assertEquals(action.getActionName() + " - command zone must contain " + count + " cards of " + cardName, count, realCount);
|
||||
}
|
||||
|
||||
private void assertColor(PlayerAction action, Game game, Player player, String permanentName, String colors, boolean mustHave) {
|
||||
Assert.assertNotEquals(action.getActionName() + " - must setup colors", "", colors);
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
public static final String CHECK_COMMAND_EXILE_COUNT = "EXILE_COUNT";
|
||||
public static final String CHECK_COMMAND_HAND_COUNT = "HAND_COUNT";
|
||||
public static final String CHECK_COMMAND_HAND_CARD_COUNT = "HAND_CARD_COUNT";
|
||||
public static final String CHECK_COMMAND_COMMAND_CARD_COUNT = "COMMAND_CARD_COUNT";
|
||||
public static final String CHECK_COMMAND_COLOR = "COLOR";
|
||||
public static final String CHECK_COMMAND_TYPE = "TYPE";
|
||||
public static final String CHECK_COMMAND_SUBTYPE = "SUBTYPE";
|
||||
|
|
@ -345,6 +346,11 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
check(checkName, turnNum, step, player, CHECK_COMMAND_HAND_CARD_COUNT, cardName, count.toString());
|
||||
}
|
||||
|
||||
public void checkCommandCardCount(String checkName, int turnNum, PhaseStep step, TestPlayer player, String cardName, Integer count) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_COMMAND_CARD_COUNT, cardName, count.toString());
|
||||
}
|
||||
|
||||
public void checkColor(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, String colors, Boolean mustHave) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_COLOR, permanentName, colors, mustHave.toString());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue