diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index 850465316f..3e9706d336 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -44,6 +44,7 @@ import mage.MageObject; import mage.Mana; import mage.abilities.Ability; import mage.abilities.ActivatedAbility; +import mage.abilities.SpellAbility; import mage.abilities.TriggeredAbilities; import mage.abilities.TriggeredAbility; import mage.abilities.costs.mana.ColoredManaCost; @@ -225,7 +226,8 @@ public class ComputerPlayer> extends PlayerImpl i return true; } } - return false; + if (!target.isRequired()) + return false; } if (target instanceof TargetDiscard) { findPlayables(game); @@ -243,7 +245,8 @@ public class ComputerPlayer> extends PlayerImpl i return true; } } - return false; + if (!target.isRequired()) + return false; } if (target instanceof TargetControlledPermanent) { List targets; @@ -271,7 +274,8 @@ public class ComputerPlayer> extends PlayerImpl i return true; } } - return false; + if (!target.isRequired()) + return false; } if (target instanceof TargetCreatureOrPlayer) { List targets; @@ -300,7 +304,8 @@ public class ComputerPlayer> extends PlayerImpl i return true; } } - return false; + if (!target.isRequired()) + return false; } throw new IllegalStateException("Target wasn't handled. class:" + target.getClass().toString()); } @@ -484,10 +489,13 @@ public class ComputerPlayer> extends PlayerImpl i for (Mana mana: options) { for (Mana avail: available) { if (mana.enough(avail)) { - if (card.getCardType().contains(CardType.INSTANT)) - playableInstant.add(card); - else - playableNonInstant.add(card); + SpellAbility ability = card.getSpellAbility(); + if (ability != null && ability.canActivate(playerId, game)) { + if (card.getCardType().contains(CardType.INSTANT)) + playableInstant.add(card); + else + playableNonInstant.add(card); + } } else { if (!playableInstant.contains(card) && !playableNonInstant.contains(card)) diff --git a/Mage.Server/plugins/mage-player-ai.jar b/Mage.Server/plugins/mage-player-ai.jar index 45016d5014..1e7af9d1ad 100644 Binary files a/Mage.Server/plugins/mage-player-ai.jar and b/Mage.Server/plugins/mage-player-ai.jar differ