mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- A bit more Extraplanar Lens logic.
This commit is contained in:
@@ -427,6 +427,46 @@ public class SpecialCardAi {
|
||||
}
|
||||
}
|
||||
|
||||
// Extraplanar Lens
|
||||
public static class ExtraplanarLens {
|
||||
public static boolean consider(final Player ai, final SpellAbility sa) {
|
||||
Card bestBasic = null;
|
||||
Card bestBasicSelfOnly = null;
|
||||
|
||||
CardCollection aiLands = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.LANDS_PRODUCING_MANA);
|
||||
CardCollection oppLands = CardLists.filter(ai.getOpponents().getCardsIn(ZoneType.Battlefield),
|
||||
CardPredicates.Presets.LANDS_PRODUCING_MANA);
|
||||
|
||||
int bestCount = 0;
|
||||
int bestSelfOnlyCount = 0;
|
||||
for (String landType : MagicColor.Constant.BASIC_LANDS) {
|
||||
CardCollection landsOfType = CardLists.filter(aiLands, CardPredicates.nameEquals(landType));
|
||||
CardCollection oppLandsOfType = CardLists.filter(oppLands, CardPredicates.nameEquals(landType));
|
||||
|
||||
int numCtrl = CardLists.filter(aiLands, CardPredicates.nameEquals(landType)).size();
|
||||
if (numCtrl > bestCount) {
|
||||
bestCount = numCtrl;
|
||||
bestBasic = ComputerUtilCard.getWorstLand(landsOfType);
|
||||
}
|
||||
if (numCtrl > bestSelfOnlyCount && numCtrl > 1 && oppLandsOfType.isEmpty() && bestBasicSelfOnly == null) {
|
||||
bestSelfOnlyCount = numCtrl;
|
||||
bestBasicSelfOnly = ComputerUtilCard.getWorstLand(landsOfType);
|
||||
}
|
||||
}
|
||||
|
||||
sa.resetTargets();
|
||||
if (bestBasicSelfOnly != null) {
|
||||
sa.getTargets().add(bestBasicSelfOnly);
|
||||
return true;
|
||||
} else if (bestBasic != null) {
|
||||
sa.getTargets().add(bestBasic);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Force of Will
|
||||
public static class ForceOfWill {
|
||||
public static boolean consider(final Player ai, final SpellAbility sa) {
|
||||
|
||||
@@ -1373,6 +1373,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
private static boolean knownOriginTriggerAI(final Player ai, final SpellAbility sa, final boolean mandatory) {
|
||||
if ("DeathgorgeScavenger".equals(sa.getParam("AILogic"))) {
|
||||
return SpecialCardAi.DeathgorgeScavenger.consider(ai, sa);
|
||||
} else if ("ExtraplanarLens".equals(sa.getParam("AILogic"))) {
|
||||
return SpecialCardAi.ExtraplanarLens.consider(ai, sa);
|
||||
}
|
||||
|
||||
if (sa.getTargetRestrictions() == null) {
|
||||
|
||||
Reference in New Issue
Block a user