mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Improved blocking AI for blockers that don't survive until the next turn anyway (due to Vanishing or Fading).
This commit is contained in:
@@ -234,7 +234,11 @@ public class AiBlockController {
|
|||||||
// 3.Blockers that can destroy the attacker and have an upside when dying
|
// 3.Blockers that can destroy the attacker and have an upside when dying
|
||||||
killingBlockers = getKillingBlockers(combat, attacker, blockers);
|
killingBlockers = getKillingBlockers(combat, attacker, blockers);
|
||||||
for (Card b : killingBlockers) {
|
for (Card b : killingBlockers) {
|
||||||
if ((b.hasKeyword("Undying") && b.getCounters(CounterType.P1P1) == 0) || b.hasSVar("SacMe")) {
|
if ((b.hasKeyword("Undying") && b.getCounters(CounterType.P1P1) == 0)
|
||||||
|
|| b.hasSVar("SacMe")
|
||||||
|
|| (b.hasStartOfKeyword("Vanishing") && b.getCounters(CounterType.TIME) == 1)
|
||||||
|
|| (b.hasStartOfKeyword("Fading") && b.getCounters(CounterType.FADE) == 0)
|
||||||
|
|| b.hasSVar("EndOfTurnLeavePlay")) {
|
||||||
blocker = b;
|
blocker = b;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -286,6 +290,32 @@ public class AiBlockController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
attackersLeft = (new ArrayList<Card>(currentAttackers));
|
attackersLeft = (new ArrayList<Card>(currentAttackers));
|
||||||
|
|
||||||
|
// 6. Blockers that don't survive until the next turn anyway
|
||||||
|
for (final Card attacker : attackersLeft) {
|
||||||
|
if (attacker.hasStartOfKeyword("CantBeBlockedByAmount LT")
|
||||||
|
|| attacker.hasKeyword("CARDNAME can't be blocked unless all creatures defending player controls block it.")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Card blocker = null;
|
||||||
|
|
||||||
|
final List<Card> blockers = getPossibleBlockers(combat, attacker, blockersLeft, true);
|
||||||
|
|
||||||
|
for (Card b : blockers) {
|
||||||
|
if ((b.hasStartOfKeyword("Vanishing") && b.getCounters(CounterType.TIME) == 1)
|
||||||
|
|| (b.hasStartOfKeyword("Fading") && b.getCounters(CounterType.FADE) == 0)
|
||||||
|
|| b.hasSVar("EndOfTurnLeavePlay")) {
|
||||||
|
blocker = b;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (blocker != null) {
|
||||||
|
currentAttackers.remove(attacker);
|
||||||
|
combat.addBlocker(attacker, blocker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
attackersLeft = (new ArrayList<Card>(currentAttackers));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Good Gang Blocks means a good trade or no trade
|
// Good Gang Blocks means a good trade or no trade
|
||||||
|
|||||||
Reference in New Issue
Block a user