mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
- Added Rob's buyback code (includes Brush with Death).
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3368,7 +3368,6 @@ public class CardFactory_Creatures {
|
||||
else
|
||||
ability.setTargetCard(human);
|
||||
|
||||
|
||||
AllZone.Stack.add(ability);
|
||||
}//else
|
||||
}//execute()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user