mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
[AVR] Second Guest + tests. Refactored filters.
This commit is contained in:
parent
3fac42fc3c
commit
32e29392d2
184 changed files with 823 additions and 562 deletions
|
|
@ -5,7 +5,6 @@ import mage.abilities.Abilities;
|
|||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.filter.Filter;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
@ -352,7 +351,18 @@ public class SoulbondKeywordTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void testExileAndReturnBack() {
|
||||
//TODO: Soulbond + Soulshift
|
||||
Assert.assertTrue(false);
|
||||
addCard(Constants.Zone.HAND, playerA, "Elite Vanguard");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Trusted Forcemage");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Elite Vanguard");
|
||||
castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Cloudshift", "Trusted Forcemage");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Trusted Forcemage", 1);
|
||||
assertPowerToughness(playerA, "Trusted Forcemage", 3, 3);
|
||||
assertPowerToughness(playerA, "Elite Vanguard", 3, 2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,105 @@
|
|||
package org.mage.test.cards.abilities.oneshot.counterspell;
|
||||
|
||||
import mage.Constants;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class SecondGuessTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testCounterFirstSpell() {
|
||||
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
addCard(Constants.Zone.HAND, playerA, "Second Guess");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Second Guess", "Lightning Bolt");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 17);
|
||||
|
||||
assertHandCount(playerA, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCounterSecondSpell() {
|
||||
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt", 1);
|
||||
addCard(Constants.Zone.HAND, playerA, "Shock", 1);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
addCard(Constants.Zone.HAND, playerA, "Second Guess");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", playerB);
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Second Guess", "Lightning Bolt");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 17);
|
||||
|
||||
assertHandCount(playerA, 0);
|
||||
assertGraveyardCount(playerA, 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCounterThirdSpell() {
|
||||
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt", 2);
|
||||
addCard(Constants.Zone.HAND, playerA, "Shock", 1);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
addCard(Constants.Zone.HAND, playerA, "Second Guess");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", playerB);
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Second Guess", "Shock");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 12);
|
||||
|
||||
assertHandCount(playerA, 0);
|
||||
assertGraveyardCount(playerA, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that spell are counted for all players
|
||||
*/
|
||||
@Test
|
||||
public void testOverallCount() {
|
||||
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
addCard(Constants.Zone.HAND, playerA, "Second Guess");
|
||||
|
||||
addCard(Constants.Zone.HAND, playerB, "Shock");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mountain");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerB, "Shock", playerA);
|
||||
castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Second Guess", "Shock");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 17);
|
||||
|
||||
assertHandCount(playerA, 0);
|
||||
assertGraveyardCount(playerA, 2);
|
||||
assertHandCount(playerB, 0);
|
||||
assertGraveyardCount(playerB, 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
|||
public boolean choose(Constants.Outcome outcome, Target target, UUID sourceId, Game game, Map<String, Serializable> options) {
|
||||
if (!choices.isEmpty()) {
|
||||
if (target instanceof TargetPermanent) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents((FilterPermanent)target.getFilter())) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents((FilterPermanent)target.getFilter(), game)) {
|
||||
for (String choose2: choices) {
|
||||
if (permanent.getName().equals(choose2)) {
|
||||
if (((TargetPermanent)target).canTarget(playerId, permanent.getId(), null, game) && !target.getTargets().contains(permanent.getId())) {
|
||||
|
|
@ -204,7 +204,7 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
|||
}
|
||||
|
||||
protected Permanent findPermanent(FilterPermanent filter, UUID controllerId, Game game) {
|
||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, controllerId);
|
||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, controllerId, game);
|
||||
if (permanents.size() > 0)
|
||||
return permanents.get(0);
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue