- Added Rob's buyback code (includes Brush with Death).

This commit is contained in:
jendave
2011-08-06 03:35:40 +00:00
parent 3d36924bb5
commit c971e1ef9f
5 changed files with 50 additions and 1 deletions

View File

@@ -1,3 +1,10 @@
Brush With Death
2 B
Sorcery
no text
spLoseLifeTgt:2:Drawback$YouGainLife/2:Target opponent loses 2 life and you gain 2 life.
SVar:Buyback:2 B B
Windstorm
X G
Instant

View File

@@ -2993,6 +2993,20 @@ public class CardFactory implements NewConstants {
card.clearSpellAbility();
card.addSpellAbility(spLoseLife);
String bbCost = card.getSVar("Buyback");
if (!bbCost.equals(""))
{
SpellAbility bbLoseLife = spLoseLife.copy();
bbLoseLife.setManaCost(CardUtil.addManaCosts(card.getManaCost(), bbCost));
bbLoseLife.setDescription("Buyback " + bbCost + "(You may pay an additional " + bbCost + " as you cast this spell. If you do, put this card into your hand as it resolves.)");
bbLoseLife.setIsBuyBackAbility(true);
if (Tgt[0] == true)
bbLoseLife.setBeforePayMana(CardFactoryUtil.input_targetPlayer(bbLoseLife));
card.addSpellAbility(bbLoseLife);
}
}
}

View File

@@ -3368,7 +3368,6 @@ public class CardFactory_Creatures {
else
ability.setTargetCard(human);
AllZone.Stack.add(ability);
}//else
}//execute()

View File

@@ -227,6 +227,24 @@ public class CardUtil {
return tok.countTokens();
}
static public String addManaCosts(String mc1, String mc2)
{
String tMC = new String("");
Integer cl1, cl2, tCL;
cl1 = Integer.valueOf(mc1.replaceAll("[WUBRGSX]", "").trim());
cl2 = Integer.valueOf(mc2.replaceAll("[WUBRGSX]", "").trim());
tCL = cl1 + cl2;
mc1 = mc1.replace(cl1.toString(), "").trim();
mc2 = mc2.replace(cl2.toString(), "").trim();
tMC = tCL.toString() + " " + mc1 + " " + mc2;
System.out.println("TMC:" + tMC);
return tMC;
}
static public Card getRelative(Card c, String relation)
{
if(relation.equals("CARDNAME")) return c;

View File

@@ -294,4 +294,15 @@ public abstract class SpellAbility {
public boolean isFlashBackAbility() {
return flashBackAbility;
}
public SpellAbility copy()
{
SpellAbility clone = null;
try {
clone = (SpellAbility)this.clone();
} catch (CloneNotSupportedException e) {
System.err.println(e);
}
return clone;
}
}