mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
- added some null checks.
This commit is contained in:
parent
4f0725586b
commit
a01891f11e
4 changed files with 26 additions and 7 deletions
|
@ -71,7 +71,10 @@ class HiddenPredatorsStateTriggeredAbility extends StateTriggeredAbility {
|
|||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
return this.getSourcePermanentIfItStillExists(game).getCardType().contains(CardType.ENCHANTMENT);
|
||||
if (getSourcePermanentIfItStillExists(game) != null) {
|
||||
return getSourcePermanentIfItStillExists(game).isEnchantment();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -54,15 +54,22 @@ class LurkingJackalsStateTriggeredAbility extends StateTriggeredAbility {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.getOpponents(getControllerId()).stream().anyMatch((playerId) -> (game.getPlayer(playerId).getLife() <= 10))) {
|
||||
return true;
|
||||
if (game.getOpponents(getControllerId()) != null) {
|
||||
for (UUID opponentId : game.getOpponents(getControllerId())) {
|
||||
if (game.getPlayer(opponentId).getLife() <= 10) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
return this.getSourcePermanentIfItStillExists(game).getCardType().contains(CardType.ENCHANTMENT);
|
||||
if (getSourcePermanentIfItStillExists(game) != null) {
|
||||
return getSourcePermanentIfItStillExists(game).isEnchantment();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -54,12 +54,18 @@ class OpalAvengerStateTriggeredAbility extends StateTriggeredAbility {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return game.getState().getPlayer(getControllerId()).getLife() <= 10;
|
||||
if (game.getState().getPlayer(getControllerId()) != null) {
|
||||
return game.getState().getPlayer(getControllerId()).getLife() <= 10;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
return this.getSourcePermanentIfItStillExists(game).getCardType().contains(CardType.ENCHANTMENT);
|
||||
if (getSourcePermanentIfItStillExists(game) != null) {
|
||||
return getSourcePermanentIfItStillExists(game).isEnchantment();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -67,7 +67,10 @@ class VeiledCrocodileStateTriggeredAbility extends StateTriggeredAbility {
|
|||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
return this.getSourcePermanentIfItStillExists(game).getCardType().contains(CardType.ENCHANTMENT);
|
||||
if (getSourcePermanentIfItStillExists(game) != null) {
|
||||
return getSourcePermanentIfItStillExists(game).isEnchantment();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue