AI aura targeting fix (#6320)

This commit is contained in:
tool4ever
2024-10-14 12:23:18 +02:00
committed by GitHub
parent 90adf4b0cb
commit 8f33da5b9c

View File

@@ -923,6 +923,10 @@ public class AiController {
if (checkCurseEffects(sa)) {
return AiPlayDecision.CurseEffects;
}
// TODO maybe other location for this?
if (!sa.isLegalAfterStack()) {
return AiPlayDecision.AnotherTime;
}
Card spellHost = card;
if (sa.isSpell()) {
spellHost = CardCopyService.getLKICopy(spellHost);
@@ -930,10 +934,6 @@ public class AiController {
spellHost.setLastKnownZone(game.getStackZone()); // need to add to stack to make check Restrictions respect stack cmc
spellHost.setCastFrom(card.getZone());
}
// TODO maybe other location for this?
if (!sa.isLegalAfterStack()) {
return AiPlayDecision.AnotherTime;
}
if (!sa.checkRestrictions(spellHost, player)) {
return AiPlayDecision.AnotherTime;
}
@@ -946,7 +946,7 @@ public class AiController {
}
}
if (sa instanceof Spell) {
if (card.isPermanent()) {
if (sa.getApi() == ApiType.PermanentCreature || sa.getApi() == ApiType.PermanentNoncreature) {
return canPlayFromEffectAI((Spell) sa, false, true);
}
if (!player.cantLoseForZeroOrLessLife() && player.canLoseLife() &&