mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
- Converted Braid of Fire to script
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -14772,6 +14772,7 @@ src/main/java/forge/card/cardfactory/CardFactoryUtil.java svneol=native#text/pla
|
|||||||
src/main/java/forge/card/cardfactory/CardStorageReader.java svneol=native#text/plain
|
src/main/java/forge/card/cardfactory/CardStorageReader.java svneol=native#text/plain
|
||||||
src/main/java/forge/card/cardfactory/package-info.java svneol=native#text/plain
|
src/main/java/forge/card/cardfactory/package-info.java svneol=native#text/plain
|
||||||
src/main/java/forge/card/cost/Cost.java svneol=native#text/plain
|
src/main/java/forge/card/cost/Cost.java svneol=native#text/plain
|
||||||
|
src/main/java/forge/card/cost/CostAddMana.java -text
|
||||||
src/main/java/forge/card/cost/CostDamage.java -text
|
src/main/java/forge/card/cost/CostDamage.java -text
|
||||||
src/main/java/forge/card/cost/CostDiscard.java -text
|
src/main/java/forge/card/cost/CostDiscard.java -text
|
||||||
src/main/java/forge/card/cost/CostDraw.java -text
|
src/main/java/forge/card/cost/CostDraw.java -text
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
Name:Braid of Fire
|
Name:Braid of Fire
|
||||||
ManaCost:1 R
|
ManaCost:1 R
|
||||||
Types:Enchantment
|
Types:Enchantment
|
||||||
Text:Cumulative upkeep-Add R to your mana pool.
|
K:Cumulative upkeep:AddMana<1/R>:Add R to your mana pool.
|
||||||
SVar:RemAIDeck:True
|
SVar:RemAIDeck:True
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/braid_of_fire.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/braid_of_fire.jpg
|
||||||
Oracle:Cumulative upkeep-Add {R} to your mana pool. (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.)
|
Oracle:Cumulative upkeep-Add {R} to your mana pool. (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.)
|
||||||
@@ -268,6 +268,13 @@ public class Cost {
|
|||||||
return new CostDiscard(splitStr[0], splitStr[1], description);
|
return new CostDiscard(splitStr[0], splitStr[1], description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parse.startsWith("AddMana<")) {
|
||||||
|
// AddMana<Num/Type>
|
||||||
|
final String[] splitStr = abCostParse(parse, 3);
|
||||||
|
final String description = splitStr.length > 2 ? splitStr[2] : null;
|
||||||
|
return new CostAddMana(splitStr[0], splitStr[1], description);
|
||||||
|
}
|
||||||
|
|
||||||
if (parse.startsWith("Sac<")) {
|
if (parse.startsWith("Sac<")) {
|
||||||
final String[] splitStr = abCostParse(parse, 3);
|
final String[] splitStr = abCostParse(parse, 3);
|
||||||
final String description = splitStr.length > 2 ? splitStr[2] : null;
|
final String description = splitStr.length > 2 ? splitStr[2] : null;
|
||||||
|
|||||||
173
src/main/java/forge/card/cost/CostAddMana.java
Normal file
173
src/main/java/forge/card/cost/CostAddMana.java
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
/*
|
||||||
|
* Forge: Play Magic: the Gathering.
|
||||||
|
* Copyright (C) 2011 Forge Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package forge.card.cost;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
import forge.Card;
|
||||||
|
import forge.card.ColorSet;
|
||||||
|
import forge.card.MagicColor;
|
||||||
|
import forge.card.ability.AbilityUtils;
|
||||||
|
import forge.card.mana.Mana;
|
||||||
|
import forge.card.spellability.SpellAbility;
|
||||||
|
import forge.game.Game;
|
||||||
|
import forge.game.GameType;
|
||||||
|
import forge.game.player.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class CostAddMana.
|
||||||
|
*/
|
||||||
|
public class CostAddMana extends CostPart {
|
||||||
|
/**
|
||||||
|
* CostCostAddMana.
|
||||||
|
* @param amount
|
||||||
|
* @param playerSelector
|
||||||
|
*/
|
||||||
|
public CostAddMana(final String amount, final String type, final String description) {
|
||||||
|
super(amount, type, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see forge.card.cost.CostPart#toString()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public final String toString() {
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
final Integer i = this.convertAmount();
|
||||||
|
sb.append("Add ").append(convertManaAmountType(i, this.getType()));
|
||||||
|
sb.append(" to your mana pool");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* convertManaAmountType.
|
||||||
|
* @param i
|
||||||
|
* @param type
|
||||||
|
* @return a String
|
||||||
|
*/
|
||||||
|
private String convertManaAmountType(Integer i, String type) {
|
||||||
|
return StringUtils.repeat(" " + type, i).trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* forge.card.cost.CostPart#canPay(forge.card.spellability.SpellAbility,
|
||||||
|
* forge.Card, forge.Player, forge.card.cost.Cost)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public final boolean canPay(final SpellAbility ability) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see forge.card.cost.CostPart#payAI(forge.card.spellability.SpellAbility,
|
||||||
|
* forge.Card, forge.card.cost.Cost_Payment)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public final boolean payAI(final PaymentDecision decision, final Player ai, SpellAbility ability, Card source) {
|
||||||
|
ColorSet cid = null;
|
||||||
|
if (ai.getGame().getType() == GameType.Commander) {
|
||||||
|
cid = ai.getCommander().getRules().getColorIdentity();
|
||||||
|
}
|
||||||
|
ArrayList<Mana> manaProduced = new ArrayList<Mana>();
|
||||||
|
final String type = this.getType();
|
||||||
|
for (int n = 0; n < decision.c; n++) {
|
||||||
|
if (StringUtils.isNumeric(type)) {
|
||||||
|
for (int i = Integer.parseInt(type); i > 0; i--) {
|
||||||
|
manaProduced.add(new Mana(MagicColor.COLORLESS, source, null));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
byte attemptedMana = MagicColor.fromName(type);
|
||||||
|
if (cid != null) {
|
||||||
|
if (!cid.hasAnyColor(attemptedMana)) {
|
||||||
|
attemptedMana = MagicColor.COLORLESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
manaProduced.add(new Mana(attemptedMana, source, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ai.getManaPool().add(manaProduced);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* forge.card.cost.CostPart#payHuman(forge.card.spellability.SpellAbility,
|
||||||
|
* forge.Card, forge.card.cost.Cost_Payment)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public final boolean payHuman(final SpellAbility ability, final Game game) {
|
||||||
|
final Player activator = ability.getActivatingPlayer();
|
||||||
|
final Card source = ability.getSourceCard();
|
||||||
|
Integer c = this.convertAmount();
|
||||||
|
if (c == null) {
|
||||||
|
c = AbilityUtils.calculateAmount(source, this.getAmount(), ability);
|
||||||
|
}
|
||||||
|
ColorSet cid = null;
|
||||||
|
if (activator.getGame().getType() == GameType.Commander) {
|
||||||
|
cid = activator.getCommander().getRules().getColorIdentity();
|
||||||
|
}
|
||||||
|
ArrayList<Mana> manaProduced = new ArrayList<Mana>();
|
||||||
|
final String type = this.getType();
|
||||||
|
for (int n = 0; n < c; n++) {
|
||||||
|
if (StringUtils.isNumeric(type)) {
|
||||||
|
for (int i = Integer.parseInt(type); i > 0; i--) {
|
||||||
|
manaProduced.add(new Mana(MagicColor.COLORLESS, source, null));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
byte attemptedMana = MagicColor.fromName(type);
|
||||||
|
if (cid != null) {
|
||||||
|
if (!cid.hasAnyColor(attemptedMana)) {
|
||||||
|
attemptedMana = MagicColor.COLORLESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
manaProduced.add(new Mana(attemptedMana, source, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
activator.getManaPool().add(manaProduced);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* forge.card.cost.CostPart#decideAIPayment(forge.card.spellability.SpellAbility
|
||||||
|
* , forge.Card, forge.card.cost.Cost_Payment)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public final PaymentDecision decideAIPayment(final Player ai, final SpellAbility ability, final Card source) {
|
||||||
|
Integer c = this.convertAmount();
|
||||||
|
|
||||||
|
if (c == null) {
|
||||||
|
c = AbilityUtils.calculateAmount(source, this.getAmount(), ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PaymentDecision(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -126,7 +126,7 @@ public class ManaPool {
|
|||||||
if (isEndOfPhase && !owner.getGame().getPhaseHandler().is(PhaseType.CLEANUP)) {
|
if (isEndOfPhase && !owner.getGame().getPhaseHandler().is(PhaseType.CLEANUP)) {
|
||||||
final List<Mana> pMana = new ArrayList<Mana>();
|
final List<Mana> pMana = new ArrayList<Mana>();
|
||||||
for (final Mana mana : this.floatingMana.get(b)) {
|
for (final Mana mana : this.floatingMana.get(b)) {
|
||||||
if (mana.getManaAbility().isPersistentMana()) {
|
if (mana.getManaAbility()!= null && mana.getManaAbility().isPersistentMana()) {
|
||||||
pMana.add(mana);
|
pMana.add(mana);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ public class Upkeep extends Phase {
|
|||||||
public final void executeAt() {
|
public final void executeAt() {
|
||||||
|
|
||||||
game.getStack().freezeStack();
|
game.getStack().freezeStack();
|
||||||
Upkeep.upkeepBraidOfFire(game);
|
|
||||||
|
|
||||||
Upkeep.upkeepUpkeepCost(game); // sacrifice unless upkeep cost is paid
|
Upkeep.upkeepUpkeepCost(game); // sacrifice unless upkeep cost is paid
|
||||||
Upkeep.upkeepEcho(game);
|
Upkeep.upkeepEcho(game);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import forge.card.ability.effects.CharmEffect;
|
|||||||
import forge.card.ability.effects.FlipCoinEffect;
|
import forge.card.ability.effects.FlipCoinEffect;
|
||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
import forge.card.cost.Cost;
|
import forge.card.cost.Cost;
|
||||||
|
import forge.card.cost.CostAddMana;
|
||||||
import forge.card.cost.CostDamage;
|
import forge.card.cost.CostDamage;
|
||||||
import forge.card.cost.CostDiscard;
|
import forge.card.cost.CostDiscard;
|
||||||
import forge.card.cost.CostDraw;
|
import forge.card.cost.CostDraw;
|
||||||
@@ -367,6 +368,17 @@ public class HumanPlay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (part instanceof CostAddMana) {
|
||||||
|
if (!GuiDialog.confirm(source, "Do you want to add "
|
||||||
|
+ ((CostAddMana) part).toString()
|
||||||
|
+ " to your mana pool?" + orString)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!part.payHuman(sourceAbility, p.getGame())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else if (part instanceof CostMill) {
|
else if (part instanceof CostMill) {
|
||||||
final int amount = getAmountFromPart(part, source, sourceAbility);
|
final int amount = getAmountFromPart(part, source, sourceAbility);
|
||||||
final List<Card> list = p.getCardsIn(ZoneType.Library);
|
final List<Card> list = p.getCardsIn(ZoneType.Library);
|
||||||
|
|||||||
Reference in New Issue
Block a user