reworked auras which grant protection but don't remove themselves

This commit is contained in:
Evan Kranzler 2022-02-24 20:14:43 -05:00
parent 4024acdb28
commit eb4366013b
10 changed files with 125 additions and 231 deletions

View file

@ -1204,14 +1204,11 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@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())) {
if (!attachment.getId().equals(ability.getAuraIdNotToBeRemoved())
&& !ability.canTarget(attachment, game)) {
return !ability.getDoesntRemoveControlled() || isControlledBy(game.getControllerId(attachment.getId()));
}
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()));
}
}
return game.getContinuousEffects().preventedByRuleModification(new StayAttachedEvent(this.getId(), attachment.getId(), source), null, game, silentMode);