From 65fecebb3ad5ac1ed98c1c0d7d341d7be6244b4c Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 12:35:39 +0000 Subject: [PATCH] add Phyrexian Processor (from Urza's Saga) --- .gitattributes | 1 + res/cardsfolder/phyrexian_processor.txt | 10 +++++++ src/forge/Card.java | 12 ++++++++ src/forge/CardFactory.java | 39 +++++++++++++++++++++++++ src/forge/CardFactoryUtil.java | 14 +++++++++ 5 files changed, 76 insertions(+) create mode 100644 res/cardsfolder/phyrexian_processor.txt diff --git a/.gitattributes b/.gitattributes index 0b62d134a3e..b5ecc19f65e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3408,6 +3408,7 @@ res/cardsfolder/phyrexian_hulk.txt -text svneol=native#text/plain res/cardsfolder/phyrexian_ironfoot.txt -text svneol=native#text/plain res/cardsfolder/phyrexian_monitor.txt -text svneol=native#text/plain res/cardsfolder/phyrexian_plaguelord.txt -text svneol=native#text/plain +res/cardsfolder/phyrexian_processor.txt -text svneol=native#text/plain res/cardsfolder/phyrexian_prowler.txt -text svneol=native#text/plain res/cardsfolder/phyrexian_rager.txt -text svneol=native#text/plain res/cardsfolder/phyrexian_snowcrusher.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/phyrexian_processor.txt b/res/cardsfolder/phyrexian_processor.txt new file mode 100644 index 00000000000..6f63b991d4e --- /dev/null +++ b/res/cardsfolder/phyrexian_processor.txt @@ -0,0 +1,10 @@ +Name:Phyrexian Processor +ManaCost:4 +Types:Artifact +Text:As Phyrexian Processor enters the battlefield, pay any amount of life. +A:AB$Token | Cost$ 4 T | TokenAmount$ 1 | TokenName$ Minion | TokenTypes$ Creature,Minion | TokenOwner$ Controller | TokenColors$ Black | TokenPower$ X | TokenToughness$ X |SpellDescription$Put an X/X black Minion creature token onto the battlefield, where X is the life paid as Phyrexian Processor entered the battlefield. +SVar:X:Count$xLifePaid +SVar:RemAIDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/phyrexian_processor.jpg +End \ No newline at end of file diff --git a/src/forge/Card.java b/src/forge/Card.java index 19fd3c5d367..e1e51ee5723 100644 --- a/src/forge/Card.java +++ b/src/forge/Card.java @@ -112,6 +112,8 @@ public class Card extends MyObservable { private int xManaCostPaid = 0; + private int xLifePaid = 0; + private int multiKickerMagnitude = 0; private Player owner = null; @@ -205,6 +207,16 @@ public class Card extends MyObservable { return xManaCostPaid; } + public void setXLifePaid(int n) + { + xLifePaid = n; + } + + public int getXLifePaid() + { + return xLifePaid; + } + //used to see if an attacking creature with a triggering attack ability triggered this phase: public void setCreatureAttackedThisCombat(boolean b) { creatureAttackedThisCombat = b; diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 29121aabf53..074fa954edf 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -11369,6 +11369,45 @@ public class CardFactory implements NewConstants { card.addComesIntoPlayCommand(intoPlay); }//*************** END ************ END ************************** + //*************** START *********** START ************************** + else if(cardName.equals("Phyrexian Processor")) { + final SpellAbility ability = new Ability_Static(card, "0") { + @Override + public void resolve() { + Player player = card.getController(); + int lifeToPay = 0; + if(player.isHuman()) { + int num = card.getController().getLife(); + String[] choices = new String[num+1]; + for(int j = 0; j <= num; j++) { + choices[j] = ""+j; + } + String answer = (String)(AllZone.Display.getChoiceOptional( + "Life to pay:", choices)); + lifeToPay = Integer.parseInt(answer); + } else { + //not implemented for Compy + } + + if(player.payLife(lifeToPay, card)) card.setXLifePaid(lifeToPay); + } + };//ability + Command intoPlay = new Command() { + private static final long serialVersionUID = 5634360316643996274L; + + public void execute() { + + StringBuilder sb = new StringBuilder(); + sb.append("When ").append(card.getName()).append(" comes into play, pay any amount of life."); + ability.setStackDescription(sb.toString()); + + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + + }//*************** END ************ END ************************** + return postFactoryKeywords(card); }//getCard2 diff --git a/src/forge/CardFactoryUtil.java b/src/forge/CardFactoryUtil.java index 8c63b08fbf8..466ecdd0655 100644 --- a/src/forge/CardFactoryUtil.java +++ b/src/forge/CardFactoryUtil.java @@ -3732,6 +3732,20 @@ public class CardFactoryUtil { } } + if(sq[0].contains("xLifePaid")) { + if (c.getController().isHuman()) { + return c.getXLifePaid(); + } + else { + //copied for xPaid + //not implemented for Compy + //int dam = ComputerUtil.getAvailableMana().size()- CardUtil.getConvertedManaCost(c); + //if (dam < 0) dam = 0; + //return dam; + return 0; + } + } + CardList someCards = new CardList(); //Complex counting methods