mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Added AltCost SVar to handle cards that have an Alternative Casting Cost.
- GameAction.GetSpellCostChange() now takes mana cost as a parameter (to prevent overwriting of AltCost) - Added Fireblast - Converted Bringer of the Blue/Green/White Dawn to use AltCost
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1442,6 +1442,7 @@ res/cardsfolder/fire_lit_thicket.txt -text svneol=native#text/plain
|
||||
res/cardsfolder/fire_sprites.txt -text svneol=native#text/plain
|
||||
res/cardsfolder/fire_tempest.txt -text svneol=native#text/plain
|
||||
res/cardsfolder/fireball.txt -text svneol=native#text/plain
|
||||
res/cardsfolder/fireblast.txt -text svneol=native#text/plain
|
||||
res/cardsfolder/firebolt.txt -text svneol=native#text/plain
|
||||
res/cardsfolder/firefly.txt -text svneol=native#text/plain
|
||||
res/cardsfolder/fires_of_yavimaya.txt -text svneol=native#text/plain
|
||||
|
||||
@@ -4,6 +4,7 @@ Types:Creature Bringer
|
||||
Text:At the beginning of your upkeep, you may draw two cards.
|
||||
PT:5/5
|
||||
K:Trample
|
||||
SVar:AltCost:W U B R G
|
||||
SVar:Rarity:Rare
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/bringer_of_the_blue_dawn.jpg
|
||||
End
|
||||
|
||||
@@ -4,6 +4,7 @@ Types:Creature Bringer
|
||||
Text:At the beginning of your upkeep, you may put a 3/3 green Beast creature token into play.
|
||||
PT:5/5
|
||||
K:Trample
|
||||
SVar:AltCost:W U B R G
|
||||
SVar:Rarity:Rare
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/bringer_of_the_green_dawn.jpg
|
||||
End
|
||||
|
||||
@@ -4,6 +4,7 @@ Types:Creature Bringer
|
||||
Text:At the beginning of your upkeep, you may return target artifact card from your graveyard to play.
|
||||
PT:5/5
|
||||
K:Trample
|
||||
SVar:AltCost:W U B R G
|
||||
SVar:Rarity:Rare
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/bringer_of_the_white_dawn.jpg
|
||||
End
|
||||
|
||||
9
res/cardsfolder/fireblast.txt
Normal file
9
res/cardsfolder/fireblast.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Name:Fireblast
|
||||
ManaCost:4 R R
|
||||
Types:Instant
|
||||
Text:no text
|
||||
A:SP$DealDamage|Cost$4 R R|Tgt$TgtCP|NumDmg$4|SpellDescription$CARDNAME deals 4 damage to target creature or player.
|
||||
SVar:AltCost:Sac<2/Mountain>
|
||||
SVar:Rarity:Common
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/fireblast.jpg
|
||||
End
|
||||
@@ -191,8 +191,10 @@ public class Ability_Cost {
|
||||
}
|
||||
|
||||
public void changeCost(SpellAbility sa){
|
||||
if (manaCost != "0")
|
||||
manaCost = AllZone.GameAction.GetSpellCostChange(sa).toString();
|
||||
if (manaCost != "0"){
|
||||
String mana = getMana();
|
||||
manaCost = AllZone.GameAction.GetSpellCostChange(sa, new ManaCost(mana)).toString();
|
||||
}
|
||||
}
|
||||
|
||||
public String toString()
|
||||
@@ -200,20 +202,31 @@ public class Ability_Cost {
|
||||
if (isAbility)
|
||||
return abilityToString();
|
||||
else
|
||||
return spellToString();
|
||||
return spellToString(true);
|
||||
}
|
||||
|
||||
// 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 cast ");
|
||||
cost.append(name);
|
||||
cost.append(", ");
|
||||
public String toStringAlt(){
|
||||
return spellToString(false);
|
||||
}
|
||||
|
||||
|
||||
private String spellToString(boolean bFlag) {
|
||||
StringBuilder cost = new StringBuilder();
|
||||
|
||||
if (bFlag)
|
||||
cost.append("As an additional cost to cast ").append(name).append(", ");
|
||||
|
||||
boolean first = true;
|
||||
|
||||
if (!(manaCost.equals("0") || manaCost.equals(""))){
|
||||
if (!bFlag){
|
||||
// usually no additional mana cost for spells
|
||||
// only three Alliances cards have additional mana costs, but they are basically kicker/multikicker
|
||||
if (!getMana().equals("") && !getMana().equals("0")){
|
||||
cost.append("pay ").append(getMana());
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (tapCost || untapCost){
|
||||
@@ -277,7 +290,9 @@ public class Ability_Cost {
|
||||
if (first)
|
||||
return "";
|
||||
|
||||
cost.append(".").append("\n");
|
||||
if (bFlag)
|
||||
cost.append(".").append("\n");
|
||||
|
||||
return cost.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -11592,6 +11592,28 @@ public class CardFactory implements NewConstants {
|
||||
}
|
||||
}//Vanishing
|
||||
|
||||
// AltCost
|
||||
SpellAbility[] abilities = card.getSpellAbility();
|
||||
if (abilities.length > 0){
|
||||
String altCost = card.getSVar("AltCost");
|
||||
SpellAbility sa = abilities[0];
|
||||
if (!altCost.equals("") && sa.isSpell())
|
||||
{
|
||||
SpellAbility altCostSA = sa.copy();
|
||||
|
||||
Ability_Cost abCost = new Ability_Cost(altCost, card.getName(), altCostSA.isAbility());
|
||||
altCostSA.payCosts = abCost;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("You may ").append(abCost.toStringAlt());
|
||||
sb.append(" rather than pay ").append(card.getName()).append("'s mana cost");
|
||||
|
||||
altCostSA.setDescription(sb.toString());
|
||||
|
||||
card.addSpellAbility(altCostSA);
|
||||
}
|
||||
}
|
||||
return card;
|
||||
}
|
||||
|
||||
|
||||
@@ -10470,40 +10470,6 @@ public class CardFactory_Creatures {
|
||||
}//*************** END ************ END **************************
|
||||
|
||||
|
||||
//*************** START *********** START **************************
|
||||
else if(cardName.equals("Bringer of the Green Dawn") || cardName.equals("Bringer of the Blue Dawn")
|
||||
|| cardName.equals("Bringer of the White Dawn")) {
|
||||
final SpellAbility diffCost = new Spell(card) {
|
||||
private static final long serialVersionUID = -1598664186463358630L;
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController());
|
||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
|
||||
|
||||
|
||||
hand.remove(card);
|
||||
play.add(card);
|
||||
//card.comesIntoPlay(); //do i need this?
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlay() {
|
||||
return AllZone.Phase.getActivePlayer().equals(card.getController())
|
||||
&& !AllZone.Phase.getPhase().equals("End of Turn")
|
||||
&& !AllZone.GameAction.isCardInPlay(card) && super.canPlay();
|
||||
}
|
||||
|
||||
};
|
||||
diffCost.setManaCost("W U B R G");
|
||||
diffCost.setDescription("You may pay W U B R G rather than pay " + card.getName() + "'s mana cost. ");
|
||||
diffCost.setStackDescription(card.getName() + " - Creature 5/5");
|
||||
card.addSpellAbility(diffCost);
|
||||
|
||||
|
||||
}//*************** END ************ END **************************
|
||||
|
||||
|
||||
//*************** START *********** START **************************
|
||||
else if(cardName.equals("Thelonite Hermit")) {
|
||||
|
||||
|
||||
@@ -188,7 +188,10 @@ public class ComputerUtil
|
||||
land.remove(sa.getSourceCard());
|
||||
}
|
||||
// Beached - Delete old
|
||||
ManaCost cost = AllZone.GameAction.GetSpellCostChange(sa);
|
||||
String mana = sa.getPayCosts() != null ? sa.getPayCosts().getMana() : sa.getManaCost();
|
||||
ManaCost cost = new ManaCost(mana);
|
||||
|
||||
cost = AllZone.GameAction.GetSpellCostChange(sa, cost);
|
||||
if(cost.isPaid())
|
||||
return canPayAdditionalCosts(sa);
|
||||
// Beached - Delete old
|
||||
@@ -377,7 +380,10 @@ public class ComputerUtil
|
||||
{
|
||||
land.remove(sa.getSourceCard());
|
||||
}
|
||||
ManaCost cost = AllZone.GameAction.GetSpellCostChange(sa);
|
||||
|
||||
String mana = sa.getPayCosts() != null ? sa.getPayCosts().getMana() : sa.getManaCost();
|
||||
|
||||
ManaCost cost = AllZone.GameAction.GetSpellCostChange(sa, new ManaCost(mana));
|
||||
// Beached - Delete old
|
||||
if(cost.isPaid())
|
||||
return;
|
||||
|
||||
@@ -3207,12 +3207,12 @@ public class GameAction {
|
||||
|
||||
int CostCutting_GetMultiMickerManaCostPaid = 0;
|
||||
String CostCutting_GetMultiMickerManaCostPaid_Colored = "";
|
||||
public ManaCost GetSpellCostChange(SpellAbility sa) {
|
||||
public ManaCost GetSpellCostChange(SpellAbility sa, ManaCost originalCost) {
|
||||
// Beached
|
||||
Card originalCard = sa.getSourceCard();
|
||||
ManaCost manaCost;
|
||||
SpellAbility spell = sa;
|
||||
manaCost = new ManaCost(sa.getManaCost());
|
||||
ManaCost manaCost = new ManaCost(originalCost.toString());
|
||||
|
||||
if(spell.isSpell() == true) {
|
||||
if(originalCard.getName().equals("Avatar of Woe")){
|
||||
Player player = AllZone.Phase.getActivePlayer();
|
||||
@@ -3618,7 +3618,8 @@ public class GameAction {
|
||||
if(sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
|
||||
manaCost = new ManaCost("0");
|
||||
} else {
|
||||
manaCost = GetSpellCostChange(sa);
|
||||
|
||||
manaCost = GetSpellCostChange(sa, new ManaCost(sa.getManaCost()));
|
||||
}
|
||||
if(manaCost.isPaid() && sa.getBeforePayMana() == null) {
|
||||
if (sa.getAfterPayMana() == null){
|
||||
|
||||
@@ -23,7 +23,8 @@ public class Input_PayCostMana extends Input {
|
||||
if(sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
|
||||
manaCost = new ManaCost("0");
|
||||
} else {
|
||||
manaCost = AllZone.GameAction.GetSpellCostChange(sa);
|
||||
String mana = payment.getCost().getMana();
|
||||
manaCost = AllZone.GameAction.GetSpellCostChange(sa, new ManaCost(mana));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Input_PayManaCost extends Input {
|
||||
AllZone.Stack.add(spell);
|
||||
}
|
||||
} else {
|
||||
manaCost = AllZone.GameAction.GetSpellCostChange(sa);
|
||||
manaCost = AllZone.GameAction.GetSpellCostChange(sa, new ManaCost(originalManaCost));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user