* Tunnel Ignus - fixed NPE error for AI;

This commit is contained in:
Oleg Agafonov 2019-01-10 20:56:59 +04:00
parent 5bf0fd89c2
commit ea532fef90

View file

@ -1,10 +1,5 @@
package mage.cards.t;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
@ -22,6 +17,11 @@ import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import mage.watchers.Watcher;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
/**
* @author Loki
*/
@ -72,8 +72,7 @@ class TunnelIgnusWatcher extends Watcher {
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.isLand() && game.getOpponents(this.controllerId).contains(permanent.getControllerId())) {
if (permanent != null && permanent.isLand() && game.getOpponents(this.controllerId).contains(permanent.getControllerId())) {
int count = counts.getOrDefault(permanent.getControllerId(), 0);
counts.put(permanent.getControllerId(), count + 1);
}