Fix import

This commit is contained in:
TRT
2022-03-01 11:50:41 +01:00
parent 134bdaeb3d
commit af2ace701c
4 changed files with 8 additions and 5 deletions

View File

@@ -449,6 +449,9 @@ public class AiAttackController {
return false;
}
// TODO for multiplayer this should either add some heuristics
// so the other opponents attack power is also measured in
// or refactor it with aiLifeInDanger somehow if performance impact isn't too bad
CardLists.sortByPowerDesc(oppList);
for (Card attacker : oppList) {
if (!ComputerUtilCombat.canAttackNextTurn(attacker)) {
@@ -1037,7 +1040,7 @@ public class AiAttackController {
&& defendingOpponent != null
&& ComputerUtil.countUsefulCreatures(ai) > ComputerUtil.countUsefulCreatures(defendingOpponent)
&& ai.getLife() > defendingOpponent.getLife()
&& !ComputerUtilCombat.lifeInDanger(ai, combat)
&& !ComputerUtilCombat.lifeInDanger(ai, combat) // this isn't really doing anything unless the attacking player in combat isn't the AI (which currently isn't used like that)
&& (ComputerUtilMana.getAvailableManaEstimate(ai) > 0) || tradeIfTappedOut
&& (ComputerUtilMana.getAvailableManaEstimate(defendingOpponent) == 0) || MyRandom.percentTrue(extraChanceIfOppHasMana)
&& (!tradeIfLowerLifePressure || (ai.getLifeLostLastTurn() + ai.getLifeLostThisTurn() <

View File

@@ -701,7 +701,7 @@ public class AiController {
// but should work in most circumstances to ensure safety in whatever the AI is using this for.
if (manaSources.size() >= cost.getConvertedManaCost()) {
for (Card c : manaSources) {
AiCardMemory.rememberCard(player, c, memSet);
memory.rememberCard(c, memSet);
}
return true;
}
@@ -837,7 +837,7 @@ public class AiController {
// When processing a new SA, clear the previously remembered cards that have been marked to avoid re-entry
// which might potentially cause a stack overflow.
AiCardMemory.clearMemorySet(this, AiCardMemory.MemorySet.MARKED_TO_AVOID_REENTRY);
memory.clearMemorySet(AiCardMemory.MemorySet.MARKED_TO_AVOID_REENTRY);
// TODO before suspending some spells try to predict if relevant targets can be expected
if (sa.getApi() != null) {
@@ -1488,7 +1488,7 @@ public class AiController {
predictedCombatNextTurn = null;
// Reset priority mana reservation that's meant to work for one spell only
AiCardMemory.clearMemorySet(player, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_NEXT_SPELL);
memory.clearMemorySet(AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_NEXT_SPELL);
if (useSimulation) {
return singleSpellAbilityList(simPicker.chooseSpellAbilityToPlay(null));

View File

@@ -1,7 +1,6 @@
package forge.ai;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;

View File

@@ -417,6 +417,7 @@ public class ComputerUtilCombat {
return false;
}
// TODO check for replacement effect instead
CardCollectionView otb = ai.getCardsIn(ZoneType.Battlefield);
// Special cases:
// AI can't lose in combat in presence of Worship (with creatures)