mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- Move AILogic FellTheMighty into SpecialCardAi (card-specific).
This commit is contained in:
@@ -545,6 +545,32 @@ public class SpecialCardAi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fell the Mighty
|
||||||
|
public static class FellTheMighty {
|
||||||
|
public static boolean consider(final Player ai, final SpellAbility sa) {
|
||||||
|
CardCollection aiList = ai.getCreaturesInPlay();
|
||||||
|
if (aiList.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
CardLists.sortByPowerAsc(aiList);
|
||||||
|
Card lowest = aiList.get(0);
|
||||||
|
if (!sa.canTarget(lowest)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CardCollection oppList = CardLists.filter(ai.getGame().getCardsIn(ZoneType.Battlefield),
|
||||||
|
CardPredicates.Presets.CREATURES, CardPredicates.isControlledByAnyOf(ai.getOpponents()));
|
||||||
|
|
||||||
|
oppList = CardLists.filterPower(oppList, lowest.getNetPower() + 1);
|
||||||
|
if (ComputerUtilCard.evaluateCreatureList(oppList) > 200) {
|
||||||
|
sa.resetTargets();
|
||||||
|
sa.getTargets().add(lowest);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Force of Will
|
// Force of Will
|
||||||
public static class ForceOfWill {
|
public static class ForceOfWill {
|
||||||
public static boolean consider(final Player ai, final SpellAbility sa) {
|
public static boolean consider(final Player ai, final SpellAbility sa) {
|
||||||
|
|||||||
@@ -3,12 +3,7 @@ package forge.ai.ability;
|
|||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
|
|
||||||
import forge.ai.AiBlockController;
|
import forge.ai.*;
|
||||||
import forge.ai.ComputerUtil;
|
|
||||||
import forge.ai.ComputerUtilCard;
|
|
||||||
import forge.ai.ComputerUtilCombat;
|
|
||||||
import forge.ai.ComputerUtilCost;
|
|
||||||
import forge.ai.SpellAbilityAi;
|
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.card.CardCollection;
|
import forge.game.card.CardCollection;
|
||||||
@@ -70,27 +65,8 @@ public class DestroyAllAi extends SpellAbilityAi {
|
|||||||
final String aiLogic = sa.getParamOrDefault("AILogic", "");
|
final String aiLogic = sa.getParamOrDefault("AILogic", "");
|
||||||
|
|
||||||
if ("FellTheMighty".equals(aiLogic)) {
|
if ("FellTheMighty".equals(aiLogic)) {
|
||||||
CardCollection aiList = ai.getCreaturesInPlay();
|
return SpecialCardAi.FellTheMighty.consider(ai, sa);
|
||||||
if (aiList.isEmpty()) {
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
CardLists.sortByPowerAsc(aiList);
|
|
||||||
Card lowest = aiList.get(0);
|
|
||||||
if (!sa.canTarget(lowest)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CardCollection oppList = CardLists.filter(ai.getGame().getCardsIn(ZoneType.Battlefield),
|
|
||||||
CardPredicates.Presets.CREATURES, CardPredicates.isControlledByAnyOf(ai.getOpponents()));
|
|
||||||
|
|
||||||
oppList = CardLists.filterPower(oppList, lowest.getNetPower() + 1);
|
|
||||||
if (ComputerUtilCard.evaluateCreatureList(oppList) > 200) {
|
|
||||||
sa.resetTargets();
|
|
||||||
sa.getTargets().add(lowest);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return doMassRemovalLogic(ai, sa);
|
return doMassRemovalLogic(ai, sa);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user