mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
TokenAi: do not create Token that can't block in Response
This commit is contained in:
@@ -27,6 +27,7 @@ import forge.game.card.CardPredicates;
|
||||
import forge.game.card.CardUtil;
|
||||
import forge.game.card.token.TokenInfo;
|
||||
import forge.game.combat.Combat;
|
||||
import forge.game.combat.CombatUtil;
|
||||
import forge.game.cost.CostPart;
|
||||
import forge.game.cost.CostPutCounter;
|
||||
import forge.game.cost.CostRemoveCounter;
|
||||
@@ -221,7 +222,13 @@ public class TokenAi extends SpellAbilityAi {
|
||||
&& game.getCombat() != null
|
||||
&& !game.getCombat().getAttackers().isEmpty()
|
||||
&& alwaysOnOppAttack) {
|
||||
return true;
|
||||
for (Card attacker : game.getCombat().getAttackers()) {
|
||||
if (CombatUtil.canBlock(attacker, actualToken)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// if the token can't block, then what's the point?
|
||||
return false;
|
||||
}
|
||||
|
||||
return MyRandom.getRandom().nextFloat() <= chance;
|
||||
@@ -364,6 +371,9 @@ public class TokenAi extends SpellAbilityAi {
|
||||
throw new RuntimeException("don't find Token for TokenScript: " + sa.getParam("TokenScript"));
|
||||
}
|
||||
|
||||
// set battlefield zone for LKI checks
|
||||
result.setLastKnownZone(ai.getZone(ZoneType.Battlefield));
|
||||
|
||||
// Apply static abilities
|
||||
final Game game = ai.getGame();
|
||||
ComputerUtilCard.applyStaticContPT(game, result, null);
|
||||
|
||||
Reference in New Issue
Block a user