mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- Sanity check not to kill own stuff preemptively if certain valid targeting options exist after a standard check (e.g. Searing Blaze)
This commit is contained in:
@@ -749,8 +749,22 @@ public class DamageDealAi extends DamageAiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fell through all the choices, no targets left?
|
// fell through all the choices, no targets left?
|
||||||
if (tcs.size() < tgt.getMinTargets(source, sa) || tcs.size() == 0) {
|
int minTgts = tgt.getMinTargets(source, sa);
|
||||||
|
if (tcs.size() < minTgts || tcs.size() == 0) {
|
||||||
if (mandatory) {
|
if (mandatory) {
|
||||||
|
// Sanity check: if there are any legal non-owned targets after the check (which may happen for complex cards like Searing Blaze),
|
||||||
|
// choose a random opponent's target before forcing targeting of own stuff
|
||||||
|
List<GameEntity> allTgtEntities = sa.getTargetRestrictions().getAllCandidates(sa, true);
|
||||||
|
for (GameEntity ent : allTgtEntities) {
|
||||||
|
if ((ent instanceof Player && ((Player)ent).isOpponentOf(ai))
|
||||||
|
|| (ent instanceof Card && ((Card)ent).getController().isOpponentOf(ai))) {
|
||||||
|
tcs.add(ent);
|
||||||
|
}
|
||||||
|
if (tcs.size() == minTgts) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the trigger is mandatory, gotta choose my own stuff now
|
// If the trigger is mandatory, gotta choose my own stuff now
|
||||||
return damageChooseRequiredTargets(ai, sa, tgt, dmg);
|
return damageChooseRequiredTargets(ai, sa, tgt, dmg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user