From f7a7b69be32cd14089a5547c26de243aedbeba1d Mon Sep 17 00:00:00 2001 From: Duncan Townsend Date: Thu, 22 Jan 2015 22:56:34 -0500 Subject: [PATCH] Use mage.util.SpellTargetAddress everywhere we iterate over Targets in Ink-Treader Nephilim. Also removed unused imports. --- .../mage/sets/guildpact/InkTreaderNephilim.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Mage.Sets/src/mage/sets/guildpact/InkTreaderNephilim.java b/Mage.Sets/src/mage/sets/guildpact/InkTreaderNephilim.java index b086a567d7..960c5b6a8d 100644 --- a/Mage.Sets/src/mage/sets/guildpact/InkTreaderNephilim.java +++ b/Mage.Sets/src/mage/sets/guildpact/InkTreaderNephilim.java @@ -36,7 +36,6 @@ import mage.constants.Rarity; import mage.MageInt; import mage.cards.CardImpl; import mage.abilities.Ability; -import mage.abilities.SpellAbility; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; @@ -53,7 +52,6 @@ import mage.game.stack.Spell; import java.util.Map; import java.util.List; import mage.target.Target; -import mage.abilities.Modes; import mage.filter.predicate.mageobject.FromSetPredicate; import mage.players.Player; import mage.target.TargetPermanent; @@ -130,15 +128,11 @@ class InkTreaderNephilimTriggeredAbility extends TriggeredAbilityImpl { if (spell != null) { boolean allTargetsInkTreaderNephilim = true; boolean atLeastOneTargetsInkTreaderNephilim = false; - for (SpellAbility spellAbility: spell.getSpellAbilities()){ - Modes modesSpell = spellAbility.getModes(); - for (UUID mode : modesSpell.getSelectedModes()) { - for (Target targetInstance : modesSpell.get(mode).getTargets()) { - for (UUID target : targetInstance.getTargets()) { - allTargetsInkTreaderNephilim &= target.equals(sourceId); - atLeastOneTargetsInkTreaderNephilim |= target.equals(sourceId); - } - } + for (SpellTargetAddress addr : SpellTargetAddress.walk(spell)) { + Target targetInstance = addr.getTarget(spell); + for (UUID target : targetInstance.getTargets()) { + allTargetsInkTreaderNephilim &= target.equals(sourceId); + atLeastOneTargetsInkTreaderNephilim |= target.equals(sourceId); } } if (allTargetsInkTreaderNephilim && atLeastOneTargetsInkTreaderNephilim) {