Use mage.util.SpellTargetAddress everywhere we iterate over Targets in Ink-Treader Nephilim.

Also removed unused imports.
This commit is contained in:
Duncan Townsend 2015-01-22 22:56:34 -05:00
parent 542997be8f
commit f7a7b69be3
No known key found for this signature in database
GPG key ID: C00ECDF315F7A593

View file

@ -36,7 +36,6 @@ import mage.constants.Rarity;
import mage.MageInt; import mage.MageInt;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -53,7 +52,6 @@ import mage.game.stack.Spell;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
import mage.target.Target; import mage.target.Target;
import mage.abilities.Modes;
import mage.filter.predicate.mageobject.FromSetPredicate; import mage.filter.predicate.mageobject.FromSetPredicate;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
@ -130,17 +128,13 @@ class InkTreaderNephilimTriggeredAbility extends TriggeredAbilityImpl {
if (spell != null) { if (spell != null) {
boolean allTargetsInkTreaderNephilim = true; boolean allTargetsInkTreaderNephilim = true;
boolean atLeastOneTargetsInkTreaderNephilim = false; boolean atLeastOneTargetsInkTreaderNephilim = false;
for (SpellAbility spellAbility: spell.getSpellAbilities()){ for (SpellTargetAddress addr : SpellTargetAddress.walk(spell)) {
Modes modesSpell = spellAbility.getModes(); Target targetInstance = addr.getTarget(spell);
for (UUID mode : modesSpell.getSelectedModes()) {
for (Target targetInstance : modesSpell.get(mode).getTargets()) {
for (UUID target : targetInstance.getTargets()) { for (UUID target : targetInstance.getTargets()) {
allTargetsInkTreaderNephilim &= target.equals(sourceId); allTargetsInkTreaderNephilim &= target.equals(sourceId);
atLeastOneTargetsInkTreaderNephilim |= target.equals(sourceId); atLeastOneTargetsInkTreaderNephilim |= target.equals(sourceId);
} }
} }
}
}
if (allTargetsInkTreaderNephilim && atLeastOneTargetsInkTreaderNephilim) { if (allTargetsInkTreaderNephilim && atLeastOneTargetsInkTreaderNephilim) {
return true; return true;
} }