From fc5bec6b9c1c58ba9f8033f6104f4b9d16cd3ac0 Mon Sep 17 00:00:00 2001 From: Sloth Date: Mon, 20 Oct 2014 14:19:48 +0000 Subject: [PATCH] - Updated AI of some more cards with ChooseColor effects. --- .../src/main/java/forge/ai/ability/ChooseColorAi.java | 9 +++++++++ forge-gui/res/cardsfolder/a/aven_warcraft.txt | 1 + forge-gui/res/cardsfolder/c/chromatic_armor.txt | 2 +- forge-gui/res/cardsfolder/c/coldsteel_heart.txt | 3 +-- forge-gui/res/cardsfolder/c/curse_of_wizardry.txt | 1 + forge-gui/res/cardsfolder/h/hall_of_gemstone.txt | 1 + forge-gui/res/cardsfolder/h/harsh_judgment.txt | 3 +-- 7 files changed, 15 insertions(+), 5 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/ChooseColorAi.java b/forge-ai/src/main/java/forge/ai/ability/ChooseColorAi.java index e8236cfe6bb..e4b5144491d 100644 --- a/forge-ai/src/main/java/forge/ai/ability/ChooseColorAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/ChooseColorAi.java @@ -9,6 +9,7 @@ import forge.game.phase.PhaseHandler; import forge.game.phase.PhaseType; import forge.game.player.Player; import forge.game.spellability.SpellAbility; +import forge.game.zone.ZoneType; import forge.util.MyRandom; public class ChooseColorAi extends SpellAbilityAi { @@ -36,6 +37,14 @@ public class ChooseColorAi extends SpellAbilityAi { source.setSVar("PayX", Integer.toString(x)); return true; } + + if ("Addle".equals(sa.getHostCard().getName())) { + PhaseHandler ph = game.getPhaseHandler(); + if (ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS) || ai.getOpponent().getCardsIn(ZoneType.Hand).isEmpty()) { + return false; + } + return true; + } boolean chance = MyRandom.getRandom().nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn()); return chance; } diff --git a/forge-gui/res/cardsfolder/a/aven_warcraft.txt b/forge-gui/res/cardsfolder/a/aven_warcraft.txt index 3077b1dfbdc..3ff3071cf80 100644 --- a/forge-gui/res/cardsfolder/a/aven_warcraft.txt +++ b/forge-gui/res/cardsfolder/a/aven_warcraft.txt @@ -3,5 +3,6 @@ ManaCost:2 W Types:Instant A:SP$ PumpAll | Cost$ 2 W | ValidCards$ Creature.YouCtrl | NumDef$ +2 | SubAbility$ ChooseColor | SpellDescription$ Creatures you control get +0/+2 until end of turn. Threshold - If seven or more cards are in your graveyard, choose a color. Creatures you control also gain protection from the chosen color until end of turn. SVar:ChooseColor:DB$ ProtectionAll | Condition$ Threshold | ValidCards$ Creature.YouCtrl | Gains$ Choice | Choices$ AnyColor +SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/aven_warcraft.jpg Oracle:Creatures you control get +0/+2 until end of turn.\nThreshold - If seven or more cards are in your graveyard, choose a color. Creatures you control also gain protection from the chosen color until end of turn. diff --git a/forge-gui/res/cardsfolder/c/chromatic_armor.txt b/forge-gui/res/cardsfolder/c/chromatic_armor.txt index 2bb4021a006..5b005ccc9b5 100644 --- a/forge-gui/res/cardsfolder/c/chromatic_armor.txt +++ b/forge-gui/res/cardsfolder/c/chromatic_armor.txt @@ -4,7 +4,7 @@ Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ 1 W U | ValidTgts$ Creature | AILogic$ Pump K:ETBReplacement:Other:ChooseColor -SVar:ChooseColor:DB$ ChooseColor | Defined$ You | SpellDescription$ As CARDNAME enters the battlefield, choose a color. +SVar:ChooseColor:DB$ ChooseColor | Defined$ You | AILogic$ MostProminentInHumanDeck | SpellDescription$ As CARDNAME enters the battlefield, choose a color. K:etbCounter:SLEIGHT:1 S:Mode$ PreventDamage | Target$ Creature.EnchantedBy | Source$ Card.ChosenColor | Description$ Prevent all damage that would be dealt to enchanted creature by sources of the last chosen color. A:AB$ PutCounter | Cost$ X | Defined$ Self | CounterType$ SLEIGHT | CounterNum$ 1 | SubAbility$ ChooseColor | References$ X | SpellDescription$ Put a sleight counter on CARDNAME and choose a color. X is the number of sleight counters on CARDNAME. diff --git a/forge-gui/res/cardsfolder/c/coldsteel_heart.txt b/forge-gui/res/cardsfolder/c/coldsteel_heart.txt index cfc7200e02b..75a17b271ef 100644 --- a/forge-gui/res/cardsfolder/c/coldsteel_heart.txt +++ b/forge-gui/res/cardsfolder/c/coldsteel_heart.txt @@ -3,8 +3,7 @@ ManaCost:2 Types:Snow Artifact K:CARDNAME enters the battlefield tapped. K:ETBReplacement:Other:ChooseColor -SVar:ChooseColor:DB$ ChooseColor | Defined$ You | SpellDescription$ As CARDNAME enters the battlefield, choose a color. +SVar:ChooseColor:DB$ ChooseColor | Defined$ You | AILogic$ MostProminentInComputerDeck | SpellDescription$ As CARDNAME enters the battlefield, choose a color. A:AB$ Mana | Cost$ T | Produced$ Chosen | SpellDescription$ Add one mana of the chosen color to your mana pool. -SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/coldsteel_heart.jpg Oracle:Coldsteel Heart enters the battlefield tapped.\nAs Coldsteel Heart enters the battlefield, choose a color.\n{T}: Add one mana of the chosen color to your mana pool. diff --git a/forge-gui/res/cardsfolder/c/curse_of_wizardry.txt b/forge-gui/res/cardsfolder/c/curse_of_wizardry.txt index ad2f423182d..8084b08c67f 100644 --- a/forge-gui/res/cardsfolder/c/curse_of_wizardry.txt +++ b/forge-gui/res/cardsfolder/c/curse_of_wizardry.txt @@ -5,5 +5,6 @@ K:ETBReplacement:Other:ChooseColor SVar:ChooseColor:DB$ ChooseColor | Defined$ You | SpellDescription$ As CARDNAME enters the battlefield, choose a color. | AILogic$ MostProminentInHumanDeck T:Mode$ SpellCast | ValidCard$ Card.ChosenColor | TriggerZones$ Battlefield | Execute$ TrigLoseLife | TriggerDescription$ Whenever a player casts a spell of the chosen color, that player loses 1 life. SVar:TrigLoseLife:AB$LoseLife | Cost$ 0 | Defined$ TriggeredActivator | LifeAmount$ 1 +SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_wizardry.jpg Oracle:As Curse of Wizardry enters the battlefield, choose a color.\nWhenever a player casts a spell of the chosen color, that player loses 1 life. diff --git a/forge-gui/res/cardsfolder/h/hall_of_gemstone.txt b/forge-gui/res/cardsfolder/h/hall_of_gemstone.txt index 22ddbe1a1a9..0c41fbca178 100644 --- a/forge-gui/res/cardsfolder/h/hall_of_gemstone.txt +++ b/forge-gui/res/cardsfolder/h/hall_of_gemstone.txt @@ -6,5 +6,6 @@ SVar:TrigChoose:AB$ ChooseColor | Cost$ 0 | Defined$ TriggeredPlayer | AILogic$ SVar:DBEffect:DB$ Effect | ReplacementEffects$ ReplaceChosen | SVars$ ProduceChosen SVar:ReplaceChosen:Event$ ProduceMana | ActiveZones$ Command | ValidCard$ Land | ManaReplacement$ ProduceChosen | Description$ Lands tapped for mana produce mana of the chosen color instead of any other color. SVar:ProduceChosen:Colorless->Chosen & U->Chosen & B->Chosen & R->Chosen & G->Chosen & W->Chosen +SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/hall_of_gemstone.jpg Oracle:At the beginning of each player's upkeep, that player chooses a color. Until end of turn, lands tapped for mana produce mana of the chosen color instead of any other color. diff --git a/forge-gui/res/cardsfolder/h/harsh_judgment.txt b/forge-gui/res/cardsfolder/h/harsh_judgment.txt index 2f47b063351..af3a99f8431 100644 --- a/forge-gui/res/cardsfolder/h/harsh_judgment.txt +++ b/forge-gui/res/cardsfolder/h/harsh_judgment.txt @@ -2,11 +2,10 @@ Name:Harsh Judgment ManaCost:2 W W Types:Enchantment K:ETBReplacement:Other:ChooseColor -SVar:ChooseColor:DB$ ChooseColor | Defined$ You | SpellDescription$ As CARDNAME enters the battlefield, choose a color. | AILogic$ MostProminentInHumanDeck +SVar:ChooseColor:DB$ ChooseColor | Defined$ You | AILogic$ MostProminentInHumanDeck | SpellDescription$ As CARDNAME enters the battlefield, choose a color. R:Event$ DamageDone | ValidTarget$ You | ActiveZones$ Battlefield | ValidSource$ Instant.ChosenColor,Sorcery.ChosenColor | IsCombat$ False | ReplaceWith$ HarshDmg | Description$ If an instant or sorcery spell of the chosen color would deal damage to you, it deals that damage to its controller instead. SVar:HarshDmg:AB$ DealDamage | Cost$ 0 | Defined$ ReplacedSourceController | DamageSource$ ReplacedSource | NumDmg$ HarshX | References$ HarshX SVar:HarshX:ReplaceCount$DamageAmount SVar:RemRandomDeck:True -SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/harsh_judgment.jpg Oracle:As Harsh Judgment enters the battlefield, choose a color.\nIf an instant or sorcery spell of the chosen color would deal damage to you, it deals that damage to its controller instead.