mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- Implemented suggested optimizations.
This commit is contained in:
@@ -524,7 +524,7 @@ public class AiAttackController {
|
|||||||
bandingCreatures = CardLists.filter(bandingCreatures, card -> card.hasKeyword(Keyword.BANDING) || card.hasAnyKeyword(bandsWithString));
|
bandingCreatures = CardLists.filter(bandingCreatures, card -> card.hasKeyword(Keyword.BANDING) || card.hasAnyKeyword(bandsWithString));
|
||||||
|
|
||||||
// filter out anything that can't legally attack or is already declared as an attacker
|
// filter out anything that can't legally attack or is already declared as an attacker
|
||||||
bandingCreatures = CardLists.filter(bandingCreatures, card -> CombatUtil.canAttack(card) && !combat.isAttacking(card));
|
bandingCreatures = CardLists.filter(bandingCreatures, card -> !combat.isAttacking(card) && CombatUtil.canAttack(card));
|
||||||
} else {
|
} else {
|
||||||
// Test a specific creature for Banding
|
// Test a specific creature for Banding
|
||||||
if (test.hasKeyword(Keyword.BANDING) || test.hasAnyKeyword(bandsWithString)) {
|
if (test.hasKeyword(Keyword.BANDING) || test.hasAnyKeyword(bandsWithString)) {
|
||||||
@@ -535,6 +535,9 @@ public class AiAttackController {
|
|||||||
// respect global attack constraints
|
// respect global attack constraints
|
||||||
GlobalAttackRestrictions restrict = GlobalAttackRestrictions.getGlobalRestrictions(ai, combat.getDefenders());
|
GlobalAttackRestrictions restrict = GlobalAttackRestrictions.getGlobalRestrictions(ai, combat.getDefenders());
|
||||||
int attackMax = restrict.getMax();
|
int attackMax = restrict.getMax();
|
||||||
|
if (attackMax >= combat.getAttackers().size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!bandingCreatures.isEmpty()) {
|
if (!bandingCreatures.isEmpty()) {
|
||||||
List<String> evasionKeywords = Arrays.asList("Flying", "Horsemanship", "Shadow", "Plainswalk", "Islandwalk",
|
List<String> evasionKeywords = Arrays.asList("Flying", "Horsemanship", "Shadow", "Plainswalk", "Islandwalk",
|
||||||
|
|||||||
Reference in New Issue
Block a user