Commit bf6f8048 authored by Michael Kamensky's avatar Michael Kamensky

Merge branch 'spellCostReduceTarget' into 'master'

CostAdjustment: use Relative for Amount that depends on the SpellAbility

See merge request core-developers/forge!1289
parents f3f7700b f26935f3
......@@ -366,10 +366,9 @@ public class CostAdjustment {
if (manaCost.toString().equals("{0}")) {
return 0;
}
final Map<String, String> params = staticAbility.getMapParams();
final Card hostCard = staticAbility.getHostCard();
final Card card = sa.getHostCard();
final String amount = params.get("Amount");
final String amount = staticAbility.getParam("Amount");
if (!checkRequirement(sa, staticAbility)) {
return 0;
......@@ -380,14 +379,16 @@ public class CostAdjustment {
value = CardFactoryUtil.xCount(card, hostCard.getSVar(amount));
} else if ("Undaunted".equals(amount)) {
value = card.getController().getOpponents().size();
} else if (staticAbility.hasParam("Relative")) {
value = AbilityUtils.calculateAmount(hostCard, amount, sa);
} else {
value = AbilityUtils.calculateAmount(hostCard, amount, staticAbility);
}
if (!params.containsKey("Cost") && ! params.containsKey("Color")) {
if (!staticAbility.hasParam("Cost") && ! staticAbility.hasParam("Color")) {
int minMana = 0;
if (params.containsKey("MinMana")) {
minMana = Integer.valueOf(params.get("MinMana"));
if (staticAbility.hasParam("MinMana")) {
minMana = Integer.valueOf(staticAbility.getParam("MinMana"));
}
final int maxReduction = Math.max(0, manaCost.getConvertedManaCost() - minMana);
......@@ -395,7 +396,7 @@ public class CostAdjustment {
return Math.min(value, maxReduction);
}
} else {
final String color = params.containsKey("Cost") ? params.get("Cost") : params.get("Color");
final String color = staticAbility.getParamOrDefault("Cost", staticAbility.getParam("Color"));
int sumGeneric = 0;
// might be problematic for wierd hybrid combinations
for (final String cost : color.split(" ")) {
......
Name:Not of This World
ManaCost:7
Types:Tribal Instant Eldrazi
S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ CostReduction | References$ CostReduction,CheckTgt | EffectZone$ All | Description$ CARDNAME costs {7} less to cast if it targets a spell or ability that targets a creature you control with power 7 or greater.
A:SP$ Counter | Cost$ 7 | TargetType$ Spell,Activated,Triggered | TgtPrompt$ Select target spell or ability that targets a permanent you control | ValidTgts$ Card | TargetValidTargeting$ Permanent.YouCtrl+inZoneBattlefield | SpellDescription$ Counter target spell or ability that targets a permanent you control.
S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ CostReduction | Relative$ True | References$ CostReduction,CheckTgt | EffectZone$ All | Description$ CARDNAME costs {7} less to cast if it targets a spell or ability that targets a creature you control with power 7 or greater.
A:SP$ Counter | Cost$ 7 | TargetType$ Spell,Activated,Triggered | TgtPrompt$ Select target spell or ability that targets a permanent you control | ValidTgts$ Card | TargetValidTargeting$ Permanent.YouCtrl+inZoneBattlefield | References$ CostReduction,CheckTgt | SpellDescription$ Counter target spell or ability that targets a permanent you control.
SVar:CostReduction:Count$Compare CheckTgt GE1.7.0
SVar:CheckTgt:TargetedByTarget$Valid Card.powerGE7+YouCtrl
SVar:Picture:http://www.wizards.com/global/images/magic/general/not_of_this_world.jpg
......
Name:Price of Fame
ManaCost:3 B
Types:Instant
S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ CostReduction | EffectZone$ All | Description$ CARDNAME costs {2} less to cast if it targets a legendary creature.
A:SP$ Destroy | Cost$ 3 B | ValidTgts$ Creature | SubAbility$ DBSurveil | TgtPrompt$ Select target creature | SpellDescription$ Destroy target creature.
S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ CostReduction | Relative$ True | EffectZone$ All | References$ CostReduction,CheckTgt | Description$ CARDNAME costs {2} less to cast if it targets a legendary creature.
A:SP$ Destroy | Cost$ 3 B | ValidTgts$ Creature | SubAbility$ DBSurveil | TgtPrompt$ Select target creature | References$ CostReduction,CheckTgt | SpellDescription$ Destroy target creature.
SVar:CostReduction:Count$Compare CheckTgt GE1.2.0
SVar:CheckTgt:Targeted$Valid Creature.Legendary
SVar:DBSurveil:DB$ Surveil | Amount$ 2
......
Name:Savage Stomp
ManaCost:2 G
Types:Sorcery
S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ CostReduction | References$ CostReduction,CheckTgt | EffectZone$ All | Description$ CARDNAME costs {2} less to cast if it targets a Dinosaur you control.
S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ CostReduction | Relative$ True | References$ CostReduction,CheckTgt | EffectZone$ All | Description$ CARDNAME costs {2} less to cast if it targets a Dinosaur you control.
SVar:CostReduction:Count$Compare CheckTgt GE1.2.0
SVar:CheckTgt:Targeted$Valid Creature.Dinosaur+YouCtrl
A:SP$ PutCounter | Cost$ 2 G | AILogic$ Fight | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control to put a +1/+1 counter | CounterType$ P1P1 | CounterNum$ 1 | SubAbility$ DBFight | References$ CostReduction,CheckTgt | SpellDescription$ Put a +1/+1 counter on target creature you control. Then that creature fights target creature you don't control.
......
Name:Titanic Brawl
ManaCost:1 G
Types:Instant
S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ 1 | EffectZone$ All | CheckSVar$ X | SVarCompare$ GE1 | Description$ This spell costs {1} less to cast if it targets a creature you control with a +1/+1 counter on it.
SVar:X:Count$Valid Creature.YouCtrl+counters_GE1_P1P1
S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ CostReduction | EffectZone$ All | References$ CostReduction,CheckTgt | Relative$ True | Description$ This spell costs {1} less to cast if it targets a creature you control with a +1/+1 counter on it.
SVar:CostReduction:Count$Compare CheckTgt GE1.2.0
SVar:CheckTgt:Targeted$Valid Creature.YouCtrl+counters_GE1_P1P1
DeckHints:Ability$Counters
A:SP$ Pump | Cost$ 1 G | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Choose target creature you control | SubAbility$ DBFight | SpellDescription$ Target creature you control fights target creature you don't control. (Each deals damage equal to its power to the other.)
A:SP$ Pump | Cost$ 1 G | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Choose target creature you control | SubAbility$ DBFight | References$ CostReduction,CheckTgt | SpellDescription$ Target creature you control fights target creature you don't control. (Each deals damage equal to its power to the other.)
SVar:DBFight:DB$ Fight | Defined$ ParentTarget | ValidTgts$ Creature.YouDontCtrl | TgtPrompt$ Choose target creature you don't control
Oracle:This spell costs {1} less to cast if it targets a creature you control with a +1/+1 counter on it.\nTarget creature you control fights target creature you don't control. (Each deals damage equal to its power to the other.)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment