mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Added basic AI support for Fell the Mighty.
This commit is contained in:
@@ -83,6 +83,24 @@ public class PumpAi extends PumpAiBase {
|
||||
if (sa.getParam("AILogic").equals("Never")) {
|
||||
return false;
|
||||
}
|
||||
if (sa.getParam("AILogic").equals("FellTheMighty")) {
|
||||
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 = ai.getOpponent().getCreaturesInPlay();
|
||||
oppList = CardLists.filterPower(oppList, lowest.getNetPower()+1);
|
||||
if (ComputerUtilCard.evaluateCreatureList(oppList) > 200) {
|
||||
sa.resetTargets();
|
||||
sa.getTargets().add(lowest);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ComputerUtil.preventRunAwayActivations(sa)) {
|
||||
|
||||
@@ -59,6 +59,15 @@ public class CardLists {
|
||||
});
|
||||
}
|
||||
|
||||
public static CardCollection filterPower(final Iterable<Card> in, final int atLeastPower) {
|
||||
return CardLists.filter(in, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(Card c) {
|
||||
return c.getNetPower() >= atLeastPower;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static final Comparator<Card> ToughnessComparator = new Comparator<Card>() {
|
||||
@Override
|
||||
public int compare(final Card a, final Card b) {
|
||||
@@ -99,6 +108,18 @@ public class CardLists {
|
||||
Collections.sort(list, CmcComparatorInv);
|
||||
} // sortCMC
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* sortAttackLowFirst.
|
||||
* </p>
|
||||
*
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void sortByToughnessAsc(final List<Card> list) {
|
||||
Collections.sort(list, ToughnessComparator);
|
||||
} // sortAttackLowFirst()
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* sortAttackLowFirst.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Name:Fell the Mighty
|
||||
ManaCost:4 W
|
||||
Types:Sorcery
|
||||
A:SP$ Pump | Cost$ 4 W | ValidTgts$ Creature | StackDescription$ None | SubAbility$ DBDestroy | SpellDescription$ Destroy all creatures with power greater than target creature's power.
|
||||
A:SP$ Pump | Cost$ 4 W | ValidTgts$ Creature | StackDescription$ None | SubAbility$ DBDestroy | AILogic$ FellTheMighty | SpellDescription$ Destroy all creatures with power greater than target creature's power.
|
||||
SVar:DBDestroy:DB$ DestroyAll | ValidCards$ Creature.powerGTX | References$ X
|
||||
SVar:X:ParentTargeted$CardPower
|
||||
SVar:RemAIDeck:True
|
||||
|
||||
Reference in New Issue
Block a user