- Added first functionality to ReduceCostAbility.

- Converted Helm of Awakening.
This commit is contained in:
Sloth
2012-07-14 21:07:56 +00:00
parent 0b398638b7
commit 0c9eef4f64
3 changed files with 18 additions and 7 deletions

View File

@@ -2,7 +2,7 @@ Name:Helm of Awakening
ManaCost:2
Types:Artifact
Text:no text
K:CostChange:All:Less:1:Spell:All:All:NoSpecial:Spells cost 1 less to cast.
S:Mode$ ReduceCost | ValidCard$ Card | Type$ Spell | Amount$ 1 | Description$ Spells cost 1 less to cast.
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/helm_of_awakening.jpg
SetInfo:VIS|Uncommon|http://magiccards.info/scans/en/vi/145.jpg

View File

@@ -2470,12 +2470,12 @@ public class GameAction {
} // Khalni Hydra
// Reduce cost
/*for (Card c : cardsInPlay) {
for (Card c : AllZoneUtil.getCardsIn(ZoneType.Battlefield)) {
final ArrayList<StaticAbility> staticAbilities = c.getStaticAbilities();
for (final StaticAbility stAb : staticAbilities) {
manaCost = stAb.applyAbility("ReduceCost", spell, manaCost);
}
}*/
}
return manaCost;
} // GetSpellCostChange

View File

@@ -20,6 +20,7 @@ package forge.card.staticability;
import java.util.HashMap;
import forge.Card;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.mana.ManaCost;
import forge.card.spellability.SpellAbility;
import forge.game.player.Player;
@@ -83,17 +84,17 @@ public class StaticAbilityCostChange {
final Card hostCard = staticAbility.getHostCard();
final Player activator = sa.getActivatingPlayer();
final Card card = sa.getSourceCard();
final String amount = params.get("Amount");
final ManaCost manaCost = new ManaCost(originalCost.toString());
if (params.containsKey("ValidCard")
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
return originalCost;
}
if (params.containsKey("Activator") && ((activator == null)
|| !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard))) {
return originalCost;
}
if (params.containsKey("Type") && params.get("Type").equals("Spell") && !sa.isSpell()) {
return originalCost;
}
@@ -101,7 +102,17 @@ public class StaticAbilityCostChange {
return originalCost;
}
//modify the cost here
return originalCost;
if (!"WUGRB".contains(amount)) {
int value = 0;
if ("X".equals(amount)) {
value = CardFactoryUtil.xCount(card, card.getSVar("X"));
} else {
value = Integer.valueOf(amount);
}
manaCost.decreaseColorlessMana(value);
}
return manaCost;
}
}