From a3c57c2f4b8b6c9f7cd5dfc040ba02acfac5e677 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Mon, 8 Aug 2016 07:59:02 +0000 Subject: [PATCH] DamageDealAi: fixed for the AI is not the activator of the damage spell might need some more AILogic. --- .../src/main/java/forge/ai/ability/DamageDealAi.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java b/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java index e5d3a402658..c284ce16054 100644 --- a/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java @@ -166,8 +166,14 @@ public class DamageDealAi extends DamageAiBase { //return null; } final TargetRestrictions tgt = sa.getTargetRestrictions(); + final Player activator = sa.getActivatingPlayer(); final Card source = sa.getHostCard(); - List hPlay = CardLists.getValidCards(pl.getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), ai, source, sa); + final Game game = source.getGame(); + List hPlay = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), activator, source, sa); + + if (activator.equals(ai)) { + hPlay = CardLists.filterControlledBy(hPlay, pl); + } final List objects = Lists.newArrayList(sa.getTargets().getTargets()); if (sa.hasParam("TargetUnique")) { @@ -193,7 +199,7 @@ public class DamageDealAi extends DamageAiBase { }); Card targetCard = null; - if (pl.isOpponentOf(ai) && !killables.isEmpty()) { + if (pl.isOpponentOf(ai) && activator.equals(ai) && !killables.isEmpty()) { if (sa.getTargetRestrictions().canTgtPlaneswalker()) { targetCard = ComputerUtilCard.getBestPlaneswalkerAI(killables); } @@ -209,7 +215,7 @@ public class DamageDealAi extends DamageAiBase { } if (!hPlay.isEmpty()) { - if (pl.isOpponentOf(ai)) { + if (pl.isOpponentOf(ai) && activator.equals(ai)) { if (sa.getTargetRestrictions().canTgtPlaneswalker()) { targetCard = ComputerUtilCard.getBestPlaneswalkerAI(hPlay); }