mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Pass the full Card object into Cost not just the name, so CostParts can be loaded from SVars in the future.
This commit is contained in:
@@ -2175,7 +2175,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
} else if (keyword.get(i).startsWith("Morph")) {
|
} else if (keyword.get(i).startsWith("Morph")) {
|
||||||
sbLong.append("Morph");
|
sbLong.append("Morph");
|
||||||
if (keyword.get(i).contains(":")) {
|
if (keyword.get(i).contains(":")) {
|
||||||
final Cost mCost = new Cost(keyword.get(i).substring(6), this.getName(), true);
|
final Cost mCost = new Cost(this, keyword.get(i).substring(6), true);
|
||||||
if (!mCost.isOnlyManaCost()) {
|
if (!mCost.isOnlyManaCost()) {
|
||||||
sbLong.append(" -");
|
sbLong.append(" -");
|
||||||
}
|
}
|
||||||
@@ -2462,7 +2462,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
if (keyword.startsWith("Flashback")) {
|
if (keyword.startsWith("Flashback")) {
|
||||||
sb.append("Flashback");
|
sb.append("Flashback");
|
||||||
if (keyword.contains(" ")) {
|
if (keyword.contains(" ")) {
|
||||||
final Cost fbCost = new Cost(keyword.substring(10), this.getName(), true);
|
final Cost fbCost = new Cost(this, keyword.substring(10), true);
|
||||||
if (!fbCost.isOnlyManaCost()) {
|
if (!fbCost.isOnlyManaCost()) {
|
||||||
sb.append(" -");
|
sb.append(" -");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ public class ComputerUtil {
|
|||||||
*/
|
*/
|
||||||
public static final void playSpellAbilityWithoutPayingManaCost(final SpellAbility sa) {
|
public static final void playSpellAbilityWithoutPayingManaCost(final SpellAbility sa) {
|
||||||
final SpellAbility newSA = sa.copy();
|
final SpellAbility newSA = sa.copy();
|
||||||
final Cost cost = new Cost("", sa.getSourceCard().getName(), false);
|
final Cost cost = new Cost(sa.getSourceCard(), "", false);
|
||||||
if (newSA.getPayCosts() != null) {
|
if (newSA.getPayCosts() != null) {
|
||||||
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
||||||
if (!(part instanceof CostMana)) {
|
if (!(part instanceof CostMana)) {
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ public class GameAction {
|
|||||||
|
|
||||||
final String recoverCost = recoverable.getKeyword().get(recoverable.getKeywordPosition("Recover"))
|
final String recoverCost = recoverable.getKeyword().get(recoverable.getKeywordPosition("Recover"))
|
||||||
.split(":")[1];
|
.split(":")[1];
|
||||||
final Cost cost = new Cost(recoverCost, recoverable.getName(), true);
|
final Cost cost = new Cost(recoverable, recoverCost, true);
|
||||||
|
|
||||||
final Command paidCommand = new Command() {
|
final Command paidCommand = new Command() {
|
||||||
private static final long serialVersionUID = -6357156873861051845L;
|
private static final long serialVersionUID = -6357156873861051845L;
|
||||||
@@ -1368,7 +1368,7 @@ public class GameAction {
|
|||||||
|
|
||||||
// there is a flashback cost (and not the cards cost)
|
// there is a flashback cost (and not the cards cost)
|
||||||
if (!keyword.equals("Flashback")) {
|
if (!keyword.equals("Flashback")) {
|
||||||
final Cost fbCost = new Cost(keyword.substring(10), source.getName(), false);
|
final Cost fbCost = new Cost(source, keyword.substring(10), false);
|
||||||
flashback.setPayCosts(fbCost);
|
flashback.setPayCosts(fbCost);
|
||||||
}
|
}
|
||||||
alternatives.add(flashback);
|
alternatives.add(flashback);
|
||||||
@@ -1379,7 +1379,7 @@ public class GameAction {
|
|||||||
sar.setVariables(sa.getRestrictions());
|
sar.setVariables(sa.getRestrictions());
|
||||||
sar.setZone(null);
|
sar.setZone(null);
|
||||||
newSA.setRestrictions(sar);
|
newSA.setRestrictions(sar);
|
||||||
final Cost cost = new Cost("", source.getName(), false);
|
final Cost cost = new Cost(source, "", false);
|
||||||
if (newSA.getPayCosts() != null) {
|
if (newSA.getPayCosts() != null) {
|
||||||
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
||||||
if (!(part instanceof CostMana)) {
|
if (!(part instanceof CostMana)) {
|
||||||
@@ -1399,7 +1399,7 @@ public class GameAction {
|
|||||||
sar.setVariables(sa.getRestrictions());
|
sar.setVariables(sa.getRestrictions());
|
||||||
sar.setInstantSpeed(true);
|
sar.setInstantSpeed(true);
|
||||||
newSA.setRestrictions(sar);
|
newSA.setRestrictions(sar);
|
||||||
final Cost cost = new Cost("", source.getName(), false);
|
final Cost cost = new Cost(source, "", false);
|
||||||
if (newSA.getPayCosts() != null) {
|
if (newSA.getPayCosts() != null) {
|
||||||
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
||||||
if (!(part instanceof CostMana)) {
|
if (!(part instanceof CostMana)) {
|
||||||
@@ -1415,7 +1415,7 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
if (sa.isSpell() && keyword.startsWith("Alternative Cost")) {
|
if (sa.isSpell() && keyword.startsWith("Alternative Cost")) {
|
||||||
final SpellAbility newSA = sa.copy();
|
final SpellAbility newSA = sa.copy();
|
||||||
final Cost cost = new Cost(keyword.substring(17), source.getName(), false);
|
final Cost cost = new Cost(source, keyword.substring(17), false);
|
||||||
if (newSA.getPayCosts() != null) {
|
if (newSA.getPayCosts() != null) {
|
||||||
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
||||||
if (!(part instanceof CostMana)) {
|
if (!(part instanceof CostMana)) {
|
||||||
@@ -2273,7 +2273,7 @@ public class GameAction {
|
|||||||
final TargetSelection ts = new TargetSelection(sa.getTarget(), sa);
|
final TargetSelection ts = new TargetSelection(sa.getTarget(), sa);
|
||||||
CostPayment payment = null;
|
CostPayment payment = null;
|
||||||
if (sa.getPayCosts() == null) {
|
if (sa.getPayCosts() == null) {
|
||||||
payment = new CostPayment(new Cost("0", sa.getSourceCard().getName(), sa.isAbility()), sa);
|
payment = new CostPayment(new Cost(sa.getSourceCard(), "0", sa.isAbility()), sa);
|
||||||
} else {
|
} else {
|
||||||
payment = new CostPayment(sa.getPayCosts(), sa);
|
payment = new CostPayment(sa.getPayCosts(), sa);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ public class AbilityFactory {
|
|||||||
if (!this.mapParams.containsKey("Cost")) {
|
if (!this.mapParams.containsKey("Cost")) {
|
||||||
throw new RuntimeException("AbilityFactory : getAbility -- no Cost in " + hostCard.getName());
|
throw new RuntimeException("AbilityFactory : getAbility -- no Cost in " + hostCard.getName());
|
||||||
}
|
}
|
||||||
this.abCost = new Cost(this.mapParams.get("Cost"), hostCard.getName(), this.isAb);
|
this.abCost = new Cost(hostCard, this.mapParams.get("Cost"), this.isAb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mapParams.containsKey("ValidTgts")) {
|
if (this.mapParams.containsKey("ValidTgts")) {
|
||||||
@@ -2600,7 +2600,7 @@ public class AbilityFactory {
|
|||||||
if (unlessCost.equals("X")) {
|
if (unlessCost.equals("X")) {
|
||||||
unlessCost = Integer.toString(AbilityFactory.calculateAmount(source, params.get("UnlessCost"), sa));
|
unlessCost = Integer.toString(AbilityFactory.calculateAmount(source, params.get("UnlessCost"), sa));
|
||||||
}
|
}
|
||||||
final Cost cost = new Cost(unlessCost, source.getName(), true);
|
final Cost cost = new Cost(source, unlessCost, true);
|
||||||
|
|
||||||
final SpellAbility ability = new AbilityActivated(source, cost, null) {
|
final SpellAbility ability = new AbilityActivated(source, cost, null) {
|
||||||
private static final long serialVersionUID = 2502577469482777440L;
|
private static final long serialVersionUID = 2502577469482777440L;
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public class AbilityFactoryMana {
|
|||||||
|
|
||||||
private final AbilityFactory af = abilityFactory;
|
private final AbilityFactory af = abilityFactory;
|
||||||
// To get the mana to resolve properly, we need the spell to contain an AbilityMana
|
// To get the mana to resolve properly, we need the spell to contain an AbilityMana
|
||||||
private final Cost tmp = new Cost("0", abilityFactory.getHostCard().getName(), false);
|
private final Cost tmp = new Cost(abilityFactory.getHostCard(), "0", false);
|
||||||
private final AbilityMana tmpMana = new AbilityMana(abilityFactory.getHostCard(), this.tmp, produced) {
|
private final AbilityMana tmpMana = new AbilityMana(abilityFactory.getHostCard(), this.tmp, produced) {
|
||||||
private static final long serialVersionUID = 1454043766057140491L;
|
private static final long serialVersionUID = 1454043766057140491L;
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ public class AbilityFactoryMana {
|
|||||||
|
|
||||||
private final AbilityFactory af = abilityFactory;
|
private final AbilityFactory af = abilityFactory;
|
||||||
// To get the mana to resolve properly, we need the spell to contain an AbilityMana
|
// To get the mana to resolve properly, we need the spell to contain an AbilityMana
|
||||||
private final Cost tmp = new Cost("0", abilityFactory.getHostCard().getName(), false);
|
private final Cost tmp = new Cost(abilityFactory.getHostCard(), "0", false);
|
||||||
private final AbilityMana tmpMana = new AbilityMana(abilityFactory.getHostCard(), this.tmp, produced) {
|
private final AbilityMana tmpMana = new AbilityMana(abilityFactory.getHostCard(), this.tmp, produced) {
|
||||||
private static final long serialVersionUID = 1454043766057140491L;
|
private static final long serialVersionUID = 1454043766057140491L;
|
||||||
|
|
||||||
@@ -507,7 +507,7 @@ public class AbilityFactoryMana {
|
|||||||
|
|
||||||
private final AbilityFactory af = abilityFactory;
|
private final AbilityFactory af = abilityFactory;
|
||||||
// To get the mana to resolve properly, we need the spell to contain an AbilityMana
|
// To get the mana to resolve properly, we need the spell to contain an AbilityMana
|
||||||
private final Cost tmp = new Cost("0", abilityFactory.getHostCard().getName(), false);
|
private final Cost tmp = new Cost(abilityFactory.getHostCard(), "0", false);
|
||||||
private final AbilityMana tmpMana = new AbilityMana(abilityFactory.getHostCard(), this.tmp, produced) {
|
private final AbilityMana tmpMana = new AbilityMana(abilityFactory.getHostCard(), this.tmp, produced) {
|
||||||
private static final long serialVersionUID = 1454043766057140491L;
|
private static final long serialVersionUID = 1454043766057140491L;
|
||||||
|
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ public final class AbilityFactoryPlay {
|
|||||||
if (params.containsKey("WithoutManaCost")) {
|
if (params.containsKey("WithoutManaCost")) {
|
||||||
if (controller.isHuman()) {
|
if (controller.isHuman()) {
|
||||||
final SpellAbility newSA = tgtSA.copy();
|
final SpellAbility newSA = tgtSA.copy();
|
||||||
final Cost cost = new Cost("", tgtCard.getName(), false);
|
final Cost cost = new Cost(tgtCard, "", false);
|
||||||
if (newSA.getPayCosts() != null) {
|
if (newSA.getPayCosts() != null) {
|
||||||
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
||||||
if (!(part instanceof CostMana)) {
|
if (!(part instanceof CostMana)) {
|
||||||
|
|||||||
@@ -595,7 +595,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
final String col = color;
|
final String col = color;
|
||||||
// card.setChosenType(input[0]);
|
// card.setChosenType(input[0]);
|
||||||
|
|
||||||
final Cost a1Cost = new Cost("3 T", cardName, true);
|
final Cost a1Cost = new Cost(card, "3 T", true);
|
||||||
final AbilityActivated a1 = new AbilityActivated(card, a1Cost, null) {
|
final AbilityActivated a1 = new AbilityActivated(card, a1Cost, null) {
|
||||||
|
|
||||||
private static final long serialVersionUID = -2114111483117171609L;
|
private static final long serialVersionUID = -2114111483117171609L;
|
||||||
@@ -844,7 +844,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Goblin Charbelcher")) {
|
else if (cardName.equals("Goblin Charbelcher")) {
|
||||||
final Cost abCost = new Cost("3 T", cardName, true);
|
final Cost abCost = new Cost(card, "3 T", true);
|
||||||
final AbilityActivated ability = new AbilityActivated(card, abCost, new Target(card, "TgtCP")) {
|
final AbilityActivated ability = new AbilityActivated(card, abCost, new Target(card, "TgtCP")) {
|
||||||
private static final long serialVersionUID = -840041589720758423L;
|
private static final long serialVersionUID = -840041589720758423L;
|
||||||
|
|
||||||
@@ -914,7 +914,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
* next turn's upkeep.
|
* next turn's upkeep.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final Cost abCost = new Cost("1 T Sac<1/CARDNAME>", cardName, true);
|
final Cost abCost = new Cost(card, "1 T Sac<1/CARDNAME>", true);
|
||||||
final Target target = new Target(card, "Select target player", new String[] { "Player" });
|
final Target target = new Target(card, "Select target player", new String[] { "Player" });
|
||||||
final AbilityActivated ability = new AbilityActivated(card, abCost, target) {
|
final AbilityActivated ability = new AbilityActivated(card, abCost, target) {
|
||||||
private static final long serialVersionUID = -6711849408085138636L;
|
private static final long serialVersionUID = -6711849408085138636L;
|
||||||
@@ -996,7 +996,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Grindstone")) {
|
else if (cardName.equals("Grindstone")) {
|
||||||
final Target target = new Target(card, "Select target player", new String[] { "Player" });
|
final Target target = new Target(card, "Select target player", new String[] { "Player" });
|
||||||
final Cost abCost = new Cost("3 T", cardName, true);
|
final Cost abCost = new Cost(card, "3 T", true);
|
||||||
final AbilityActivated ab1 = new AbilityActivated(card, abCost, target) {
|
final AbilityActivated ab1 = new AbilityActivated(card, abCost, target) {
|
||||||
private static final long serialVersionUID = -6281219446216L;
|
private static final long serialVersionUID = -6281219446216L;
|
||||||
|
|
||||||
@@ -1094,7 +1094,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Scroll Rack")) {
|
else if (cardName.equals("Scroll Rack")) {
|
||||||
final Cost abCost = new Cost("1 T", cardName, true);
|
final Cost abCost = new Cost(card, "1 T", true);
|
||||||
final AbilityActivated ability = new AbilityActivated(card, abCost, null) {
|
final AbilityActivated ability = new AbilityActivated(card, abCost, null) {
|
||||||
private static final long serialVersionUID = -5588587187720068547L;
|
private static final long serialVersionUID = -5588587187720068547L;
|
||||||
|
|
||||||
@@ -1234,7 +1234,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
sb.append(cardName).append(" - play card without paying its mana cost.");
|
sb.append(cardName).append(" - play card without paying its mana cost.");
|
||||||
freeCast.setStackDescription(sb.toString());
|
freeCast.setStackDescription(sb.toString());
|
||||||
|
|
||||||
final Cost abCost = new Cost("5 T", cardName, true);
|
final Cost abCost = new Cost(card, "5 T", true);
|
||||||
final AbilityActivated ability = new AbilityActivated(card, abCost, null) {
|
final AbilityActivated ability = new AbilityActivated(card, abCost, null) {
|
||||||
private static final long serialVersionUID = -7328518969488588777L;
|
private static final long serialVersionUID = -7328518969488588777L;
|
||||||
|
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ class CardFactoryAuras {
|
|||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Earthbind")) {
|
else if (cardName.equals("Earthbind")) {
|
||||||
final Cost cost = new Cost(card.getManaCost(), cardName, false);
|
final Cost cost = new Cost(card, card.getManaCost(), false);
|
||||||
final Target tgt = new Target(card, "C");
|
final Target tgt = new Target(card, "C");
|
||||||
final SpellAbility spell = new SpellPermanent(card, cost, tgt) {
|
final SpellAbility spell = new SpellPermanent(card, cost, tgt) {
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@ class CardFactoryAuras {
|
|||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Guilty Conscience")) {
|
else if (cardName.equals("Guilty Conscience")) {
|
||||||
final Cost cost = new Cost(card.getManaCost(), cardName, false);
|
final Cost cost = new Cost(card, card.getManaCost(), false);
|
||||||
final Target tgt = new Target(card, "C");
|
final Target tgt = new Target(card, "C");
|
||||||
final SpellAbility spell = new SpellPermanent(card, cost, tgt) {
|
final SpellAbility spell = new SpellPermanent(card, cost, tgt) {
|
||||||
|
|
||||||
@@ -461,7 +461,7 @@ class CardFactoryAuras {
|
|||||||
tgt.setZone(Constant.Zone.Graveyard);
|
tgt.setZone(Constant.Zone.Graveyard);
|
||||||
animate.setTarget(tgt);
|
animate.setTarget(tgt);
|
||||||
|
|
||||||
final Cost cost = new Cost("1 B", cardName, false);
|
final Cost cost = new Cost(card, "1 B", false);
|
||||||
animate.setPayCosts(cost);
|
animate.setPayCosts(cost);
|
||||||
|
|
||||||
animate.getRestrictions().setZone(Constant.Zone.Hand);
|
animate.getRestrictions().setZone(Constant.Zone.Hand);
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ public class CardFactoryCreatures {
|
|||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Gilder Bairn")) {
|
else if (cardName.equals("Gilder Bairn")) {
|
||||||
final Cost abCost = new Cost("2 GU Untap", cardName, true);
|
final Cost abCost = new Cost(card, "2 GU Untap", true);
|
||||||
final Target tgt = new Target(card, "Select target permanent.", new String[] { "Permanent" });
|
final Target tgt = new Target(card, "Select target permanent.", new String[] { "Permanent" });
|
||||||
final AbilityActivated a1 = new AbilityActivated(card, abCost, tgt) {
|
final AbilityActivated a1 = new AbilityActivated(card, abCost, tgt) {
|
||||||
private static final long serialVersionUID = -1847685865277129366L;
|
private static final long serialVersionUID = -1847685865277129366L;
|
||||||
@@ -717,7 +717,7 @@ public class CardFactoryCreatures {
|
|||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Rhys the Redeemed")) {
|
else if (cardName.equals("Rhys the Redeemed")) {
|
||||||
|
|
||||||
final Cost abCost = new Cost("4 GW GW T", card.getName(), true);
|
final Cost abCost = new Cost(card, "4 GW GW T", true);
|
||||||
final AbilityActivated copyTokens1 = new AbilityActivated(card, abCost, null) {
|
final AbilityActivated copyTokens1 = new AbilityActivated(card, abCost, null) {
|
||||||
private static final long serialVersionUID = 6297992502069547478L;
|
private static final long serialVersionUID = 6297992502069547478L;
|
||||||
|
|
||||||
@@ -824,7 +824,7 @@ public class CardFactoryCreatures {
|
|||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Master of the Wild Hunt")) {
|
else if (cardName.equals("Master of the Wild Hunt")) {
|
||||||
|
|
||||||
final Cost abCost = new Cost("T", cardName, true);
|
final Cost abCost = new Cost(card, "T", true);
|
||||||
final Target abTgt = new Target(card, "Target a creature to Hunt", "Creature".split(","));
|
final Target abTgt = new Target(card, "Target a creature to Hunt", "Creature".split(","));
|
||||||
final AbilityActivated ability = new AbilityActivated(card, abCost, abTgt) {
|
final AbilityActivated ability = new AbilityActivated(card, abCost, abTgt) {
|
||||||
private static final long serialVersionUID = 35050145102566898L;
|
private static final long serialVersionUID = 35050145102566898L;
|
||||||
@@ -1015,7 +1015,7 @@ public class CardFactoryCreatures {
|
|||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Molten Hydra")) {
|
else if (cardName.equals("Molten Hydra")) {
|
||||||
final Target target = new Target(card, "TgtCP");
|
final Target target = new Target(card, "TgtCP");
|
||||||
final Cost abCost = new Cost("T", cardName, true);
|
final Cost abCost = new Cost(card, "T", true);
|
||||||
final AbilityActivated ability2 = new AbilityActivated(card, abCost, target) {
|
final AbilityActivated ability2 = new AbilityActivated(card, abCost, target) {
|
||||||
private static final long serialVersionUID = 2626619319289064289L;
|
private static final long serialVersionUID = 2626619319289064289L;
|
||||||
|
|
||||||
@@ -1374,7 +1374,7 @@ public class CardFactoryCreatures {
|
|||||||
* permanent.
|
* permanent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final Cost cost = new Cost("Sac<1/CARDNAME>", cardName, true);
|
final Cost cost = new Cost(card, "Sac<1/CARDNAME>", true);
|
||||||
final Target tgt = new Target(card, "Select a permanent", "Permanent".split(","));
|
final Target tgt = new Target(card, "Select a permanent", "Permanent".split(","));
|
||||||
final SpellAbility ability = new AbilityActivated(card, cost, tgt) {
|
final SpellAbility ability = new AbilityActivated(card, cost, tgt) {
|
||||||
private static final long serialVersionUID = -5084369399105353155L;
|
private static final long serialVersionUID = -5084369399105353155L;
|
||||||
@@ -1569,7 +1569,7 @@ public class CardFactoryCreatures {
|
|||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Phyrexian Scuta")) {
|
else if (cardName.equals("Phyrexian Scuta")) {
|
||||||
final Cost abCost = new Cost("3 B PayLife<3>", cardName, false);
|
final Cost abCost = new Cost(card, "3 B PayLife<3>", false);
|
||||||
final SpellAbility kicker = new Spell(card, abCost, null) {
|
final SpellAbility kicker = new Spell(card, abCost, null) {
|
||||||
private static final long serialVersionUID = -6420757044982294960L;
|
private static final long serialVersionUID = -6420757044982294960L;
|
||||||
|
|
||||||
@@ -2006,7 +2006,7 @@ public class CardFactoryCreatures {
|
|||||||
* name revealed this way. Activate this ability only during your
|
* name revealed this way. Activate this ability only during your
|
||||||
* turn.
|
* turn.
|
||||||
*/
|
*/
|
||||||
final Cost abCost = new Cost("X T", cardName, true);
|
final Cost abCost = new Cost(card, "X T", true);
|
||||||
final Target target = new Target(card, "Select target opponent", "Opponent".split(","));
|
final Target target = new Target(card, "Select target opponent", "Opponent".split(","));
|
||||||
final AbilityActivated discard = new AbilityActivated(card, abCost, target) {
|
final AbilityActivated discard = new AbilityActivated(card, abCost, target) {
|
||||||
private static final long serialVersionUID = 4839778470534392198L;
|
private static final long serialVersionUID = 4839778470534392198L;
|
||||||
@@ -2074,7 +2074,7 @@ public class CardFactoryCreatures {
|
|||||||
theCost = "R";
|
theCost = "R";
|
||||||
}
|
}
|
||||||
|
|
||||||
final SpellAbility finalAb = new AbilityActivated(card, new Cost(theCost, cardName, true), new Target(card,
|
final SpellAbility finalAb = new AbilityActivated(card, new Cost(card, theCost, true), new Target(card,
|
||||||
"Select target creature.", "Creature")) {
|
"Select target creature.", "Creature")) {
|
||||||
private static final long serialVersionUID = 2391351140880148283L;
|
private static final long serialVersionUID = 2391351140880148283L;
|
||||||
|
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ class CardFactoryEquipment {
|
|||||||
// keywords to add
|
// keywords to add
|
||||||
|
|
||||||
// final String manaCost = tmpCost.trim();
|
// final String manaCost = tmpCost.trim();
|
||||||
final Cost abCost = new Cost(tmpCost.trim(), card.getName(), true);
|
final Cost abCost = new Cost(card, tmpCost.trim(), true);
|
||||||
int power = 0;
|
int power = 0;
|
||||||
int tough = 0;
|
int tough = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ public class CardFactoryInstants {
|
|||||||
* Return all artifacts target player owns to his or her hand.
|
* Return all artifacts target player owns to his or her hand.
|
||||||
*/
|
*/
|
||||||
Target t = new Target(card, "Select target player", "Player");
|
Target t = new Target(card, "Select target player", "Player");
|
||||||
Cost cost = new Cost("1 U", cardName, false);
|
Cost cost = new Cost(card, "1 U", false);
|
||||||
|
|
||||||
SpellAbility spell = new Spell(card, cost, t) {
|
SpellAbility spell = new Spell(card, cost, t) {
|
||||||
private static final long serialVersionUID = -4098702062413878046L;
|
private static final long serialVersionUID = -4098702062413878046L;
|
||||||
@@ -385,7 +385,7 @@ public class CardFactoryInstants {
|
|||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Suffer the Past")) {
|
else if (cardName.equals("Suffer the Past")) {
|
||||||
final Cost cost = new Cost("X B", cardName, false);
|
final Cost cost = new Cost(card, "X B", false);
|
||||||
final Target tgt = new Target(card, "Select a Player", "Player");
|
final Target tgt = new Target(card, "Select a Player", "Player");
|
||||||
final SpellAbility spell = new Spell(card, cost, tgt) {
|
final SpellAbility spell = new Spell(card, cost, tgt) {
|
||||||
private static final long serialVersionUID = 1168802375190293222L;
|
private static final long serialVersionUID = 1168802375190293222L;
|
||||||
@@ -627,7 +627,7 @@ public class CardFactoryInstants {
|
|||||||
* of the chosen type target player controls, or untap all tapped
|
* of the chosen type target player controls, or untap all tapped
|
||||||
* permanents of that type that player controls.
|
* permanents of that type that player controls.
|
||||||
*/
|
*/
|
||||||
final Cost abCost = new Cost("2 U U", cardName, false);
|
final Cost abCost = new Cost(card, "2 U U", false);
|
||||||
final Target target = new Target(card, "Select target player", "Player".split(","));
|
final Target target = new Target(card, "Select target player", "Player".split(","));
|
||||||
final SpellAbility spell = new Spell(card, abCost, target) {
|
final SpellAbility spell = new Spell(card, abCost, target) {
|
||||||
private static final long serialVersionUID = -2175586347805121896L;
|
private static final long serialVersionUID = -2175586347805121896L;
|
||||||
@@ -689,7 +689,7 @@ public class CardFactoryInstants {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
final Cost abCost = new Cost("G", cardName, false);
|
final Cost abCost = new Cost(card, "G", false);
|
||||||
final Target t1 = new Target(card, "Select target creature you control", "Creature.YouCtrl".split(","));
|
final Target t1 = new Target(card, "Select target creature you control", "Creature.YouCtrl".split(","));
|
||||||
final SpellAbility spell = new Spell(card, abCost, t1) {
|
final SpellAbility spell = new Spell(card, abCost, t1) {
|
||||||
private static final long serialVersionUID = 8964235807056739219L;
|
private static final long serialVersionUID = 8964235807056739219L;
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ class CardFactoryLands {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
final Cost abCost = new Cost("G U T", cardName, true);
|
final Cost abCost = new Cost(card, "G U T", true);
|
||||||
final AbilityActivated ability = new AbilityActivated(card, abCost, null) {
|
final AbilityActivated ability = new AbilityActivated(card, abCost, null) {
|
||||||
private static final long serialVersionUID = 1416258136308898492L;
|
private static final long serialVersionUID = 1416258136308898492L;
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public class CardFactoryPlaneswalkers {
|
|||||||
* battlefield.
|
* battlefield.
|
||||||
*/
|
*/
|
||||||
final Target target2 = new Target(card, "TgtC");
|
final Target target2 = new Target(card, "TgtC");
|
||||||
final Cost cost2 = new Cost("SubCounter<2/LOYALTY>", cardName, true);
|
final Cost cost2 = new Cost(card, "SubCounter<2/LOYALTY>", true);
|
||||||
final SpellAbility ability2 = new AbilityActivated(card, cost2, target2) {
|
final SpellAbility ability2 = new AbilityActivated(card, cost2, target2) {
|
||||||
private static final long serialVersionUID = 4322453486268967722L;
|
private static final long serialVersionUID = 4322453486268967722L;
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ public class CardFactoryPlaneswalkers {
|
|||||||
* power to target player.
|
* power to target player.
|
||||||
*/
|
*/
|
||||||
final Target target3 = new Target(card, "Select target player", "Player");
|
final Target target3 = new Target(card, "Select target player", "Player");
|
||||||
final Cost cost3 = new Cost("SubCounter<4/LOYALTY>", cardName, true);
|
final Cost cost3 = new Cost(card, "SubCounter<4/LOYALTY>", true);
|
||||||
final SpellAbility ability3 = new AbilityActivated(card, cost3, target3) {
|
final SpellAbility ability3 = new AbilityActivated(card, cost3, target3) {
|
||||||
private static final long serialVersionUID = -5488579738767048060L;
|
private static final long serialVersionUID = -5488579738767048060L;
|
||||||
|
|
||||||
|
|||||||
@@ -437,7 +437,7 @@ public class CardFactorySorceries {
|
|||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Martial Coup")) {
|
else if (cardName.equals("Martial Coup")) {
|
||||||
|
|
||||||
final Cost cost = new Cost(card.getManaCost(), cardName, false);
|
final Cost cost = new Cost(card, card.getManaCost(), false);
|
||||||
final SpellAbility spell = new Spell(card, cost, null) {
|
final SpellAbility spell = new Spell(card, cost, null) {
|
||||||
|
|
||||||
private static final long serialVersionUID = -29101524966207L;
|
private static final long serialVersionUID = -29101524966207L;
|
||||||
@@ -702,7 +702,7 @@ public class CardFactorySorceries {
|
|||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Haunting Echoes")) {
|
else if (cardName.equals("Haunting Echoes")) {
|
||||||
final Cost cost = new Cost("3 B B", cardName, false);
|
final Cost cost = new Cost(card, "3 B B", false);
|
||||||
final Target tgt = new Target(card, "Select a Player", "Player");
|
final Target tgt = new Target(card, "Select a Player", "Player");
|
||||||
final SpellAbility spell = new Spell(card, cost, tgt) {
|
final SpellAbility spell = new Spell(card, cost, tgt) {
|
||||||
private static final long serialVersionUID = 42470566751344693L;
|
private static final long serialVersionUID = 42470566751344693L;
|
||||||
@@ -772,7 +772,7 @@ public class CardFactorySorceries {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
final Cost abCost = new Cost("2 U", cardName, false);
|
final Cost abCost = new Cost(card, "2 U", false);
|
||||||
final Target t1 = new Target(card, "Select target permanent", "Permanent".split(","));
|
final Target t1 = new Target(card, "Select target permanent", "Permanent".split(","));
|
||||||
final SpellAbility spell = new Spell(card, abCost, t1) {
|
final SpellAbility spell = new Spell(card, abCost, t1) {
|
||||||
private static final long serialVersionUID = 8964235802256739219L;
|
private static final long serialVersionUID = 8964235802256739219L;
|
||||||
@@ -1255,7 +1255,7 @@ public class CardFactorySorceries {
|
|||||||
* damage to that player.
|
* damage to that player.
|
||||||
*/
|
*/
|
||||||
final Target tgt = new Target(card, "Select target player", "Player");
|
final Target tgt = new Target(card, "Select target player", "Player");
|
||||||
final Cost cost = new Cost("1 W W", cardName, false);
|
final Cost cost = new Cost(card, "1 W W", false);
|
||||||
final SpellAbility spell = new Spell(card, cost, tgt) {
|
final SpellAbility spell = new Spell(card, cost, tgt) {
|
||||||
private static final long serialVersionUID = 8555498267738686288L;
|
private static final long serialVersionUID = 8555498267738686288L;
|
||||||
|
|
||||||
@@ -1903,7 +1903,7 @@ public class CardFactorySorceries {
|
|||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Turn to Slag")) {
|
else if (cardName.equals("Turn to Slag")) {
|
||||||
final Cost abCost = new Cost("3 R R", cardName, false);
|
final Cost abCost = new Cost(card, "3 R R", false);
|
||||||
final Target target = new Target(card, "Select target creature", "Creature".split(","));
|
final Target target = new Target(card, "Select target creature", "Creature".split(","));
|
||||||
final SpellAbility spell = new Spell(card, abCost, target) {
|
final SpellAbility spell = new Spell(card, abCost, target) {
|
||||||
private static final long serialVersionUID = 3848014348910653252L;
|
private static final long serialVersionUID = 3848014348910653252L;
|
||||||
@@ -1946,7 +1946,7 @@ public class CardFactorySorceries {
|
|||||||
* library.
|
* library.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final Cost abCost = new Cost("U U", cardName, false);
|
final Cost abCost = new Cost(card, "U U", false);
|
||||||
final SpellAbility spell = new Spell(card, abCost, null) {
|
final SpellAbility spell = new Spell(card, abCost, null) {
|
||||||
private static final long serialVersionUID = -8497142072380944393L;
|
private static final long serialVersionUID = -8497142072380944393L;
|
||||||
|
|
||||||
|
|||||||
@@ -884,7 +884,7 @@ public class CardFactoryUtil {
|
|||||||
*/
|
*/
|
||||||
public static AbilityActivated abilityUnearth(final Card sourceCard, final String manaCost) {
|
public static AbilityActivated abilityUnearth(final Card sourceCard, final String manaCost) {
|
||||||
|
|
||||||
final Cost cost = new Cost(manaCost, sourceCard.getName(), true);
|
final Cost cost = new Cost(sourceCard, manaCost, true);
|
||||||
final AbilityActivated unearth = new AbilityActivated(sourceCard, cost, null) {
|
final AbilityActivated unearth = new AbilityActivated(sourceCard, cost, null) {
|
||||||
private static final long serialVersionUID = -5633945565395478009L;
|
private static final long serialVersionUID = -5633945565395478009L;
|
||||||
|
|
||||||
@@ -1025,7 +1025,7 @@ public class CardFactoryUtil {
|
|||||||
*/
|
*/
|
||||||
public static SpellAbility abilityCycle(final Card sourceCard, String cycleCost) {
|
public static SpellAbility abilityCycle(final Card sourceCard, String cycleCost) {
|
||||||
cycleCost += " Discard<1/CARDNAME>";
|
cycleCost += " Discard<1/CARDNAME>";
|
||||||
final Cost abCost = new Cost(cycleCost, sourceCard.getName(), true);
|
final Cost abCost = new Cost(sourceCard, cycleCost, true);
|
||||||
|
|
||||||
final SpellAbility cycle = new AbilityActivated(sourceCard, abCost, null) {
|
final SpellAbility cycle = new AbilityActivated(sourceCard, abCost, null) {
|
||||||
private static final long serialVersionUID = -4960704261761785512L;
|
private static final long serialVersionUID = -4960704261761785512L;
|
||||||
@@ -1095,7 +1095,7 @@ public class CardFactoryUtil {
|
|||||||
public static SpellAbility abilityTypecycle(final Card sourceCard, String cycleCost, final String type) {
|
public static SpellAbility abilityTypecycle(final Card sourceCard, String cycleCost, final String type) {
|
||||||
String description;
|
String description;
|
||||||
cycleCost += " Discard<1/CARDNAME>";
|
cycleCost += " Discard<1/CARDNAME>";
|
||||||
final Cost abCost = new Cost(cycleCost, sourceCard.getName(), true);
|
final Cost abCost = new Cost(sourceCard, cycleCost, true);
|
||||||
|
|
||||||
final SpellAbility cycle = new AbilityActivated(sourceCard, abCost, null) {
|
final SpellAbility cycle = new AbilityActivated(sourceCard, abCost, null) {
|
||||||
private static final long serialVersionUID = -4960704261761785512L;
|
private static final long serialVersionUID = -4960704261761785512L;
|
||||||
@@ -1180,7 +1180,7 @@ public class CardFactoryUtil {
|
|||||||
*/
|
*/
|
||||||
public static SpellAbility abilityTransmute(final Card sourceCard, String transmuteCost) {
|
public static SpellAbility abilityTransmute(final Card sourceCard, String transmuteCost) {
|
||||||
transmuteCost += " Discard<1/CARDNAME>";
|
transmuteCost += " Discard<1/CARDNAME>";
|
||||||
final Cost abCost = new Cost(transmuteCost, sourceCard.getName(), true);
|
final Cost abCost = new Cost(sourceCard, transmuteCost, true);
|
||||||
|
|
||||||
final SpellAbility transmute = new AbilityActivated(sourceCard, abCost, null) {
|
final SpellAbility transmute = new AbilityActivated(sourceCard, abCost, null) {
|
||||||
private static final long serialVersionUID = -4960704261761785512L;
|
private static final long serialVersionUID = -4960704261761785512L;
|
||||||
@@ -1516,7 +1516,7 @@ public class CardFactoryUtil {
|
|||||||
* @return a {@link forge.card.spellability.AbilityMana} object.
|
* @return a {@link forge.card.spellability.AbilityMana} object.
|
||||||
*/
|
*/
|
||||||
public static AbilityMana getEldraziSpawnAbility(final Card c) {
|
public static AbilityMana getEldraziSpawnAbility(final Card c) {
|
||||||
final Cost cost = new Cost("Sac<1/CARDNAME>", c.getName(), true);
|
final Cost cost = new Cost(c, "Sac<1/CARDNAME>", true);
|
||||||
final AbilityMana mana = new AbilityMana(c, cost, "1") {
|
final AbilityMana mana = new AbilityMana(c, cost, "1") {
|
||||||
private static final long serialVersionUID = -2478676548112738019L;
|
private static final long serialVersionUID = -2478676548112738019L;
|
||||||
};
|
};
|
||||||
@@ -4216,7 +4216,7 @@ public class CardFactoryUtil {
|
|||||||
final String newCost = CardUtil.addManaCosts(card.getManaCost(), bbCost);
|
final String newCost = CardUtil.addManaCosts(card.getManaCost(), bbCost);
|
||||||
if (bbSA.getPayCosts() != null) {
|
if (bbSA.getPayCosts() != null) {
|
||||||
// create new Cost
|
// create new Cost
|
||||||
bbSA.setPayCosts(new Cost(newCost, sa.getSourceCard().getName(), false));
|
bbSA.setPayCosts(new Cost(card, newCost, false));
|
||||||
}
|
}
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Buyback ").append(bbCost).append(" (You may pay an additional ").append(bbCost);
|
sb.append("Buyback ").append(bbCost).append(" (You may pay an additional ").append(bbCost);
|
||||||
@@ -4580,7 +4580,7 @@ public class CardFactoryUtil {
|
|||||||
final SpellAbility[] abilities = card.getSpellAbility();
|
final SpellAbility[] abilities = card.getSpellAbility();
|
||||||
if ((abilities.length > 0) && abilities[0].isSpell()) {
|
if ((abilities.length > 0) && abilities[0].isSpell()) {
|
||||||
final String altCost = card.getSVar("FullCost");
|
final String altCost = card.getSVar("FullCost");
|
||||||
final Cost abCost = new Cost(altCost, card.getName(), abilities[0].isAbility());
|
final Cost abCost = new Cost(card, altCost, abilities[0].isAbility());
|
||||||
abilities[0].setPayCosts(abCost);
|
abilities[0].setPayCosts(abCost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4624,7 +4624,7 @@ public class CardFactoryUtil {
|
|||||||
final SpellAbility sa = abilities[0];
|
final SpellAbility sa = abilities[0];
|
||||||
final SpellAbility altCostSA = sa.copy();
|
final SpellAbility altCostSA = sa.copy();
|
||||||
|
|
||||||
final Cost abCost = new Cost(altCost, card.getName(), altCostSA.isAbility());
|
final Cost abCost = new Cost(card, altCost, altCostSA.isAbility());
|
||||||
altCostSA.setPayCosts(abCost);
|
altCostSA.setPayCosts(abCost);
|
||||||
|
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
@@ -5052,7 +5052,7 @@ public class CardFactoryUtil {
|
|||||||
card.setCanMorph(true);
|
card.setCanMorph(true);
|
||||||
|
|
||||||
final String[] k = parse.split(":");
|
final String[] k = parse.split(":");
|
||||||
final Cost cost = new Cost(k[1], cardName, true);
|
final Cost cost = new Cost(card, k[1], true);
|
||||||
|
|
||||||
final int attack = card.getBaseAttack();
|
final int attack = card.getBaseAttack();
|
||||||
final int defense = card.getBaseDefense();
|
final int defense = card.getBaseDefense();
|
||||||
|
|||||||
@@ -148,18 +148,17 @@ public class Cost {
|
|||||||
* <p>
|
* <p>
|
||||||
* Constructor for Cost.
|
* Constructor for Cost.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
* @param card
|
||||||
|
* a Card object that the Cost is associated with
|
||||||
* @param parse
|
* @param parse
|
||||||
* a {@link java.lang.String} object.
|
* a {@link java.lang.String} object.
|
||||||
* @param cardName
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
* @param bAbility
|
* @param bAbility
|
||||||
* a boolean.
|
* a boolean.
|
||||||
*/
|
*/
|
||||||
public Cost(String parse, final String cardName, final boolean bAbility) {
|
public Cost(final Card card, String parse, final boolean bAbility) {
|
||||||
this.isAbility = bAbility;
|
this.isAbility = bAbility;
|
||||||
// when adding new costs for cost string, place them here
|
// when adding new costs for cost string, place them here
|
||||||
this.name = cardName;
|
this.name = card.getName();
|
||||||
|
|
||||||
while (parse.contains(Cost.TAP_X_STR)) {
|
while (parse.contains(Cost.TAP_X_STR)) {
|
||||||
final String[] splitStr = this.abCostParse(parse, Cost.TAP_X_STR, 3);
|
final String[] splitStr = this.abCostParse(parse, Cost.TAP_X_STR, 3);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
|
|||||||
* a {@link java.lang.String} object.
|
* a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public AbilityActivated(final Card card, final String manacost) {
|
public AbilityActivated(final Card card, final String manacost) {
|
||||||
this(card, new Cost(manacost, card.getName(), true), null);
|
this(card, new Cost(card, manacost, true), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public abstract class AbilityMana extends AbilityActivated implements java.io.Se
|
|||||||
* a int.
|
* a int.
|
||||||
*/
|
*/
|
||||||
public AbilityMana(final Card sourceCard, final String parse, final String produced, final int num) {
|
public AbilityMana(final Card sourceCard, final String parse, final String produced, final int num) {
|
||||||
this(sourceCard, new Cost(parse, sourceCard.getName(), true), produced, num);
|
this(sourceCard, new Cost(sourceCard, parse, true), produced, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ public class SpellPermanent extends Spell {
|
|||||||
*/
|
*/
|
||||||
public SpellPermanent(final Card sourceCard) {
|
public SpellPermanent(final Card sourceCard) {
|
||||||
// Add Costs for all SpellPermanents
|
// Add Costs for all SpellPermanents
|
||||||
this(sourceCard, new Cost(sourceCard.getManaCost(), sourceCard.getName(), false), null);
|
this(sourceCard, new Cost(sourceCard, sourceCard.getManaCost(), false), null);
|
||||||
} // Spell_Permanent()
|
} // Spell_Permanent()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user