From 69a9f0fe430fc9037d2759e0d65fec2e11554271 Mon Sep 17 00:00:00 2001 From: swordshine Date: Wed, 25 Dec 2013 08:14:19 +0000 Subject: [PATCH] - Added Plunge into Darkness --- .gitattributes | 1 + .../cardsfolder/p/plunge_into_darkness.txt | 19 +++++++++++++++++++ .../src/main/java/forge/ai/AiController.java | 13 +++++++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 forge-gui/res/cardsfolder/p/plunge_into_darkness.txt diff --git a/.gitattributes b/.gitattributes index a0215baea03..16a6b4df387 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8618,6 +8618,7 @@ forge-gui/res/cardsfolder/p/plumes_of_peace.txt svneol=native#text/plain forge-gui/res/cardsfolder/p/plumeveil.txt svneol=native#text/plain forge-gui/res/cardsfolder/p/plummet.txt svneol=native#text/plain forge-gui/res/cardsfolder/p/plunder.txt svneol=native#text/plain +forge-gui/res/cardsfolder/p/plunge_into_darkness.txt -text forge-gui/res/cardsfolder/p/poison_arrow.txt svneol=native#text/plain forge-gui/res/cardsfolder/p/poison_the_well.txt svneol=native#text/plain forge-gui/res/cardsfolder/p/poisonbelly_ogre.txt svneol=native#text/plain diff --git a/forge-gui/res/cardsfolder/p/plunge_into_darkness.txt b/forge-gui/res/cardsfolder/p/plunge_into_darkness.txt new file mode 100644 index 00000000000..e464586adc3 --- /dev/null +++ b/forge-gui/res/cardsfolder/p/plunge_into_darkness.txt @@ -0,0 +1,19 @@ +Name:Plunge into Darkness +ManaCost:1 B +Types:Instant +K:Entwine B +A:SP$ Charm | Cost$ 1 B | Choices$ DBSac,DBChooseNumber | CharmNum$ 1 | SpellDescription$ Choose one - Sacrifice any number of creatures, then you gain 3 life for each sacrificed creature; or pay X life, then look at the top X cards of your library, put one of those cards into your hand, and exile the rest. +SVar:DBSac:DB$ Sacrifice | Defined$ You | Amount$ SacX | References$ SacX | SacValid$ Creature | RememberSacrificed$ True | Optional$ True | SubAbility$ DBGainLife | SpellDescription$ Sacrifice any number of creatures, then you gain 3 life for each sacrificed creature. +SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ GainLifeX | References$ GainLifeX | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:SacX:Count$Valid Creature.YouCtrl +SVar:GainLifeX:Count$RememberedSize/Thrice +SVar:DBChooseNumber:DB$ ChooseNumber | Defined$ You | ListTitle$ Pay X life? | Max$ LifeAmountX | AILogic$ DigACard | References$ LifeAmountX | SubAbility$ DBLoseLife | SpellDescription$ Pay X life, then look at the top X cards of your library, put one of those cards into your hand, and exile the rest. +SVar:DBLoseLife:DB$ LoseLife | LifeAmount$ Y | References$ Y | SubAbility$ DBDig +SVar:DBDig:DB$ Dig | DigNum$ AFLifeLost | DestinationZone2$ Exile +SVar:Y:Count$ChosenNumber +SVar:LifeAmountX:Count$YourLifeTotal +SVar:AFLifeLost:Number$0 +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/plunge_into_darkness.jpg +Oracle:Choose one - Sacrifice any number of creatures, then you gain 3 life for each sacrificed creature; or pay X life, then look at the top X cards of your library, put one of those cards into your hand, and exile the rest.\nEntwine {B} (Choose both if you pay the entwine cost.) diff --git a/forge-gui/src/main/java/forge/ai/AiController.java b/forge-gui/src/main/java/forge/ai/AiController.java index 5e3ee637b0b..1125c5beb32 100644 --- a/forge-gui/src/main/java/forge/ai/AiController.java +++ b/forge-gui/src/main/java/forge/ai/AiController.java @@ -916,14 +916,23 @@ public class AiController { public int chooseNumber(SpellAbility sa, String title, int min, int max) { //TODO: AILogic - if ("GainLife".equals(sa.getParam("AILogic"))) { + final String logic = sa.getParam("AILogic"); + if ("GainLife".equals(logic)) { if (player.getLife() < 5 || player.getCardsIn(ZoneType.Hand).size() >= player.getMaxHandSize()) { return min; } } - if ("Min".equals(sa.getParam("AILogic"))) { + else if ("Min".equals(logic)) { return min; } + else if ("DigACard".equals(logic)) { + int random = MyRandom.getRandom().nextInt(Math.min(4, max)) + 1; + if (player.getLife() < random + 5) { + return min; + } else { + return random; + } + } return max; }