mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Merged the two payCostDuringAbilityResolve functions into one.
- Added Phyrexian Soulgorger.
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -6917,6 +6917,7 @@ res/cardsfolder/p/phyrexian_revoker.txt -text
|
|||||||
res/cardsfolder/p/phyrexian_scuta.txt svneol=native#text/plain
|
res/cardsfolder/p/phyrexian_scuta.txt svneol=native#text/plain
|
||||||
res/cardsfolder/p/phyrexian_slayer.txt -text
|
res/cardsfolder/p/phyrexian_slayer.txt -text
|
||||||
res/cardsfolder/p/phyrexian_snowcrusher.txt svneol=native#text/plain
|
res/cardsfolder/p/phyrexian_snowcrusher.txt svneol=native#text/plain
|
||||||
|
res/cardsfolder/p/phyrexian_soulgorger.txt -text
|
||||||
res/cardsfolder/p/phyrexian_splicer.txt -text
|
res/cardsfolder/p/phyrexian_splicer.txt -text
|
||||||
res/cardsfolder/p/phyrexian_swarmlord.txt svneol=native#text/plain
|
res/cardsfolder/p/phyrexian_swarmlord.txt svneol=native#text/plain
|
||||||
res/cardsfolder/p/phyrexian_totem.txt svneol=native#text/plain
|
res/cardsfolder/p/phyrexian_totem.txt svneol=native#text/plain
|
||||||
|
|||||||
12
res/cardsfolder/p/phyrexian_soulgorger.txt
Normal file
12
res/cardsfolder/p/phyrexian_soulgorger.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
Name:Phyrexian Soulgorger
|
||||||
|
ManaCost:3
|
||||||
|
Types:Snow Artifact Creature Construct
|
||||||
|
Text:no text
|
||||||
|
PT:8/8
|
||||||
|
K:Cumulative upkeep:Sac<1/Creature>:Sacrifice a creature.
|
||||||
|
SVar:RemAIDeck:True
|
||||||
|
SVar:Rarity:Rare
|
||||||
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/phyrexian_soulgorger.jpg
|
||||||
|
SetInfo:CSP|Rare|http://magiccards.info/scans/en/cs/141.jpg
|
||||||
|
Oracle:Cumulative upkeep-Sacrifice a creature. (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.)
|
||||||
|
End
|
||||||
@@ -525,7 +525,7 @@ public class GameAction {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
if (recoverable.getController().isHuman()) {
|
if (recoverable.getController().isHuman()) {
|
||||||
GameActionUtil.payCostDuringAbilityResolve(sb.toString(), recoverable, recoverCost,
|
GameActionUtil.payCostDuringAbilityResolve(abRecover, abRecover.getPayCosts(),
|
||||||
paidCommand, unpaidCommand);
|
paidCommand, unpaidCommand);
|
||||||
} else { // computer
|
} else { // computer
|
||||||
if (ComputerUtil.canPayCost(abRecover)) {
|
if (ComputerUtil.canPayCost(abRecover)) {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import forge.card.cost.Cost;
|
|||||||
import forge.card.cost.CostPart;
|
import forge.card.cost.CostPart;
|
||||||
import forge.card.cost.CostPayLife;
|
import forge.card.cost.CostPayLife;
|
||||||
import forge.card.cost.CostMana;
|
import forge.card.cost.CostMana;
|
||||||
|
import forge.card.cost.CostPutCounter;
|
||||||
import forge.card.cost.CostSacrifice;
|
import forge.card.cost.CostSacrifice;
|
||||||
import forge.card.spellability.Ability;
|
import forge.card.spellability.Ability;
|
||||||
import forge.card.spellability.AbilityMana;
|
import forge.card.spellability.AbilityMana;
|
||||||
@@ -370,7 +371,7 @@ public final class GameActionUtil {
|
|||||||
* @param unpaid
|
* @param unpaid
|
||||||
* a {@link forge.Command} object.
|
* a {@link forge.Command} object.
|
||||||
*/
|
*/
|
||||||
public static void payCostDuringAbilityResolve(final String message, Card hostCard, final String manaCost,
|
/*public static void payCostDuringAbilityResolve(final String message, Card hostCard, final String manaCost,
|
||||||
final Command paid, final Command unpaid) {
|
final Command paid, final Command unpaid) {
|
||||||
if (manaCost.startsWith("PayLife")) {
|
if (manaCost.startsWith("PayLife")) {
|
||||||
String amountString = manaCost.split("<")[1].split(">")[0];
|
String amountString = manaCost.split("<")[1].split(">")[0];
|
||||||
@@ -422,7 +423,7 @@ public final class GameActionUtil {
|
|||||||
AllZone.getStack().setResolving(false);
|
AllZone.getStack().setResolving(false);
|
||||||
AllZone.getInputControl().setInput(new InputPayManaCostAbility(message, manaCost, paid, unpaid));
|
AllZone.getInputControl().setInput(new InputPayManaCostAbility(message, manaCost, paid, unpaid));
|
||||||
AllZone.getStack().setResolving(bResolving);
|
AllZone.getStack().setResolving(bResolving);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -443,9 +444,9 @@ public final class GameActionUtil {
|
|||||||
if (cost.getCostParts().size() > 1) {
|
if (cost.getCostParts().size() > 1) {
|
||||||
throw new RuntimeException("GameActionUtil::payCostDuringAbilityResolve - Too many payment types - " + source);
|
throw new RuntimeException("GameActionUtil::payCostDuringAbilityResolve - Too many payment types - " + source);
|
||||||
}
|
}
|
||||||
final CostPart unlessCost = cost.getCostParts().get(0);
|
final CostPart costPart = cost.getCostParts().get(0);
|
||||||
if (unlessCost instanceof CostPayLife) {
|
if (costPart instanceof CostPayLife) {
|
||||||
String amountString = unlessCost.getAmount();
|
String amountString = costPart.getAmount();
|
||||||
final int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString)
|
final int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString)
|
||||||
: CardFactoryUtil.xCount(source, source.getSVar(amountString));
|
: CardFactoryUtil.xCount(source, source.getSVar(amountString));
|
||||||
if (AllZone.getHumanPlayer().canPayLife(amount) && showYesNoDialog(source, "Do you want to pay "
|
if (AllZone.getHumanPlayer().canPayLife(amount) && showYesNoDialog(source, "Do you want to pay "
|
||||||
@@ -458,14 +459,36 @@ public final class GameActionUtil {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (unlessCost instanceof CostSacrifice) {
|
else if (costPart instanceof CostPutCounter) {
|
||||||
|
String amountString = costPart.getAmount();
|
||||||
|
Counters counterType = ((CostPutCounter) costPart).getCounter();
|
||||||
|
int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString)
|
||||||
|
: CardFactoryUtil.xCount(source, source.getSVar(amountString));
|
||||||
|
String plural = amount > 1 ? "s" : "";
|
||||||
|
if (showYesNoDialog(source, "Do you want to put " + amount + " " + counterType.getName()
|
||||||
|
+ " counter" + plural + " on " + source + "?")) {
|
||||||
|
if (source.canHaveCountersPlacedOnIt(counterType)) {
|
||||||
|
source.addCounterFromNonEffect(counterType, amount);
|
||||||
|
paid.execute();
|
||||||
|
} else {
|
||||||
|
unpaid.execute();
|
||||||
|
AllZone.getGameLog().add("ResolveStack", "Trying to pay upkeep for " + source + " but it can't have "
|
||||||
|
+ counterType.getName() + " counters put on it.", 2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unpaid.execute();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (costPart instanceof CostSacrifice) {
|
||||||
final boolean bResolving = AllZone.getStack().getResolving();
|
final boolean bResolving = AllZone.getStack().getResolving();
|
||||||
AllZone.getStack().setResolving(false);
|
AllZone.getStack().setResolving(false);
|
||||||
AllZone.getInputControl().setInput(new InputPaySacCost((CostSacrifice) unlessCost, ability, paid, unpaid));
|
AllZone.getInputControl().setInput(new InputPaySacCost((CostSacrifice) costPart, ability, paid, unpaid));
|
||||||
AllZone.getStack().setResolving(bResolving);
|
AllZone.getStack().setResolving(bResolving);
|
||||||
}
|
}
|
||||||
else if (unlessCost instanceof CostMana) {
|
else if (costPart instanceof CostMana) {
|
||||||
if (unlessCost.getAmount().equals("0")) {
|
if (costPart.getAmount().equals("0")) {
|
||||||
if (showYesNoDialog(source, "Do you want to pay 0?")) {
|
if (showYesNoDialog(source, "Do you want to pay 0?")) {
|
||||||
paid.execute();
|
paid.execute();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
final Ability aiPaid = Upkeep.upkeepAIPayment(c, c.getEchoCost());
|
final Ability blankAbility = Upkeep.BlankAbility(c, c.getEchoCost());
|
||||||
|
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Echo for ").append(c).append("\n");
|
sb.append("Echo for ").append(c).append("\n");
|
||||||
@@ -192,10 +192,10 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
public void resolve() {
|
public void resolve() {
|
||||||
if (c.getController().isHuman()) {
|
if (c.getController().isHuman()) {
|
||||||
Cost cost = new Cost(c, c.getEchoCost().trim(), true);
|
Cost cost = new Cost(c, c.getEchoCost().trim(), true);
|
||||||
GameActionUtil.payCostDuringAbilityResolve(aiPaid, cost, paidCommand, unpaidCommand);
|
GameActionUtil.payCostDuringAbilityResolve(blankAbility, cost, paidCommand, unpaidCommand);
|
||||||
} else { // computer
|
} else { // computer
|
||||||
if (ComputerUtil.canPayCost(aiPaid)) {
|
if (ComputerUtil.canPayCost(blankAbility)) {
|
||||||
ComputerUtil.playNoStack(aiPaid);
|
ComputerUtil.playNoStack(blankAbility);
|
||||||
} else {
|
} else {
|
||||||
Singletons.getModel().getGameAction().sacrifice(c, null);
|
Singletons.getModel().getGameAction().sacrifice(c, null);
|
||||||
}
|
}
|
||||||
@@ -302,7 +302,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
final Command paidCommand = Command.BLANK;
|
final Command paidCommand = Command.BLANK;
|
||||||
|
|
||||||
final Ability aiPaid = Upkeep.upkeepAIPayment(c, upkeepCost);
|
final Ability aiPaid = Upkeep.BlankAbility(c, upkeepCost);
|
||||||
|
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Upkeep for ").append(c).append("\n");
|
sb.append("Upkeep for ").append(c).append("\n");
|
||||||
@@ -362,17 +362,17 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
final Command paidCommand = Command.BLANK;
|
final Command paidCommand = Command.BLANK;
|
||||||
|
|
||||||
final Ability aiPaid = Upkeep.upkeepAIPayment(c, upkeepCost);
|
final Ability blankAbility = Upkeep.BlankAbility(c, upkeepCost);
|
||||||
|
|
||||||
final Ability upkeepAbility = new Ability(c, "0") {
|
final Ability upkeepAbility = new Ability(c, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
if (controller.isHuman()) {
|
if (controller.isHuman()) {
|
||||||
GameActionUtil.payCostDuringAbilityResolve(sb.toString(), c, upkeepCost, paidCommand,
|
GameActionUtil.payCostDuringAbilityResolve(blankAbility, blankAbility.getPayCosts(),
|
||||||
unpaidCommand);
|
paidCommand, unpaidCommand);
|
||||||
} else { // computer
|
} else { // computer
|
||||||
if (ComputerUtil.shouldPayCost(c, upkeepCost) && ComputerUtil.canPayCost(aiPaid)) {
|
if (ComputerUtil.shouldPayCost(c, upkeepCost) && ComputerUtil.canPayCost(blankAbility)) {
|
||||||
ComputerUtil.playNoStack(aiPaid);
|
ComputerUtil.playNoStack(blankAbility);
|
||||||
} else {
|
} else {
|
||||||
Singletons.getModel().getGameAction().sacrifice(c, null);
|
Singletons.getModel().getGameAction().sacrifice(c, null);
|
||||||
}
|
}
|
||||||
@@ -404,7 +404,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
final Command paidCommand = Command.BLANK;
|
final Command paidCommand = Command.BLANK;
|
||||||
|
|
||||||
final Ability aiPaid = Upkeep.upkeepAIPayment(c, upkeepCost);
|
final Ability aiPaid = Upkeep.BlankAbility(c, upkeepCost);
|
||||||
|
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Damage upkeep for ").append(c).append("\n");
|
sb.append("Damage upkeep for ").append(c).append("\n");
|
||||||
@@ -447,7 +447,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
* a {@link java.lang.String} object.
|
* a {@link java.lang.String} object.
|
||||||
* @return a {@link forge.card.spellability.Ability} object.
|
* @return a {@link forge.card.spellability.Ability} object.
|
||||||
*/
|
*/
|
||||||
private static Ability upkeepAIPayment(final Card c, final String costString) {
|
private static Ability BlankAbility(final Card c, final String costString) {
|
||||||
Cost cost = new Cost(c, costString, true);
|
Cost cost = new Cost(c, costString, true);
|
||||||
return new AbilityStatic(c, cost, null) {
|
return new AbilityStatic(c, cost, null) {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user