- Added a Legendary Rule check.

This commit is contained in:
Agetian
2018-11-19 06:36:02 +03:00
parent 5f079b3d49
commit c7f6d8b37a

View File

@@ -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,8 +57,13 @@ public class AttachAi extends SpellAbilityAi {
}
}
if (source.getType().isLegendary() && ai.isCardInPlay(source.getName())) {
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;
}