- The AI will move equipment off of creatures that are no longer controlled by the AI.

This commit is contained in:
Agetian
2014-09-10 03:49:31 +00:00
parent add4f12e8b
commit 7455437fc8

View File

@@ -1032,7 +1032,7 @@ public class AttachAi extends SpellAbilityAi {
} else if (aic.getProperty(AiProps.MOVE_EQUIPMENT_TO_BETTER_CREATURES).equals("from_useless_only")) { } else if (aic.getProperty(AiProps.MOVE_EQUIPMENT_TO_BETTER_CREATURES).equals("from_useless_only")) {
// Do not equip other creatures if the AI profile only allows moving equipment from useless creatures // Do not equip other creatures if the AI profile only allows moving equipment from useless creatures
// and the equipped creature is still useful (not non-untapping+tapped and not set to can't attack/block) // and the equipped creature is still useful (not non-untapping+tapped and not set to can't attack/block)
if (!isUselessCreature(attachSource.getEquippingCard())) { if (!isUselessCreature(aiPlayer, attachSource.getEquippingCard())) {
return null; return null;
} }
} }
@@ -1115,7 +1115,7 @@ public class AttachAi extends SpellAbilityAi {
} }
// Consider exceptional cases which break the normal evaluation rules // Consider exceptional cases which break the normal evaluation rules
if (!isUsefulAttachAction(c, sa)) { if (!isUsefulAttachAction(ai, c, sa)) {
return null; return null;
} }
@@ -1308,7 +1308,7 @@ public class AttachAi extends SpellAbilityAi {
* @param sa SpellAbility * @param sa SpellAbility
* @return true, if the action is useful (beneficial) in the current minimal context (Card vs. Attach SpellAbility) * @return true, if the action is useful (beneficial) in the current minimal context (Card vs. Attach SpellAbility)
*/ */
private static boolean isUsefulAttachAction(Card c, SpellAbility sa) { private static boolean isUsefulAttachAction(Player ai, Card c, SpellAbility sa) {
if (c == null) { if (c == null) {
return false; return false;
} }
@@ -1321,7 +1321,7 @@ public class AttachAi extends SpellAbilityAi {
ArrayList<String> cardTypes = sa.getHostCard().getType(); ArrayList<String> cardTypes = sa.getHostCard().getType();
if (cardTypes.contains("Equipment") && isUselessCreature(c)) { if (cardTypes.contains("Equipment") && isUselessCreature(ai, c)) {
// useless to equip a creature that can't attack or block. // useless to equip a creature that can't attack or block.
return false; return false;
} }
@@ -1329,13 +1329,14 @@ public class AttachAi extends SpellAbilityAi {
return true; return true;
} }
private static boolean isUselessCreature(Card c) { private static boolean isUselessCreature(Player ai, Card c) {
if (c == null) { if (c == null) {
return true; return true;
} }
if (c.hasKeyword("CARDNAME can't attack or block.") if (c.hasKeyword("CARDNAME can't attack or block.")
|| (c.hasKeyword("CARDNAME doesn't untap during your untap step.") && c.isTapped())) { || (c.hasKeyword("CARDNAME doesn't untap during your untap step.") && c.isTapped())
|| (c.getOwner() == ai && ai.getOpponents().contains(c.getController()))) {
return true; return true;
} }