- Replace isCurse parsing with a simple isCurse() function in AbilityFactory

- Tweaked AbilityCost toString function for Spells 
- Additional costs now displayed for Spells using AbilityFactory
- Buyback spells now alter the abCost value for Abilities generated by AbilityFactory.
This commit is contained in:
jendave
2011-08-06 09:02:12 +00:00
parent 6c8400eb1e
commit 4e6e113588
3 changed files with 12 additions and 13 deletions

View File

@@ -57,9 +57,8 @@ public class AbilityFactory {
return abTgt;
}
private boolean isCurse = false;
public boolean isCurse(){
return isCurse;
return mapParams.containsKey("IsCurse");
}
private boolean hasSubAb = false;
@@ -146,8 +145,6 @@ public class AbilityFactory {
abTgt = new Target(mapParams.get("Tgt"));
}
isCurse = mapParams.containsKey("IsCurse");
hasSubAb = mapParams.containsKey("SubAbility");
hasSpDesc = mapParams.containsKey("SpellDescription");
@@ -201,11 +198,10 @@ public class AbilityFactory {
if (hasSpDesc)
{
String desc = mapParams.get("SpellDescription");
if (isAb)
desc = abCost.toString() + desc;
StringBuilder sb = new StringBuilder(abCost.toString());
sb.append(mapParams.get("SpellDescription"));
SA.setDescription(desc);
SA.setDescription(sb.toString());
}

View File

@@ -206,14 +206,14 @@ public class Ability_Cost {
// maybe add a conversion method that turns the amounts into words 1=a(n), 2=two etc.
private String spellToString() {
StringBuilder cost = new StringBuilder("As an additional cost to play ");
StringBuilder cost = new StringBuilder("As an additional cost to cast ");
cost.append(name);
cost.append(", ");
boolean first = true;
if (!(manaCost.equals("0") || manaCost.equals(""))){
// never a normal additional mana cost for spells
cost.append(manaCost);
// usually no additional mana cost for spells
// only three Alliances cards have additional mana costs, but they are basically kicker/multikicker
}
if (tapCost || untapCost){
@@ -274,7 +274,7 @@ public class Ability_Cost {
first = false;
}
cost.append(".");
cost.append(".").append("\n");
return cost.toString();
}

View File

@@ -6121,7 +6121,10 @@ public class CardFactory implements NewConstants {
if (!bbCost.equals(""))
{
SpellAbility bbSA = sa.copy();
bbSA.setManaCost(CardUtil.addManaCosts(card.getManaCost(), bbCost));
String newCost = CardUtil.addManaCosts(card.getManaCost(), bbCost);
bbSA.setManaCost(newCost);
if (bbSA.payCosts != null)
bbSA.payCosts.setMana(newCost); // abCost value needs to be increased for paying spells
StringBuilder sb = new StringBuilder();
sb.append("Buyback ").append(bbCost).append(" (You may pay an additional ").append(bbCost);
sb.append(" as you cast this spell. If you do, put this card into your hand as it resolves.)");