- A bit more Extraplanar Lens logic.

This commit is contained in:
Agetian
2017-10-09 09:35:35 +00:00
parent 27c508caa0
commit f16251d046
3 changed files with 44 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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) {