From a80119b74abab2b4d4b8edf43d81b4703be3b691 Mon Sep 17 00:00:00 2001 From: Agetian Date: Wed, 11 Jan 2017 07:20:38 +0000 Subject: [PATCH] - A more in-depth check for target equality when comparing SAs, fixes certain cards not guessing that they are looking at the ability they need to be looking at (e.g. Grip of Chaos). --- .../game/spellability/SpellAbilityStackInstance.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbilityStackInstance.java b/forge-game/src/main/java/forge/game/spellability/SpellAbilityStackInstance.java index 2319f9db964..a93de193565 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityStackInstance.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityStackInstance.java @@ -325,8 +325,16 @@ public class SpellAbilityStackInstance implements IIdentifiable, IHasCardView { while (compare != null && sub != null) { TargetChoices choices = compare.getTargetRestrictions() != null ? compare.getTargets() : null; - if (choices != null && !choices.equals(sub.getTargetChoices())) { - return false; + if (choices != null) { + TargetChoices subChoices = sub.getTargetChoices(); + if (subChoices == null || choices.getTargets().size() != subChoices.getTargets().size()) { + return false; + } + for (int i = 0; i < choices.getTargets().size(); i++) { + if (!choices.getTargets().get(i).equals(subChoices.getTargets().get(i))) { + return false; + } + } } compare = compare.getSubAbility(); sub = sub.getSubInstance();