Tweak AI to skip useless Enlisting (#2594)

This commit is contained in:
tool4ever
2023-03-01 10:03:47 +01:00
committed by GitHub
parent f7303b0ab2
commit 048543f74e
3 changed files with 10 additions and 5 deletions

View File

@@ -342,11 +342,16 @@ public class PlayerControllerAi extends PlayerController {
@Override
public List<Card> enlistAttackers(List<Card> attackers) {
CardCollection cards = CostEnlist.getCardsForEnlisting(brains.getPlayer());
ComputerUtilCard.sortByEvaluateCreature(new CardCollection(attackers));
cards = CardLists.filter(cards, CardPredicates.hasGreaterPowerThan(0));
CardCollection chosenAttackers = new CardCollection(attackers);
ComputerUtilCard.sortByEvaluateCreature(chosenAttackers);
// do not enlist more than available payment choices (currently ignores multiple instances of Enlist, but can that even happen?)
attackers = attackers.subList(0, cards.size());
if (attackers.size() > cards.size()) {
chosenAttackers = chosenAttackers.subList(0, cards.size());
}
// TODO check if not needed as defender
return attackers;
return chosenAttackers;
}
@Override

View File

@@ -118,7 +118,7 @@
</goals>
<configuration>
<!-- TODO: insert placeholder for latest version tag -->
<fromRef>forge-1.6.53</fromRef>
<fromRef>forge-1.6.56</fromRef>
<file>../forge-gui/release-files/CHANGES.txt</file>
<templateContent>
<![CDATA[

View File

@@ -3,7 +3,7 @@ ManaCost:3 G G W W
Types:Legendary Creature Dinosaur Vampire
PT:12/12
K:Trample
T:Mode$ AttackersDeclared | AttackingPlayer$ You | Execute$ TrigCharm | TriggerDescription$ Whenever you attack, ABILITY
T:Mode$ AttackersDeclared | AttackingPlayer$ You | Execute$ TrigCharm | TriggerZones$ Battlefield | TriggerDescription$ Whenever you attack, ABILITY
SVar:TrigCharm:DB$ Charm | CharmNum$ 1 | Choices$ DBDino,DBVampire
SVar:DBDino:DB$ Token | TokenAmount$ 1 | TokenOwner$ You | TokenScript$ g_x_x_dinosaur_trample | TokenPower$ X | TokenToughness$ X | TokenTapped$ True | TokenAttacking$ True | TokenOwner$ You | SpellDescription$ Create a tapped and attacking X/X green Dinosaur creature token with trample, where X is the greatest power among other attacking creatures.
SVar:DBVampire:DB$ Token | TokenAmount$ Y | TokenScript$ w_1_1_vampire_lifelink | TokenOwner$ You | SpellDescription$ Create X 1/1 white Vampire creature tokens with lifelink, where X is the number of other attacking creatures.