mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28: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;
|
||||
CardCollection remainingBlockers = new CardCollection(blockers);
|
||||
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);
|
||||
int taxCMC = tax != null ? tax.getCostMana().getMana().getCMC() : 0;
|
||||
if (myFreeMana < currentAttackTax + taxCMC) {
|
||||
|
||||
@@ -946,10 +946,9 @@ public class AiBlockController {
|
||||
}
|
||||
|
||||
private void clearBlockers(final Combat combat, final List<Card> possibleBlockers) {
|
||||
final List<Card> oldBlockers = combat.getAllBlockers();
|
||||
for (final Card blocker : oldBlockers) {
|
||||
if (blocker.getController() == ai) // don't touch other player's blockers
|
||||
combat.removeFromCombat(blocker);
|
||||
for (final Card blocker : CardLists.filterControlledBy(combat.getAllBlockers(), ai)) {
|
||||
// don't touch other player's blockers
|
||||
combat.removeFromCombat(blocker);
|
||||
}
|
||||
|
||||
attackersLeft = new ArrayList<>(attackers); // keeps track of all currently unblocked attackers
|
||||
@@ -1346,21 +1345,19 @@ public class AiBlockController {
|
||||
private boolean removeUnpayableBlocks(final Combat combat) {
|
||||
int myFreeMana = ComputerUtilMana.getAvailableManaEstimate(ai);
|
||||
int currentBlockTax = 0;
|
||||
final List<Card> oldBlockers = combat.getAllBlockers();
|
||||
List<Card> oldBlockers = CardLists.filterControlledBy(combat.getAllBlockers(), ai);
|
||||
CardLists.sortByPowerDesc(oldBlockers);
|
||||
boolean modified = false;
|
||||
|
||||
for (final Card blocker : oldBlockers) {
|
||||
if (blocker.getController() == ai) {
|
||||
Cost tax = CombatUtil.getBlockCost(blocker.getGame(), blocker, combat.getAttackersBlockedBy(blocker).get(0));
|
||||
int taxCMC = tax != null ? tax.getCostMana().getMana().getCMC() : 0;
|
||||
if (myFreeMana < currentBlockTax + taxCMC) {
|
||||
combat.removeFromCombat(blocker);
|
||||
modified = true;
|
||||
continue;
|
||||
}
|
||||
currentBlockTax += taxCMC;
|
||||
Cost tax = CombatUtil.getBlockCost(blocker.getGame(), blocker, combat.getAttackersBlockedBy(blocker).get(0));
|
||||
int taxCMC = tax != null ? tax.getCostMana().getMana().getCMC() : 0;
|
||||
if (myFreeMana < currentBlockTax + taxCMC) {
|
||||
combat.removeFromCombat(blocker);
|
||||
modified = true;
|
||||
continue;
|
||||
}
|
||||
currentBlockTax += taxCMC;
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
@@ -1324,7 +1324,7 @@ public class AiController {
|
||||
}
|
||||
|
||||
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message) {
|
||||
if (mode.equals(PlayerActionConfirmMode.AlternativeDamageAssignment)) {
|
||||
if (mode == PlayerActionConfirmMode.AlternativeDamageAssignment) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -853,11 +853,13 @@ public class Combat {
|
||||
Map<Card, Integer> map = assigningPlayer.getController().assignCombatDamage(attacker, orderedBlockers, attackers,
|
||||
damageDealt, defender, divideCombatDamageAsChoose || getAttackingPlayer() != assigningPlayer);
|
||||
|
||||
attackers.remove(attacker);
|
||||
// player wants to assign another first
|
||||
if (map == null) {
|
||||
// add to end
|
||||
attackers.add(attacker);
|
||||
continue;
|
||||
}
|
||||
attackers.remove(attacker);
|
||||
|
||||
for (Entry<Card, Integer> dt : map.entrySet()) {
|
||||
if (dt.getKey() == null) {
|
||||
|
||||
Reference in New Issue
Block a user