mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
Merge branch 'master' of https://github.com/magefree/mage
This commit is contained in:
commit
570c2c2c5d
2 changed files with 49 additions and 10 deletions
|
@ -81,4 +81,27 @@ public class CrewTest extends CardTestPlayerBase {
|
||||||
assertType("Smuggler's Copter", CardType.CREATURE, "Vehicle");
|
assertType("Smuggler's Copter", CardType.CREATURE, "Vehicle");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testThatBouncingACrewedVehicleWillUncrewIt() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Smuggler's Copter", 1);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Speedway Fanatic", 1);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 7);
|
||||||
|
addCard(Zone.HAND, playerA, "Evacuation", 1);
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Crew 1");
|
||||||
|
setChoice(playerA, "Speedway Fanatic");
|
||||||
|
|
||||||
|
// Return all creatures to there owners hands
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Evacuation");
|
||||||
|
|
||||||
|
// (Re)Cast Smugglers Copter
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Smuggler's Copter");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
// Only crewed vehicles have card type creature
|
||||||
|
assertNotType("Smuggler's Copter", CardType.CREATURE);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -703,22 +703,24 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
||||||
* @param subType a subtype to test for
|
* @param subType a subtype to test for
|
||||||
*/
|
*/
|
||||||
public void assertType(String cardName, CardType type, String subType) throws AssertionError {
|
public void assertType(String cardName, CardType type, String subType) throws AssertionError {
|
||||||
Permanent found = null;
|
Permanent found = getPermanent(cardName);
|
||||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
|
||||||
if (permanent.getName().equals(cardName)) {
|
|
||||||
found = permanent;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found);
|
|
||||||
|
|
||||||
Assert.assertTrue("(Battlefield) card type not found (" + cardName + ':' + type + ')', found.getCardType().contains(type));
|
Assert.assertTrue("(Battlefield) card type not found (" + cardName + ':' + type + ')', found.getCardType().contains(type));
|
||||||
if (subType != null) {
|
if (subType != null) {
|
||||||
Assert.assertTrue("(Battlefield) card sub-type not equal (" + cardName + ':' + subType + ')', found.getSubtype(currentGame).contains(subType));
|
Assert.assertTrue("(Battlefield) card sub-type not equal (" + cardName + ':' + subType + ')', found.getSubtype(currentGame).contains(subType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assert whether a permanent is not a specified type
|
||||||
|
*
|
||||||
|
* @param cardName Name of the permanent that should be checked.
|
||||||
|
* @param type A type to test for
|
||||||
|
*/
|
||||||
|
public void assertNotType(String cardName, CardType type) throws AssertionError {
|
||||||
|
Permanent found = getPermanent(cardName);
|
||||||
|
Assert.assertFalse("(Battlefield) card type found (" + cardName + ':' + type + ')', found.getCardType().contains(type));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assert whether a permanent is tapped or not
|
* Assert whether a permanent is tapped or not
|
||||||
*
|
*
|
||||||
|
@ -922,6 +924,20 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
||||||
Assert.assertEquals("message", currentGame.getState().getActivePlayerId(), player.getId());
|
Assert.assertEquals("message", currentGame.getState().getActivePlayerId(), player.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Permanent getPermanent(String cardName) {
|
||||||
|
Permanent found = null;
|
||||||
|
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||||
|
if (permanent.getName().equals(cardName)) {
|
||||||
|
found = permanent;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.assertNotNull("Couldn't find a card with specified name: " + cardName, found);
|
||||||
|
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
public Permanent getPermanent(String cardName, Player player) {
|
public Permanent getPermanent(String cardName, Player player) {
|
||||||
return getPermanent(cardName, player.getId());
|
return getPermanent(cardName, player.getId());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue