mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Fixed the AI targeting restrictions check in AiController to account for the AILogics that can pre-target cards.
- Added an AI logic for The Scarab God (can be generalized later).
This commit is contained in:
@@ -662,7 +662,8 @@ public class AiController {
|
||||
if (sa instanceof SpellPermanent) {
|
||||
return canPlayFromEffectAI((SpellPermanent)sa, false, true);
|
||||
}
|
||||
if (sa.usesTargeting()) {
|
||||
if (sa.usesTargeting()
|
||||
&& sa.getTargets().getNumTargeted() < sa.getTargetRestrictions().getMinTargets(sa.getHostCard(), sa)) {
|
||||
if (!sa.getTargetRestrictions().hasCandidates(sa, true)) {
|
||||
return AiPlayDecision.TargetingFailed;
|
||||
}
|
||||
|
||||
@@ -1109,6 +1109,23 @@ public class SpecialCardAi {
|
||||
}
|
||||
}
|
||||
|
||||
// The Scarab God
|
||||
public static class TheScarabGod {
|
||||
public static boolean consider(final Player ai, final SpellAbility sa) {
|
||||
Card bestOppCreat = ComputerUtilCard.getBestAI(CardLists.filter(ai.getOpponents().getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES));
|
||||
Card worstOwnCreat = ComputerUtilCard.getWorstAI(CardLists.filter(ai.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES));
|
||||
|
||||
sa.resetTargets();
|
||||
if (bestOppCreat != null) {
|
||||
sa.getTargets().add(bestOppCreat);
|
||||
} else if (worstOwnCreat != null) {
|
||||
sa.getTargets().add(worstOwnCreat);
|
||||
}
|
||||
|
||||
return sa.getTargets().getNumTargeted() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Timetwister
|
||||
public static class Timetwister {
|
||||
public static boolean consider(final Player ai, final SpellAbility sa) {
|
||||
|
||||
@@ -94,6 +94,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
return this.doSameNameLogic(aiPlayer, sa);
|
||||
} else if (aiLogic.equals("ReanimateAll")) {
|
||||
return SpecialCardAi.LivingDeath.consider(aiPlayer, sa);
|
||||
} else if (aiLogic.equals("TheScarabGod")) {
|
||||
return SpecialCardAi.TheScarabGod.consider(aiPlayer, sa);
|
||||
} else if (aiLogic.equals("Intuition")) {
|
||||
// This logic only fills the multiple cards array, the decision to play is made
|
||||
// separately in hiddenOriginCanPlayAI later.
|
||||
|
||||
Reference in New Issue
Block a user