Some cleanup (#2242)

This commit is contained in:
tool4ever
2023-01-14 16:56:01 +01:00
committed by GitHub
parent 065f8777eb
commit b0bc41f09c
15 changed files with 64 additions and 139 deletions

View File

@@ -179,7 +179,7 @@ public class AiAttackController {
List<Player> opps = Lists.newArrayList(ai.getOpponents());
if (forCombatDmg) {
for (Player p : ai.getOpponents().threadSafeIterable()) {
for (Player p : ai.getOpponents()) {
if (p.isMonarch() && ai.canBecomeMonarch()) {
// just increase the odds for now instead of being fully predictable
// as it could lead to other too complex factors giving this reasoning negative impact

View File

@@ -45,6 +45,7 @@ import forge.game.combat.CombatUtil;
import forge.game.cost.Cost;
import forge.game.cost.CostPayEnergy;
import forge.game.cost.CostRemoveCounter;
import forge.game.cost.CostUntap;
import forge.game.keyword.Keyword;
import forge.game.keyword.KeywordCollection;
import forge.game.keyword.KeywordInterface;
@@ -1417,12 +1418,14 @@ public class ComputerUtilCard {
double nonCombatChance = 0.0f;
double combatChance = 0.0f;
// non-combat Haste: has an activated ability with tap cost
for (SpellAbility ab : c.getSpellAbilities()) {
Cost abCost = ab.getPayCosts();
if (abCost != null && abCost.hasTapCost()
&& (!abCost.hasManaCost() || ComputerUtilMana.canPayManaCost(ab, ai, 0, false))) {
nonCombatChance += 0.5f;
break;
if (c.isAbilitySick()) {
for (SpellAbility ab : c.getSpellAbilities()) {
Cost abCost = ab.getPayCosts();
if (abCost != null && (abCost.hasTapCost() || abCost.hasSpecificCostType(CostUntap.class))
&& (!abCost.hasManaCost() || ComputerUtilMana.canPayManaCost(ab, ai, sa.getPayCosts().getTotalMana().getCMC(), false))) {
nonCombatChance += 0.5f;
break;
}
}
}
// combat Haste: only grant it if the creature will attack
@@ -1917,7 +1920,7 @@ public class ComputerUtilCard {
}
}
if (!canBeBlocked) {
boolean threat = atk.getNetCombatDamage() >= ai.getLife() - lifeInDanger;
boolean threat = ComputerUtilCombat.getAttack(atk) >= ai.getLife() - lifeInDanger;
if (!priorityRemovalOnlyInDanger || threat) {
priorityCards.add(atk);
}

View File

@@ -2054,7 +2054,6 @@ public class ComputerUtilCombat {
if (block.size() == 1) {
final Card blocker = block.getFirst();
// trample
if (hasTrample) {
int dmgToKill = getEnoughDamageToKill(blocker, dmgCanDeal, attacker, true);
@@ -2110,7 +2109,7 @@ public class ComputerUtilCombat {
}
}
return damageMap;
} // setAssignedDamage()
}
// how much damage is enough to kill the creature (for AI)
/**

View File

@@ -206,12 +206,7 @@ public class GameCopier {
Card newCard = map.map(origHostCard);
SpellAbility newSa = null;
if (origSa.isSpell()) {
for (SpellAbility sa : newCard.getAllSpellAbilities()) {
if (sa.getDescription().equals(origSa.getDescription())) {
newSa = sa;
break;
}
}
newSa = findSAInCard(origSa, newCard);
}
if (newSa != null) {
newSa.setActivatingPlayer(map.map(origSa.getActivatingPlayer()), true);