mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
Combat Calligrapher - fixed game error (NPE error)
This commit is contained in:
parent
05443fb3f4
commit
1dc5ee13a3
1 changed files with 5 additions and 0 deletions
|
@ -82,12 +82,17 @@ class CombatCalligrapherTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Player attacker = game.getPlayer(event.getPlayerId());
|
Player attacker = game.getPlayer(event.getPlayerId());
|
||||||
Player defender = game.getPlayer(event.getTargetId());
|
Player defender = game.getPlayer(event.getTargetId());
|
||||||
|
if (attacker == null || defender == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Do not trigger if opponent is out of range (not visible as opponent to controller, and not the controller)
|
// Do not trigger if opponent is out of range (not visible as opponent to controller, and not the controller)
|
||||||
// or if the person being attacked is not an opponent of the controller.
|
// or if the person being attacked is not an opponent of the controller.
|
||||||
if ((!game.getOpponents(getControllerId()).contains(attacker.getId()) && attacker.getId() != getControllerId())
|
if ((!game.getOpponents(getControllerId()).contains(attacker.getId()) && attacker.getId() != getControllerId())
|
||||||
|| !game.getOpponents(getControllerId()).contains(defender.getId())) {
|
|| !game.getOpponents(getControllerId()).contains(defender.getId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getEffects().setValue("playerToAttack", defender.getId());
|
getEffects().setValue("playerToAttack", defender.getId());
|
||||||
getEffects().setTargetPointer(new FixedTarget(attacker.getId()));
|
getEffects().setTargetPointer(new FixedTarget(attacker.getId()));
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue