- Tweak spell prediction when deciding whether to move equipment or not.

- Enable spell prediction (works for AttachAi only at the moment).
- The Default AI profile will only move equipment from one creature to another if the one it's currently attached to is useless, but will consider it a priority task to move equipment away from useless creatures.
- The Reckless AI profile will always move equipment from worse creatures to better ones but will prioritize getting as many threats and other permanents out before moving creatures around (currently - even if the creature the equipment is attached to was rendered useless).
This commit is contained in:
Agetian
2014-09-20 08:01:58 +00:00
parent 2abcc7c951
commit 5549604d0d
4 changed files with 13 additions and 6 deletions

View File

@@ -31,6 +31,7 @@ public enum AiProps { /** */
PLANAR_DIE_ROLL_HESITATION_CHANCE ("10"),
CHEAT_WITH_MANA_ON_SHUFFLE ("false"),
MOVE_EQUIPMENT_TO_BETTER_CREATURES ("from_useless_only"),
PRIORITIZE_MOVE_EQUIPMENT_IF_USELESS ("false"),
PREDICT_SPELLS_FOR_MAIN2 ("true"), /** */
RESERVE_MANA_FOR_MAIN2_CHANCE ("0"); /** */

View File

@@ -1026,19 +1026,23 @@ public class AttachAi extends SpellAbilityAi {
return null;
}
boolean uselessCreature = isUselessCreature(aiPlayer, attachSource.getEquippingCard());
if (aic.getProperty(AiProps.MOVE_EQUIPMENT_TO_BETTER_CREATURES).equals("never")) {
// Do not equip other creatures if the AI profile does not allow moving equipment around
return null;
} 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
// and the equipped creature is still useful (not non-untapping+tapped and not set to can't attack/block)
if (!isUselessCreature(aiPlayer, attachSource.getEquippingCard())) {
if (!uselessCreature) {
return null;
}
}
// make sure to prioritize casting spells in main 2 (creatures, other equipment, etc.) rather than moving equipment around
if (aic.getCardMemory().isMemorySetEmpty(AiCardMemory.MemorySet.HELD_MANA_SOURCES)) {
boolean decideMoveFromUseless = uselessCreature && aic.getBooleanProperty(AiProps.PRIORITIZE_MOVE_EQUIPMENT_IF_USELESS);
if (!decideMoveFromUseless && aic.getCardMemory().isMemorySetEmpty(AiCardMemory.MemorySet.HELD_MANA_SOURCES)) {
SpellAbility futureSpell = aic.predictSpellToCastInMain2(ApiType.Attach);
if (futureSpell != null && futureSpell.getHostCard() != null) {
aic.reserveManaSourcesForMain2(futureSpell);