From dcd2fade4a19ffa30b092aa618f5814c2abebca6 Mon Sep 17 00:00:00 2001 From: Agetian Date: Mon, 10 Dec 2018 19:24:53 +0300 Subject: [PATCH] - Fixed Vaevictis Asmadi, the Dire AI targeting logic. --- .../src/main/java/forge/ai/ability/PumpAi.java | 15 +++++++++++++++ .../cardsfolder/v/vaevictis_asmadi_the_dire.txt | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/PumpAi.java b/forge-ai/src/main/java/forge/ai/ability/PumpAi.java index 78d11c5cd30..90f5e2a02a7 100644 --- a/forge-ai/src/main/java/forge/ai/ability/PumpAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/PumpAi.java @@ -481,6 +481,21 @@ public class PumpAi extends PumpAiBase { } else if (sa.getParam("AILogic").equals("DonateTargetPerm")) { // Donate step 2 - target a donatable permanent. return SpecialCardAi.Donate.considerDonatingPermanent(ai, sa); + } else if (sa.getParam("AILogic").equals("SacOneEach")) { + // each player sacrifices one permanent, e.g. Vaevictis, Asmadi the Dire - grab the worst for allied and + // the best for opponents + sa.resetTargets(); + for (Player p : game.getPlayers()) { + CardCollection targetable = CardLists.filter(p.getCardsIn(ZoneType.Battlefield), CardPredicates.isTargetableBy(sa)); + if (!targetable.isEmpty()) { + if (p.isOpponentOf(ai)) { + sa.getTargets().add(ComputerUtilCard.getBestAI(targetable)); + } else { + sa.getTargets().add(ComputerUtilCard.getWorstAI(targetable)); + } + } + } + return true; } if (isFight) { return FightAi.canFightAi(ai, sa, attack, defense); diff --git a/forge-gui/res/cardsfolder/v/vaevictis_asmadi_the_dire.txt b/forge-gui/res/cardsfolder/v/vaevictis_asmadi_the_dire.txt index d7dfe53b72b..b98c46183dd 100644 --- a/forge-gui/res/cardsfolder/v/vaevictis_asmadi_the_dire.txt +++ b/forge-gui/res/cardsfolder/v/vaevictis_asmadi_the_dire.txt @@ -4,7 +4,7 @@ Types:Legendary Creature Elder Dragon PT:6/6 K:Flying T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigTarget | TriggerDescription$ Whenever CARDNAME attacks, for each player, choose target permanent that player controls. Those players sacrifice those permanents. Each player who sacrificed a permanent this way reveals the top card of their library, then puts it onto the battlefield if it's a permanent card. -SVar:TrigTarget:DB$ Pump | ValidTgts$ Permanent | TgtPrompt$ Select target permanent a players controls to be sacrificed. | TargetMin$ OneEach | TargetMax$ OneEach | References$ OneEach | TargetsWithDifferentControllers$ True | SubAbility$ DBSacrificeAll +SVar:TrigTarget:DB$ Pump | ValidTgts$ Permanent | TgtPrompt$ Select target permanent a player controls to be sacrificed. | TargetMin$ OneEach | TargetMax$ OneEach | References$ OneEach | TargetsWithDifferentControllers$ True | SubAbility$ DBSacrificeAll | AILogic$ SacOneEach SVar:DBSacrificeAll:DB$ SacrificeAll | Defined$ Targeted | RememberSacrificed$ True | SubAbility$ DBRepeatEach SVar:DBRepeatEach:DB$ RepeatEach | DefinedCards$ Remembered | UseImprinted$ True | RepeatSubAbility$ DBDig | SubAbility$ DBCleanup SVar:DBDig:DB$ Dig | Defined$ ImprintedController | DigNum$ 1 | Reveal$ True | DestinationZone$ Battlefield | DestinationZone2$ Library | LibraryPosition2$ 0 | ChangeNum$ All | ChangeValid$ Permanent