Fixed possible null pointer exception of Bitter Feud.

This commit is contained in:
LevelX2 2015-07-15 23:20:36 +02:00
parent 88d6d0fa0f
commit e772c768cd

View file

@ -60,7 +60,6 @@ public class BitterFeud extends CardImpl {
super(ownerId, 32, "Bitter Feud", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{R}"); super(ownerId, 32, "Bitter Feud", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{R}");
this.expansionSetCode = "C14"; this.expansionSetCode = "C14";
// As Bitter Feud enters the battlefield, choose two players. // As Bitter Feud enters the battlefield, choose two players.
this.addAbility(new AsEntersBattlefieldAbility(new BitterFeudEntersBattlefieldEffect())); this.addAbility(new AsEntersBattlefieldAbility(new BitterFeudEntersBattlefieldEffect()));
@ -97,6 +96,7 @@ class BitterFeudEntersBattlefieldEffect extends OneShotEffect {
TargetPlayer target = new TargetPlayer(2, 2, true); TargetPlayer target = new TargetPlayer(2, 2, true);
controller.chooseTarget(outcome, target, source, game); controller.chooseTarget(outcome, target, source, game);
Player player1 = game.getPlayer(target.getFirstTarget()); Player player1 = game.getPlayer(target.getFirstTarget());
if (target.getTargets().size() > 1) {
Player player2 = game.getPlayer(target.getTargets().get(1)); Player player2 = game.getPlayer(target.getTargets().get(1));
if (player1 != null && player2 != null) { if (player1 != null && player2 != null) {
game.getState().setValue(source.getSourceId() + "_player1", player1); game.getState().setValue(source.getSourceId() + "_player1", player1);
@ -106,6 +106,7 @@ class BitterFeudEntersBattlefieldEffect extends OneShotEffect {
return true; return true;
} }
} }
}
return false; return false;
} }
@ -178,9 +179,9 @@ class BitterFeudEffect extends ReplacementEffectImpl {
} else if (damageSource instanceof Card) { } else if (damageSource instanceof Card) {
sourcePlayerId = ((Card) damageSource).getOwnerId(); sourcePlayerId = ((Card) damageSource).getOwnerId();
} }
if (sourcePlayerId != null && if (sourcePlayerId != null
(player1.getId().equals(sourcePlayerId) || player2.getId().equals(sourcePlayerId)) && && (player1.getId().equals(sourcePlayerId) || player2.getId().equals(sourcePlayerId))
!sourcePlayerId.equals(targetPlayerId)) { && !sourcePlayerId.equals(targetPlayerId)) {
return true; return true;
} }
} }