Added test that ensures all lands can be played

This commit is contained in:
marthinwurer
2023-02-01 23:12:42 -07:00
committed by Chris H
parent 58f0a72c4d
commit 2d98e58b81
4 changed files with 110 additions and 17 deletions

View File

@@ -8,6 +8,7 @@ import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.spellability.AbilityManaPart;
import forge.game.spellability.SpellAbility;
import forge.game.staticability.StaticAbility;
import forge.game.zone.ZoneType;
import java.util.Arrays;
@@ -173,9 +174,9 @@ public class GameStateEvaluator {
colors_produced.addAll(Arrays.asList(mp.mana(m).split(" ")));
}
}
value = 100 * max_produced;
value += 100 * max_produced;
int size = max(colors_produced.size(), colors_produced.contains("Any") ? 5 : 0);
value += size * 2;
value += size * 6;
// add a value for each activated ability that the land has that's not an activated ability.
for (SpellAbility m: c.getNonManaAbilities()) {
@@ -184,6 +185,12 @@ public class GameStateEvaluator {
value += 6;
}
// Add a value for each static ability that the land has
for (StaticAbility s : c.getStaticAbilities()) {
// More than the value of having a card in hand. See comment above
value += 6;
}
return value;
} else if (c.isEnchantingCard()) {

View File

@@ -64,7 +64,7 @@ public class SpellAbilityPicker {
print("---- choose ability (phase = " + phaseStr + ")");
}
private List<SpellAbility> getCandidateSpellsAndAbilities() {
public List<SpellAbility> getCandidateSpellsAndAbilities() {
CardCollection cards = ComputerUtilAbility.getAvailableCards(game, player);
cards = ComputerUtilCard.dedupeCards(cards);
List<SpellAbility> all = ComputerUtilAbility.getSpellAbilities(cards, player);
@@ -351,7 +351,7 @@ public class SpellAbilityPicker {
return AiPlayDecision.WillPlay;
}
private Score evaluateSa(final SimulationController controller, PhaseType phase, List<SpellAbility> saList, int saIndex) {
public Score evaluateSa(final SimulationController controller, PhaseType phase, List<SpellAbility> saList, int saIndex) {
controller.evaluateSpellAbility(saList, saIndex);
SpellAbility sa = saList.get(saIndex);