forked from External/mage
fix additional test failures
This commit is contained in:
parent
7db2808d7a
commit
4c90e7f290
5 changed files with 45 additions and 40 deletions
|
|
@ -1363,32 +1363,6 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cantBeAttachedBy(MageObject attachment, Ability source, Game game, boolean silentMode) {
|
||||
for (ProtectionAbility ability : this.getAbilities(game).getProtectionAbilities()) {
|
||||
if ((!attachment.hasSubtype(SubType.AURA, game) || ability.removesAuras())
|
||||
&& (!attachment.hasSubtype(SubType.EQUIPMENT, game) || ability.removesEquipment())
|
||||
&& !attachment.getId().equals(ability.getAuraIdNotToBeRemoved())
|
||||
&& !ability.canTarget(attachment, game)) {
|
||||
return !ability.getDoesntRemoveControlled() || isControlledBy(game.getControllerId(attachment.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
boolean canAttach = true;
|
||||
Permanent attachmentPermanent = game.getPermanent(attachment.getId());
|
||||
// If attachment is an aura, ensures this permanent can still be legally enchanted, according to the enchantment's Enchant ability
|
||||
if (attachment.hasSubtype(SubType.AURA, game)
|
||||
&& attachmentPermanent != null
|
||||
&& attachmentPermanent.getSpellAbility() != null
|
||||
&& !attachmentPermanent.getSpellAbility().getTargets().isEmpty()) {
|
||||
// Line of code below functionally gets the target of the aura's Enchant ability, then compares to this permanent. Enchant improperly implemented in XMage, see #9583
|
||||
// Note: stillLegalTarget used exclusively to account for Dream Leash. Can be made canTarget in the event that that card is rewritten (and "stillLegalTarget" removed from TargetImpl).
|
||||
canAttach = attachmentPermanent.getSpellAbility().getTargets().get(0).copy().withNotTarget(true).stillLegalTarget(attachmentPermanent.getControllerId(), this.getId(), source, game);
|
||||
}
|
||||
|
||||
return !canAttach || game.getContinuousEffects().preventedByRuleModification(new StayAttachedEvent(this.getId(), attachment.getId(), source), null, game, silentMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean destroy(Ability source, Game game) {
|
||||
return destroy(source, game, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue