- Added Grave Consequences and Psychic Vortex

This commit is contained in:
swordshine
2013-06-09 05:20:15 +00:00
parent 82defd76ff
commit 6cb1fca434
6 changed files with 118 additions and 77 deletions

2
.gitattributes vendored
View File

@@ -4565,6 +4565,7 @@ res/cardsfolder/g/grasslands.txt svneol=native#text/plain
res/cardsfolder/g/gratuitous_violence.txt svneol=native#text/plain res/cardsfolder/g/gratuitous_violence.txt svneol=native#text/plain
res/cardsfolder/g/grave_betrayal.txt -text res/cardsfolder/g/grave_betrayal.txt -text
res/cardsfolder/g/grave_bramble.txt -text res/cardsfolder/g/grave_bramble.txt -text
res/cardsfolder/g/grave_consequences.txt -text
res/cardsfolder/g/grave_defiler.txt svneol=native#text/plain res/cardsfolder/g/grave_defiler.txt svneol=native#text/plain
res/cardsfolder/g/grave_exchange.txt -text res/cardsfolder/g/grave_exchange.txt -text
res/cardsfolder/g/grave_pact.txt svneol=native#text/plain res/cardsfolder/g/grave_pact.txt svneol=native#text/plain
@@ -8311,6 +8312,7 @@ res/cardsfolder/p/psychic_surgery.txt svneol=native#text/plain
res/cardsfolder/p/psychic_trance.txt -text svneol=unset#text/plain res/cardsfolder/p/psychic_trance.txt -text svneol=unset#text/plain
res/cardsfolder/p/psychic_transfer.txt -text res/cardsfolder/p/psychic_transfer.txt -text
res/cardsfolder/p/psychic_venom.txt svneol=native#text/plain res/cardsfolder/p/psychic_venom.txt svneol=native#text/plain
res/cardsfolder/p/psychic_vortex.txt -text
res/cardsfolder/p/psychogenic_probe.txt -text res/cardsfolder/p/psychogenic_probe.txt -text
res/cardsfolder/p/psychosis_crawler.txt svneol=native#text/plain res/cardsfolder/p/psychosis_crawler.txt svneol=native#text/plain
res/cardsfolder/p/psychotic_episode.txt -text svneol=unset#text/plain res/cardsfolder/p/psychotic_episode.txt -text svneol=unset#text/plain

View File

@@ -0,0 +1,16 @@
Name:Grave Consequences
ManaCost:1 B
Types:Instant
#AI will exile all cards from its graveyard currently
A:SP$ RepeatEach | Cost$ 1 B | RepeatPlayers$ Player | RepeatSubAbility$ DBChooseNum | SubAbility$ DBExile | SpellDescription$ Each player may exile any number of cards from his or her graveyard. Then each player loses 1 life for each card in his or her graveyard. Draw a card.
SVar:DBChooseNum:DB$ ChooseNumber | Defined$ Player.IsRemembered | Min$ 0 | Max$ X | References$ X | ListTitle$ Exile how many cards in your graveyard? | SubAbility$ DBChooseCard
SVar:DBChooseCard:DB$ ChooseCard | Defined$ Player.IsRemembered | Amount$ Y | References$ Y | Choices$ Card.RememberedPlayerCtrl | ChoiceZone$ Graveyard | Mandatory$ True | RememberChosen$ True
SVar:DBExile:DB$ ChangeZoneAll | ChangeType$ Card.IsRemembered | Origin$ Graveyard | Destination$ Exile | SubAbility$ DBRepeat
SVar:DBRepeat:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ DBLoseLife | SubAbility$ DBDraw
SVar:DBLoseLife:DB$ LoseLife | Defined$ Player.IsRemembered | LifeAmount$ X | References$ X
SVar:DBDraw:DB$ Draw | NumCards$ 1
SVar:X:Count$ValidGraveyard Card.RememberedPlayerCtrl
SVar:Y:Count$ChosenNumber
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/grave_consequences.jpg
Oracle:Each player may exile any number of cards from his or her graveyard. Then each player loses 1 life for each card in his or her graveyard.\nDraw a card.

View File

@@ -0,0 +1,10 @@
Name:Psychic Vortex
ManaCost:2 U U
Types:Enchantment
K:Cumulative upkeep:DrawYou<1>:Draw a card.
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | Execute$ TrigSac | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your end step, sacrifice a land and discard your hand.
SVar:TrigSac:AB$ Sacrifice | Cost$ 0 | SacValid$ Land | SubAbility$ DBDiscard
SVar:DBDiscard:DB$ Discard | Mode$ Hand
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/psychic_vortex.jpg
Oracle:Cumulative upkeep-Draw a card. (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.)\nAt the beginning of your end step, sacrifice a land and discard your hand.

View File

@@ -27,7 +27,7 @@ public class ReorderZoneEffect extends SpellAbilityEffect {
final List<Player> tgtPlayers = getTargetPlayers(sa); final List<Player> tgtPlayers = getTargetPlayers(sa);
boolean shuffle = sa.hasParam("Random"); boolean shuffle = sa.hasParam("Random");
return "Reorder " + Lang.joinHomogenous(tgtPlayers)+ " " + zone.toString() + " " + (shuffle ? "at random." : "as your choose."); return "Reorder " + Lang.joinHomogenous(tgtPlayers) + " " + zone.toString() + " " + (shuffle ? "at random." : "as your choose.");
} }
/** /**
@@ -36,8 +36,6 @@ public class ReorderZoneEffect extends SpellAbilityEffect {
* </p> * </p>
* @param sa * @param sa
* a {@link forge.card.spellability.SpellAbility} object. * a {@link forge.card.spellability.SpellAbility} object.
* @param af
* a {@link forge.card.ability.AbilityFactory} object.
*/ */
@Override @Override

View File

@@ -111,8 +111,6 @@ 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 bAbility * @param bAbility
@@ -129,21 +127,21 @@ public class Cost {
String[] parts = TextUtil.splitWithParenthesis(parse, ' ', '<', '>'); String[] parts = TextUtil.splitWithParenthesis(parse, ' ', '<', '>');
// make this before parse so that classes that need it get data in their constructor // make this before parse so that classes that need it get data in their constructor
for(String part : parts) { for (String part : parts) {
if ( part.equals("T") || part.equals("Tap") ) if (part.equals("T") || part.equals("Tap"))
this.tapCost = true; this.tapCost = true;
if ( part.equals("Q") || part.equals("Untap") ) if (part.equals("Q") || part.equals("Untap"))
untapCost = true; untapCost = true;
} }
CostPartMana parsedMana = null; CostPartMana parsedMana = null;
for(String part : parts) { for (String part : parts) {
if( "XCantBe0".equals(part) ) if ("XCantBe0".equals(part))
xCantBe0 = true; xCantBe0 = true;
else { else {
CostPart cp = parseCostPart(part, tapCost, untapCost); CostPart cp = parseCostPart(part, tapCost, untapCost);
if ( null != cp ) if (null != cp )
if ( cp instanceof CostPartMana ) { if (cp instanceof CostPartMana ) {
parsedMana = (CostPartMana) cp; parsedMana = (CostPartMana) cp;
} else { } else {
this.costParts.add(cp); this.costParts.add(cp);
@@ -154,25 +152,24 @@ public class Cost {
} }
if ( parsedMana == null && manaParts.length() > 0) { if (parsedMana == null && manaParts.length() > 0) {
parsedMana = new CostPartMana(new ManaCost(new ManaCostParser(manaParts.toString())), null, xCantBe0); parsedMana = new CostPartMana(new ManaCost(new ManaCostParser(manaParts.toString())), null, xCantBe0);
} }
if ( parsedMana != null ) { if (parsedMana != null) {
this.costParts.add(0, parsedMana); this.costParts.add(0, parsedMana);
} }
// inspect parts to set Sac, {T} and {Q} flags // inspect parts to set Sac, {T} and {Q} flags
for (int iCp = 0; iCp < costParts.size(); iCp++) { for (int iCp = 0; iCp < costParts.size(); iCp++) {
CostPart cp = costParts.get(iCp); CostPart cp = costParts.get(iCp);
// my guess why Q/T are to be first and are followed by mana parts // my guess why Q/T are to be first and are followed by mana parts
// is because Q/T are undoable and mana is interactive, so it well be easy to rollback if player refuses to pay // is because Q/T are undoable and mana is interactive, so it well be easy to rollback if player refuses to pay
if( cp instanceof CostUntap ) { if (cp instanceof CostUntap) {
costParts.remove(iCp); costParts.remove(iCp);
costParts.add(0, cp); costParts.add(0, cp);
} }
if( cp instanceof CostTap ) { if (cp instanceof CostTap) {
costParts.remove(iCp); costParts.remove(iCp);
costParts.add(0, cp); costParts.add(0, cp);
} }
@@ -181,26 +178,26 @@ public class Cost {
private static CostPart parseCostPart(String parse, boolean tapCost, boolean untapCost) { private static CostPart parseCostPart(String parse, boolean tapCost, boolean untapCost) {
if(parse.startsWith("Mana<")) { if (parse.startsWith("Mana<")) {
final String[] splitStr = TextUtil.split(abCostParse(parse, 1)[0], '\\'); final String[] splitStr = TextUtil.split(abCostParse(parse, 1)[0], '\\');
final String restriction = splitStr.length > 1 ? splitStr[1] : null; final String restriction = splitStr.length > 1 ? splitStr[1] : null;
final boolean xCantBe0 = splitStr.length > 1 && splitStr[1].equals("XCantBe0"); final boolean xCantBe0 = splitStr.length > 1 && splitStr[1].equals("XCantBe0");
return new CostPartMana(new ManaCost(new ManaCostParser(splitStr[0])), xCantBe0 ? null : restriction, xCantBe0); return new CostPartMana(new ManaCost(new ManaCostParser(splitStr[0])), xCantBe0 ? null : restriction, xCantBe0);
} }
if(parse.startsWith("tapXType<")) { if (parse.startsWith("tapXType<")) {
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;
return new CostTapType(splitStr[0], splitStr[1], description, tapCost); return new CostTapType(splitStr[0], splitStr[1], description, tapCost);
} }
if(parse.startsWith("untapYType<")) { if (parse.startsWith("untapYType<")) {
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;
return new CostUntapType(splitStr[0], splitStr[1], description, untapCost); return new CostUntapType(splitStr[0], splitStr[1], description, untapCost);
} }
if(parse.startsWith("SubCounter<")) { if (parse.startsWith("SubCounter<")) {
// SubCounter<NumCounters/CounterType> // SubCounter<NumCounters/CounterType>
final String[] splitStr = abCostParse(parse, 5); final String[] splitStr = abCostParse(parse, 5);
final String type = splitStr.length > 2 ? splitStr[2] : "CARDNAME"; final String type = splitStr.length > 2 ? splitStr[2] : "CARDNAME";
@@ -210,7 +207,7 @@ public class Cost {
return new CostRemoveCounter(splitStr[0], CounterType.valueOf(splitStr[1]), type, description, zone); return new CostRemoveCounter(splitStr[0], CounterType.valueOf(splitStr[1]), type, description, zone);
} }
if(parse.startsWith("AddCounter<")) { if (parse.startsWith("AddCounter<")) {
// AddCounter<NumCounters/CounterType> // AddCounter<NumCounters/CounterType>
final String[] splitStr = abCostParse(parse, 4); final String[] splitStr = abCostParse(parse, 4);
final String target = splitStr.length > 2 ? splitStr[2] : "CARDNAME"; final String target = splitStr.length > 2 ? splitStr[2] : "CARDNAME";
@@ -220,116 +217,120 @@ public class Cost {
// While no card has "PayLife<2> PayLife<3> there might be a card that // While no card has "PayLife<2> PayLife<3> there might be a card that
// Changes Cost by adding a Life Payment // Changes Cost by adding a Life Payment
if(parse.startsWith("PayLife<")) { if (parse.startsWith("PayLife<")) {
// PayLife<LifeCost> // PayLife<LifeCost>
final String[] splitStr = abCostParse(parse, 1); final String[] splitStr = abCostParse(parse, 1);
return new CostPayLife(splitStr[0]); return new CostPayLife(splitStr[0]);
} }
if(parse.startsWith("GainLife<")) { if (parse.startsWith("GainLife<")) {
// PayLife<LifeCost> // PayLife<LifeCost>
final String[] splitStr = abCostParse(parse, 3); final String[] splitStr = abCostParse(parse, 3);
int cnt = splitStr.length > 2 ? "*".equals(splitStr[2]) ? Integer.MAX_VALUE : Integer.parseInt(splitStr[2]) : 1; int cnt = splitStr.length > 2 ? "*".equals(splitStr[2]) ? Integer.MAX_VALUE : Integer.parseInt(splitStr[2]) : 1;
return new CostGainLife(splitStr[0], splitStr[1], cnt); return new CostGainLife(splitStr[0], splitStr[1], cnt);
} }
if(parse.startsWith("Unattach<")) { if (parse.startsWith("Unattach<")) {
// Unattach<Type/Desc> // Unattach<Type/Desc>
final String[] splitStr = abCostParse(parse, 2); final String[] splitStr = abCostParse(parse, 2);
final String description = splitStr.length > 1 ? splitStr[1] : null; final String description = splitStr.length > 1 ? splitStr[1] : null;
return new CostUnattach(splitStr[0], description); return new CostUnattach(splitStr[0], description);
} }
if(parse.startsWith("DamageYou<")) { if (parse.startsWith("DamageYou<")) {
// Damage<NumDmg> // Damage<NumDmg>
final String[] splitStr = abCostParse(parse, 1); final String[] splitStr = abCostParse(parse, 1);
return new CostDamage(splitStr[0]); return new CostDamage(splitStr[0]);
} }
if(parse.startsWith("Mill<")) { if (parse.startsWith("Mill<")) {
// Mill<NumCards> // Mill<NumCards>
final String[] splitStr = abCostParse(parse, 1); final String[] splitStr = abCostParse(parse, 1);
return new CostMill(splitStr[0]); return new CostMill(splitStr[0]);
} }
if(parse.startsWith("Discard<")) { if (parse.startsWith("Discard<")) {
// Discard<NumCards/Type> // Discard<NumCards/Type>
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;
return new CostDiscard(splitStr[0], splitStr[1], description); return new CostDiscard(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;
return new CostSacrifice(splitStr[0], splitStr[1], description); return new CostSacrifice(splitStr[0], splitStr[1], description);
} }
if(parse.startsWith("Exile<")) { if (parse.startsWith("Exile<")) {
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;
return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Battlefield); return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Battlefield);
} }
if(parse.startsWith("ExileFromHand<")) { if (parse.startsWith("ExileFromHand<")) {
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;
return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Hand); return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Hand);
} }
if(parse.startsWith("ExileFromGrave<")) { if (parse.startsWith("ExileFromGrave<")) {
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;
return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Graveyard); return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Graveyard);
} }
if(parse.startsWith("ExileFromStack<")) { if (parse.startsWith("ExileFromStack<")) {
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;
return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Stack); return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Stack);
} }
if(parse.startsWith("ExileFromTop<")) { if (parse.startsWith("ExileFromTop<")) {
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;
return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Library); return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Library);
} }
if(parse.startsWith("ExileSameGrave<")) { if (parse.startsWith("ExileSameGrave<")) {
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;
return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Graveyard, true); return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Graveyard, true);
} }
if(parse.equals("ExileAndPay")) { if (parse.equals("ExileAndPay")) {
return new CostExileAndPay(); return new CostExileAndPay();
} }
if(parse.startsWith("Return<")) { if (parse.startsWith("Return<")) {
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;
return new CostReturn(splitStr[0], splitStr[1], description); return new CostReturn(splitStr[0], splitStr[1], description);
} }
if(parse.startsWith("Reveal<")) { if (parse.startsWith("Reveal<")) {
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;
return new CostReveal(splitStr[0], splitStr[1], description); return new CostReveal(splitStr[0], splitStr[1], description);
} }
if (parse.startsWith("DrawYou<")) {
final String[] splitStr = abCostParse(parse, 1);
return new CostDraw(splitStr[0], "You");
}
if(parse.startsWith("PutCardToLibFromHand<")) { if (parse.startsWith("PutCardToLibFromHand<")) {
final String[] splitStr = abCostParse(parse, 4); final String[] splitStr = abCostParse(parse, 4);
final String description = splitStr.length > 3 ? splitStr[3] : null; final String description = splitStr.length > 3 ? splitStr[3] : null;
return new CostPutCardToLib(splitStr[0], splitStr[1], splitStr[2], description, ZoneType.Hand); return new CostPutCardToLib(splitStr[0], splitStr[1], splitStr[2], description, ZoneType.Hand);
} }
if(parse.startsWith("PutCardToLibFromGrave<")) { if (parse.startsWith("PutCardToLibFromGrave<")) {
final String[] splitStr = abCostParse(parse, 4); final String[] splitStr = abCostParse(parse, 4);
final String description = splitStr.length > 3 ? splitStr[3] : null; final String description = splitStr.length > 3 ? splitStr[3] : null;
return new CostPutCardToLib(splitStr[0], splitStr[1], splitStr[2], description, ZoneType.Graveyard); return new CostPutCardToLib(splitStr[0], splitStr[1], splitStr[2], description, ZoneType.Graveyard);
} }
if(parse.startsWith("PutCardToLibFromSameGrave<")) { if (parse.startsWith("PutCardToLibFromSameGrave<")) {
final String[] splitStr = abCostParse(parse, 4); final String[] splitStr = abCostParse(parse, 4);
final String description = splitStr.length > 3 ? splitStr[3] : null; final String description = splitStr.length > 3 ? splitStr[3] : null;
return new CostPutCardToLib(splitStr[0], splitStr[1], splitStr[2], description, ZoneType.Graveyard, true); return new CostPutCardToLib(splitStr[0], splitStr[1], splitStr[2], description, ZoneType.Graveyard, true);
@@ -370,7 +371,7 @@ public class Cost {
public final Cost copyWithNoMana() { public final Cost copyWithNoMana() {
Cost toRet = new Cost(0); Cost toRet = new Cost(0);
toRet.isAbility = this.isAbility; toRet.isAbility = this.isAbility;
for(CostPart cp : this.costParts) { for (CostPart cp : this.costParts) {
if (!(cp instanceof CostPartMana)) if (!(cp instanceof CostPartMana))
toRet.costParts.add(cp); toRet.costParts.add(cp);
} }
@@ -672,7 +673,7 @@ public class Cost {
oldManaCost.combineManaCost(costPart2.getMana()); oldManaCost.combineManaCost(costPart2.getMana());
String r2 = costPart2.getRestiction(); String r2 = costPart2.getRestiction();
String r1 = ((CostPartMana) part).getRestiction(); String r1 = ((CostPartMana) part).getRestiction();
String r = r1 == null ? r2 : ( r2 == null ? r1 : r1+"."+r2); String r = r1 == null ? r2 : ( r2 == null ? r1 : r1 + "." + r2);
getCostParts().remove(costPart2); getCostParts().remove(costPart2);
getCostParts().add(0, new CostPartMana(oldManaCost.toManaCost(), r, !xCanBe0)); getCostParts().add(0, new CostPartMana(oldManaCost.toManaCost(), r, !xCanBe0));
} else { } else {

View File

@@ -20,6 +20,7 @@ import forge.card.cardfactory.CardFactoryUtil;
import forge.card.cost.Cost; import forge.card.cost.Cost;
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.CostExile; import forge.card.cost.CostExile;
import forge.card.cost.CostMill; import forge.card.cost.CostMill;
import forge.card.cost.CostPart; import forge.card.cost.CostPart;
@@ -320,6 +321,19 @@ public class HumanPlay {
p.payLife(amount, null); p.payLife(amount, null);
} }
else if (part instanceof CostDraw) {
final int amount = getAmountFromPart(part, source, sourceAbility);
if (!p.canDraw()) {
return false;
}
if (false == GuiDialog.confirm(source, "Do you want to draw " + amount + " card(s)?" + orString)) {
return false;
}
p.drawCards(amount);
}
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);