use of org.mage.test.player.TestPlayer in project mage by magefree.
the class GoadTest method assertAttacking.
private void assertAttacking(String attacker, TestPlayer... players) {
Assert.assertTrue("At least one player should be provided", players.length > 0);
Permanent permanent = getPermanent(attacker);
Assert.assertTrue("Creature should be tapped", permanent.isTapped());
Assert.assertTrue("Creature should be attacking", permanent.isAttacking());
UUID defenderId = currentGame.getCombat().getDefenderId(permanent.getId());
Assert.assertTrue("Creature should be attacking one the following players: " + Arrays.stream(players).map(Player::getName).reduce((a, b) -> a + ", " + b).orElse(""), Arrays.stream(players).map(TestPlayer::getId).anyMatch(defenderId::equals));
}
use of org.mage.test.player.TestPlayer in project mage by magefree.
the class CardTestPlayerAPIImpl method assertAllCommandsUsed.
/**
* Raise error on any unused commands, choices or targets If you want to
* test that ability can't be activated then use call checkPlayableAbility()
*
* @throws AssertionError
*/
public void assertAllCommandsUsed() throws AssertionError {
for (Player player : currentGame.getPlayers().values()) {
TestPlayer testPlayer = (TestPlayer) player;
assertActionsMustBeEmpty(testPlayer);
assertChoicesCount(testPlayer, 0);
assertTargetsCount(testPlayer, 0);
}
}
use of org.mage.test.player.TestPlayer in project mage by magefree.
the class CardTestPlayerBaseWithMonteCarloAIHelps method createPlayer.
@Override
protected TestPlayer createPlayer(String name, RangeOfInfluence rangeOfInfluence) {
TestPlayer testPlayer = new TestPlayer(new TestComputerPlayerMonteCarlo(name, RangeOfInfluence.ONE, 6));
// AI can't play it by itself, use AI commands
testPlayer.setAIPlayer(false);
return testPlayer;
}
use of org.mage.test.player.TestPlayer in project mage by magefree.
the class CardTestCommander4PlayersWithAIHelps method createPlayer.
@Override
protected TestPlayer createPlayer(String name, RangeOfInfluence rangeOfInfluence) {
// use same RangeOfInfluence.ALL as CardTestCommander4Players do
TestPlayer testPlayer = new TestPlayer(new TestComputerPlayer7(name, RangeOfInfluence.ALL, 6));
// AI can't play it by itself, use AI commands
testPlayer.setAIPlayer(false);
return testPlayer;
}
use of org.mage.test.player.TestPlayer in project mage by magefree.
the class CardTestPlayerBaseWithAIHelps method createPlayer.
@Override
protected TestPlayer createPlayer(String name, RangeOfInfluence rangeOfInfluence) {
TestPlayer testPlayer = new TestPlayer(new TestComputerPlayer7(name, RangeOfInfluence.ONE, 6));
// AI can't play it by itself, use AI commands
testPlayer.setAIPlayer(false);
return testPlayer;
}
Aggregations