mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Merge branch 'fix' into 'master'
Fix bad refactor See merge request core-developers/forge!6442
This commit is contained in:
@@ -660,6 +660,7 @@ public class AiAttackController {
|
|||||||
int trampleDamage = 0;
|
int trampleDamage = 0;
|
||||||
CardCollection remainingBlockers = new CardCollection(blockers);
|
CardCollection remainingBlockers = new CardCollection(blockers);
|
||||||
for (Card attacker : CardLists.getKeyword(blockedAttackers, Keyword.TRAMPLE)) {
|
for (Card attacker : CardLists.getKeyword(blockedAttackers, Keyword.TRAMPLE)) {
|
||||||
|
// TODO might sort by quotient of dmg/cost for best combination
|
||||||
Cost tax = CombatUtil.getAttackCost(attacker.getGame(), attacker, defendingOpponent);
|
Cost tax = CombatUtil.getAttackCost(attacker.getGame(), attacker, defendingOpponent);
|
||||||
int taxCMC = tax != null ? tax.getCostMana().getMana().getCMC() : 0;
|
int taxCMC = tax != null ? tax.getCostMana().getMana().getCMC() : 0;
|
||||||
if (myFreeMana < currentAttackTax + taxCMC) {
|
if (myFreeMana < currentAttackTax + taxCMC) {
|
||||||
|
|||||||
@@ -946,9 +946,8 @@ public class AiBlockController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void clearBlockers(final Combat combat, final List<Card> possibleBlockers) {
|
private void clearBlockers(final Combat combat, final List<Card> possibleBlockers) {
|
||||||
final List<Card> oldBlockers = combat.getAllBlockers();
|
for (final Card blocker : CardLists.filterControlledBy(combat.getAllBlockers(), ai)) {
|
||||||
for (final Card blocker : oldBlockers) {
|
// don't touch other player's blockers
|
||||||
if (blocker.getController() == ai) // don't touch other player's blockers
|
|
||||||
combat.removeFromCombat(blocker);
|
combat.removeFromCombat(blocker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1346,12 +1345,11 @@ public class AiBlockController {
|
|||||||
private boolean removeUnpayableBlocks(final Combat combat) {
|
private boolean removeUnpayableBlocks(final Combat combat) {
|
||||||
int myFreeMana = ComputerUtilMana.getAvailableManaEstimate(ai);
|
int myFreeMana = ComputerUtilMana.getAvailableManaEstimate(ai);
|
||||||
int currentBlockTax = 0;
|
int currentBlockTax = 0;
|
||||||
final List<Card> oldBlockers = combat.getAllBlockers();
|
List<Card> oldBlockers = CardLists.filterControlledBy(combat.getAllBlockers(), ai);
|
||||||
CardLists.sortByPowerDesc(oldBlockers);
|
CardLists.sortByPowerDesc(oldBlockers);
|
||||||
boolean modified = false;
|
boolean modified = false;
|
||||||
|
|
||||||
for (final Card blocker : oldBlockers) {
|
for (final Card blocker : oldBlockers) {
|
||||||
if (blocker.getController() == ai) {
|
|
||||||
Cost tax = CombatUtil.getBlockCost(blocker.getGame(), blocker, combat.getAttackersBlockedBy(blocker).get(0));
|
Cost tax = CombatUtil.getBlockCost(blocker.getGame(), blocker, combat.getAttackersBlockedBy(blocker).get(0));
|
||||||
int taxCMC = tax != null ? tax.getCostMana().getMana().getCMC() : 0;
|
int taxCMC = tax != null ? tax.getCostMana().getMana().getCMC() : 0;
|
||||||
if (myFreeMana < currentBlockTax + taxCMC) {
|
if (myFreeMana < currentBlockTax + taxCMC) {
|
||||||
@@ -1361,7 +1359,6 @@ public class AiBlockController {
|
|||||||
}
|
}
|
||||||
currentBlockTax += taxCMC;
|
currentBlockTax += taxCMC;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1324,7 +1324,7 @@ public class AiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message) {
|
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message) {
|
||||||
if (mode.equals(PlayerActionConfirmMode.AlternativeDamageAssignment)) {
|
if (mode == PlayerActionConfirmMode.AlternativeDamageAssignment) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -853,11 +853,13 @@ public class Combat {
|
|||||||
Map<Card, Integer> map = assigningPlayer.getController().assignCombatDamage(attacker, orderedBlockers, attackers,
|
Map<Card, Integer> map = assigningPlayer.getController().assignCombatDamage(attacker, orderedBlockers, attackers,
|
||||||
damageDealt, defender, divideCombatDamageAsChoose || getAttackingPlayer() != assigningPlayer);
|
damageDealt, defender, divideCombatDamageAsChoose || getAttackingPlayer() != assigningPlayer);
|
||||||
|
|
||||||
|
attackers.remove(attacker);
|
||||||
// player wants to assign another first
|
// player wants to assign another first
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
|
// add to end
|
||||||
|
attackers.add(attacker);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
attackers.remove(attacker);
|
|
||||||
|
|
||||||
for (Entry<Card, Integer> dt : map.entrySet()) {
|
for (Entry<Card, Integer> dt : map.entrySet()) {
|
||||||
if (dt.getKey() == null) {
|
if (dt.getKey() == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user