Use mage.util.SpellTargetAddress in Ink-Treader Nephilim.

This commit is contained in:
Duncan Townsend 2015-01-22 01:19:17 -05:00
parent d341e39e05
commit 018a2a163e
No known key found for this signature in database
GPG key ID: C00ECDF315F7A593

View file

@ -60,7 +60,7 @@ import mage.abilities.Modes;
import mage.filter.predicate.ObjectPlayer;
import mage.filter.predicate.ObjectPlayerPredicate;
import mage.target.TargetPermanent;
import mage.util.SpellTargetAddress;
/**
* @author duncancmt
@ -190,19 +190,13 @@ class InkTreaderNephilimEffect extends OneShotEffect {
continue; // copy only for other creatures
}
boolean legal = true;
for (SpellAbility sa : copy.getSpellAbilities()) {
Modes modes = sa.getModes();
for (UUID mode : modes.getSelectedModes()) {
for (Target targetInstance : modes.get(mode).getTargets()) {
legal &= targetInstance.canTarget(permanent.getId(), sa, game);
}
}
for (SpellTargetAddress addr : SpellTargetAddress.walk(copy)) {
Target targetInstance = addr.getTarget(copy);
legal &= targetInstance.canTarget(permanent.getId(), addr.getSpellAbility(copy), game);
}
if (legal) {
for (SpellAbility sa : copy.getSpellAbilities()) {
Modes modes = sa.getModes();
for (UUID mode : modes.getSelectedModes()) {
for (Target targetInstance : modes.get(mode).getTargets()) {
for (SpellTargetAddress addr : SpellTargetAddress.walk(copy)) {
Target targetInstance = addr.getTarget(copy);
int numTargets = targetInstance.getNumberOfTargets();
targetInstance.clearChosen();
while (numTargets > 0) {
@ -210,8 +204,6 @@ class InkTreaderNephilimEffect extends OneShotEffect {
numTargets--;
}
}
}
}
targetable.put(permanent.getId(), copy);
}
}