diff --git a/forge-ai/src/main/java/forge/ai/ability/AttachAi.java b/forge-ai/src/main/java/forge/ai/ability/AttachAi.java index 0ffb370de21..3ff51f33d7d 100644 --- a/forge-ai/src/main/java/forge/ai/ability/AttachAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/AttachAi.java @@ -4,6 +4,7 @@ import com.google.common.base.Predicate; import com.google.common.base.Predicates; import forge.ai.*; import forge.game.GameObject; +import forge.game.GlobalRuleChange; import forge.game.ability.AbilityFactory; import forge.game.ability.AbilityUtils; import forge.game.ability.ApiType; @@ -56,6 +57,16 @@ public class AttachAi extends SpellAbilityAi { } } + if (!ai.getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLegendRule) + && source.getType().isLegendary() + && ai.isCardInPlay(source.getName())) { + // Don't play the second copy of a legendary enchantment already in play + + // TODO: Add some extra checks for where the AI may want to cast a replacement aura + // on another creature and keep it when the original enchanted creature is useless + return false; + } + if (ai.getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS) && !"Curse".equals(sa.getParam("AILogic"))) { return false;