- Reverting r32912 for now, more investigation needed.

This commit is contained in:
Agetian
2017-01-01 08:29:35 +00:00
parent 7797224826
commit 3a285fcd92

View File

@@ -973,8 +973,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
final GameEntity oldEnchanted = c.getEnchanting();
c.removeEnchanting(oldEnchanted);
}
if (!c.canBeEnchantedBy(attachedTo))
{
if (!checkCanAttachTo(c, attachedTo)) {
// if an aura can't enchant the source, it shouldn't move (303.4i, 303.4j)
continue;
}
@@ -1193,4 +1192,19 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
}
}
}
private static boolean checkCanAttachTo(final Card source, final Card target) {
final SpellAbility attachEff = source.getFirstAttachSpell();
if (attachEff == null) {
return false;
}
final Game game = source.getGame();
final TargetRestrictions tgt = attachEff.getTargetRestrictions();
CardCollectionView list = game.getCardsIn(tgt.getZone());
list = CardLists.getValidCards(list, tgt.getValidTgts(), attachEff.getActivatingPlayer(), source, attachEff);
return list.contains(target);
}
}