Clean up ConniveAi a little bit. (#2371)

* - Update the MTGDecksNet conversion and AI playability test toolchain to the latest version (Python 3 compatible).

* - Make the input/output folders generic

* - Make the input/output folders generic, part 2.

* - Add the Scryfall all-prices.txt generator script.

* - Minor code cleanup.

* - Improve ConniveAi for Change of Plans.

* - Check if the AI can draw cards for ConniveAI

* - Improve the price generation script to account for the Scryfall set code to Forge set code mapping.
- Tweak paths in some of the scripts.

* - Fix scryfallPricesGenerator.

* - Clean up ConniveAi code, limit the X choice to available mana.
This commit is contained in:
Agetian
2023-02-02 15:15:29 +03:00
committed by GitHub
parent 0219656269
commit cd9670d179

View File

@@ -2,6 +2,7 @@ package forge.ai.ability;
import forge.ai.ComputerUtil; import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard; import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilMana;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.card.CardCollection; import forge.game.card.CardCollection;
@@ -23,10 +24,10 @@ public class ConniveAi extends SpellAbilityAi {
// Filter AI-specific targets if provided // Filter AI-specific targets if provided
list = ComputerUtil.filterAITgts(sa, ai, list, false); list = ComputerUtil.filterAITgts(sa, ai, list, false);
int maxTargets = sa.getMaxTargets();
if ("X".equals(sa.getParam("TargetMax")) && "Count$xPaid".equals(sa.getSVar("X"))) { if ("X".equals(sa.getParam("TargetMax")) && "Count$xPaid".equals(sa.getSVar("X"))) {
// TODO: consider making the library margin (currently hardcoded to 5) a configurable AI parameter // TODO: consider making the library margin (currently hardcoded to 5) a configurable AI parameter
maxTargets = Math.min(list.size(), Math.max(0, ai.getCardsIn(ZoneType.Library).size() - 5)); int maxTargets = Math.min(list.size(), Math.max(0, ai.getCardsIn(ZoneType.Library).size() - 5));
maxTargets = Math.min(maxTargets, ComputerUtilMana.getAvailableManaEstimate(ai));
sa.setXManaCostPaid(maxTargets); sa.setXManaCostPaid(maxTargets);
} }