From db07b734a1c34b48633fb0ff950c1d57433017ee Mon Sep 17 00:00:00 2001 From: elcnesh Date: Wed, 30 Jul 2014 09:27:20 +0000 Subject: [PATCH] Fix cost reducers (like Heartstone and Training Grounds). --- .../main/java/forge/game/mana/ManaCostAdjustment.java | 11 ++++++++--- forge-gui/res/cardsfolder/h/heartstone.txt | 2 +- forge-gui/res/cardsfolder/t/training_grounds.txt | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/forge-game/src/main/java/forge/game/mana/ManaCostAdjustment.java b/forge-game/src/main/java/forge/game/mana/ManaCostAdjustment.java index 9fda95d2745..2778d939e9c 100644 --- a/forge-game/src/main/java/forge/game/mana/ManaCostAdjustment.java +++ b/forge-game/src/main/java/forge/game/mana/ManaCostAdjustment.java @@ -436,9 +436,14 @@ public class ManaCostAdjustment { if (!params.containsKey("Color")) { - manaCost.decreaseColorlessMana(value); - if (manaCost.toString().equals("0") && params.containsKey("MinMana")) { - manaCost.increaseColorlessMana(Integer.valueOf(params.get("MinMana"))); + int minMana = 0; + if (params.containsKey("MinMana")) { + minMana = Integer.valueOf(params.get("MinMana")); + } + + final int maxReduction = Math.max(0, manaCost.getConvertedManaCost() - minMana); + if (maxReduction > 0) { + manaCost.decreaseColorlessMana(Math.min(value, maxReduction)); } } else { final String color = params.get("Color"); diff --git a/forge-gui/res/cardsfolder/h/heartstone.txt b/forge-gui/res/cardsfolder/h/heartstone.txt index b7d680f0031..451d468444e 100644 --- a/forge-gui/res/cardsfolder/h/heartstone.txt +++ b/forge-gui/res/cardsfolder/h/heartstone.txt @@ -1,6 +1,6 @@ Name:Heartstone ManaCost:3 Types:Artifact -S:Mode$ ReduceCost | ValidCard$ Creature.YouCtrl | Type$ Ability | Amount$ 1 | MinMana$ 1 | AffectedZone$ Battlefield | Description$ Activated abilities of creatures you control cost 1 less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana. +S:Mode$ ReduceCost | ValidCard$ Creature.YouCtrl | Type$ Ability | Amount$ 1 | MinMana$ 1 | AffectedZone$ Battlefield | Description$ Activated abilities of creatures you control cost {1} less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana. SVar:Picture:http://www.wizards.com/global/images/magic/general/heartstone.jpg Oracle:Activated abilities of creatures cost {1} less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana. diff --git a/forge-gui/res/cardsfolder/t/training_grounds.txt b/forge-gui/res/cardsfolder/t/training_grounds.txt index 2964c8a06ea..cb68f30c87a 100644 --- a/forge-gui/res/cardsfolder/t/training_grounds.txt +++ b/forge-gui/res/cardsfolder/t/training_grounds.txt @@ -1,6 +1,6 @@ Name:Training Grounds ManaCost:U Types:Enchantment -S:Mode$ ReduceCost | ValidCard$ Creature.YouCtrl | Type$ Ability | Amount$ 2 | MinMana$ 1 | AffectedZone$ Battlefield | Description$ Activated abilities of creatures you control cost 2 less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana. +S:Mode$ ReduceCost | ValidCard$ Creature.YouCtrl | Type$ Ability | Amount$ 2 | MinMana$ 1 | AffectedZone$ Battlefield | Description$ Activated abilities of creatures you control cost {2} less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana. SVar:Picture:http://www.wizards.com/global/images/magic/general/training_grounds.jpg Oracle:Activated abilities of creatures you control cost up to {2} less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana.