Check for null player in browbeat. Add shrapnel blast test for omniscience (currently failing)

This commit is contained in:
Dustin Conrad 2014-08-18 19:10:15 -04:00
parent 9219d79b25
commit 327a09c0c1
2 changed files with 27 additions and 1 deletions

View file

@ -99,7 +99,7 @@ class BrowbeatDrawEffect extends OneShotEffect {
boolean drawCards = true;
for(UUID uuid : game.getPlayerList()){
Player player = game.getPlayer(uuid);
if(player.chooseUse(Outcome.Detriment, "Have " + spell.getName() + " deal 5 damage to you?", game)){
if(player != null && player.chooseUse(Outcome.Detriment, "Have " + spell.getName() + " deal 5 damage to you?", game)){
drawCards = false;
player.damage(5, source.getSourceId(), game, false, true);
game.informPlayers(player.getName() + " has " + spell.getName() + " deal 5 to him or her");

View file

@ -99,4 +99,30 @@ public class OmniscienceTest extends CardTestPlayerBase {
assertTapped("Mountain", false);
}
@Test
public void testCastingShrapnelBlast() {
addCard(Zone.BATTLEFIELD, playerA, "Omniscience");
/* player.getPlayable does not take alternate
casting costs in account, so for the test the mana has to be available
but won't be used
*/
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Ornithopter", 1);
addCard(Zone.HAND, playerA, "Shrapnel Blast", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shrapnel Blast");
setChoice(playerA, "Yes");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 15);
assertGraveyardCount(playerA, "Ornithopter", 1);
assertTapped("Mountain", false);
}
}