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

View File

@@ -2,12 +2,12 @@ Name:Extraplanar Lens
ManaCost:3
Types:Artifact
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ TrigExile | OptionalDecider$ You | TriggerDescription$ Imprint — When CARDNAME enters the battlefield, you may exile target land you control.
SVar:TrigExile:DB$ ChangeZone | Imprint$ True | Origin$ Battlefield | Destination$ Exile | ValidTgts$ Land.YouCtrl | TgtPrompt$ Select a target land you control | AILogic$ Always
SVar:TrigExile:DB$ ChangeZone | Imprint$ True | Origin$ Battlefield | Destination$ Exile | ValidTgts$ Land.YouCtrl | TgtPrompt$ Select a target land you control | AILogic$ ExtraplanarLens
T:Mode$ TapsForMana | ValidCard$ Land.sharesNameWith Imprinted | Execute$ TrigMana | TriggerZones$ Battlefield | Static$ True | TriggerDescription$ Whenever a land with the same name as the exiled card is tapped for mana, its controller adds one mana to his or her mana pool of any type that land produced.
SVar:TrigMana:DB$ ManaReflected | Valid$ Defined.Triggered | ColorOrType$ Type | ReflectProperty$ Produced | Defined$ TriggeredPlayer
T:Mode$ ChangesZone | Origin$ Battlefield | ValidCard$ Card.Self | Destination$ Any | Execute$ DBCleanup | Static$ True
SVar:DBCleanup:DB$ Cleanup | ClearImprinted$ True
SVar:NeedsToPlay:Land.YouCtrl+canProduceMana
SVar:NeedsToPlay:Land.Basic+YouCtrl+canProduceMana
SVar:RemRandomDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/extraplanar_lens.jpg
Oracle:Imprint — When Extraplanar Lens enters the battlefield, you may exile target land you control.\nWhenever a land with the same name as the exiled card is tapped for mana, its controller adds one mana to his or her mana pool of any type that land produced.