mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Added the new AI function "hasAFogEffect".
This commit is contained in:
@@ -754,6 +754,9 @@ public class AiBlockController {
|
||||
// == 1. choose best blocks first ==
|
||||
makeGoodBlocks(combat);
|
||||
makeGangBlocks(combat);
|
||||
|
||||
// When the AI holds some Fog effect, don't bother about lifeInDanger
|
||||
if (!ComputerUtil.hasAFogEffect(ai)) {
|
||||
if (ComputerUtilCombat.lifeInDanger(ai, combat)) {
|
||||
makeTradeBlocks(combat); // choose necessary trade blocks
|
||||
}
|
||||
@@ -814,6 +817,7 @@ public class AiBlockController {
|
||||
// to try to kill the attacker
|
||||
reinforceBlockersToKill(combat);
|
||||
}
|
||||
}
|
||||
|
||||
// assign blockers that have to block
|
||||
chumpBlockers = CardLists.getKeyword(blockersLeft, "CARDNAME blocks each turn if able.");
|
||||
|
||||
@@ -999,6 +999,26 @@ public class ComputerUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasAFogEffect(final Player ai) {
|
||||
final CardCollection all = new CardCollection(ai.getCardsIn(ZoneType.Battlefield));
|
||||
|
||||
all.addAll(ai.getCardsActivableInExternalZones(true));
|
||||
all.addAll(ai.getCardsIn(ZoneType.Hand));
|
||||
|
||||
for (final Card c : all) {
|
||||
for (final SpellAbility sa : c.getSpellAbilities()) {
|
||||
if (sa.getApi() != ApiType.Fog) {
|
||||
continue;
|
||||
}
|
||||
if (!ComputerUtilCost.canPayCost(sa, ai)) {
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int possibleNonCombatDamage(Player ai) {
|
||||
int damage = 0;
|
||||
final CardCollection all = new CardCollection(ai.getCardsIn(ZoneType.Battlefield));
|
||||
|
||||
Reference in New Issue
Block a user