From f8fe7e41b4fba1b97d9fe442a24bc3fdd9a2b3a6 Mon Sep 17 00:00:00 2001 From: swordshine Date: Wed, 20 Nov 2013 13:00:06 +0000 Subject: [PATCH] - Added Liar's Pendulum --- .gitattributes | 1 + forge-gui/res/cardsfolder/l/liars_pendulum.txt | 14 ++++++++++++++ forge-gui/res/cardsfolder/w/walking_atlas.txt | 2 +- .../ability/effects/ChooseGenericEffect.java | 16 ++++++++++++---- .../card/ability/effects/RevealHandEffect.java | 7 +++++++ .../gui/workshop/controllers/CCardScript.java | 6 ------ 6 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 forge-gui/res/cardsfolder/l/liars_pendulum.txt diff --git a/.gitattributes b/.gitattributes index e32a9f2645d..3b372272630 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6547,6 +6547,7 @@ forge-gui/res/cardsfolder/l/leyline_of_vitality.txt svneol=native#text/plain forge-gui/res/cardsfolder/l/leyline_phantom.txt -text forge-gui/res/cardsfolder/l/lhurgoyf.txt svneol=native#text/plain forge-gui/res/cardsfolder/l/liability.txt svneol=native#text/plain +forge-gui/res/cardsfolder/l/liars_pendulum.txt -text forge-gui/res/cardsfolder/l/liberate.txt svneol=native#text/plain forge-gui/res/cardsfolder/l/liberated_dwarf.txt svneol=native#text/plain forge-gui/res/cardsfolder/l/library_of_alexandria.txt svneol=native#text/plain diff --git a/forge-gui/res/cardsfolder/l/liars_pendulum.txt b/forge-gui/res/cardsfolder/l/liars_pendulum.txt new file mode 100644 index 00000000000..36ebcbedebb --- /dev/null +++ b/forge-gui/res/cardsfolder/l/liars_pendulum.txt @@ -0,0 +1,14 @@ +Name:Liar's Pendulum +ManaCost:1 +Types:Artifact +A:AB$ NameCard | Cost$ 2 T | Defined$ You | SubAbility$ DBGuess | SpellDescription$ Name a card. Target opponent guesses whether a card with that name is in your hand. You may reveal your hand. If you do and your opponent guessed wrong, draw a card. +SVar:DBGuess:DB$ GenericChoice | ValidTgts$ Opponent | Choices$ GuessInHand,GuessNotInHand | AILogic$ Random | ShowChoice$ True +SVar:GuessInHand:DB$ RevealHand | Defined$ You | Optional$ True | RememberRevealedPlayer$ True | SubAbility$ DBInHandDraw | ChoiceDescription$ A card with that name is in that player's hand +SVar:GuessNotInHand:DB$ RevealHand | Defined$ You | Optional$ True | RememberRevealedPlayer$ True | SubAbility$ DBNotInHandDraw | ChoiceDescription$ A card with that name is not in that player's hand +SVar:DBInHandDraw:DB$ Draw | Defined$ You | ConditionPlayerDefined$ Remembered | ConditionPlayerContains$ You | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ0 | References$ X | SubAbility$ DBCleanup +SVar:DBNotInHandDraw:DB$ Draw | Defined$ You | ConditionPlayerDefined$ Remembered | ConditionPlayerContains$ You | ConditionCheckSVar$ X | ConditionSVarCompare$ GE1 | References$ X | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:X:Count$ValidHand Card.NamedCard +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/liars_pendulum.jpg +Oracle:{2}, {T}: Name a card. Target opponent guesses whether a card with that name is in your hand. You may reveal your hand. If you do and your opponent guessed wrong, draw a card. diff --git a/forge-gui/res/cardsfolder/w/walking_atlas.txt b/forge-gui/res/cardsfolder/w/walking_atlas.txt index a96d075e8e3..3e39ec92a41 100644 --- a/forge-gui/res/cardsfolder/w/walking_atlas.txt +++ b/forge-gui/res/cardsfolder/w/walking_atlas.txt @@ -2,6 +2,6 @@ Name:Walking Atlas ManaCost:2 Types:Artifact Creature Construct PT:1/1 -A:AB$ ChangeZone | Cost$ T | Origin$ Hand | Destination$ Battlefield | ChangeType$ Land | ChangeNum$ 1 | OptionalDecider$ You | SpellDescription$ You may put a land card from your hand onto the battlefield. +A:AB$ ChangeZone | Cost$ T | Origin$ Hand | Destination$ Battlefield | ChangeType$ Land | ChangeNum$ 1 | Optional$ You | SpellDescription$ You may put a land card from your hand onto the battlefield. SVar:Picture:http://www.wizards.com/global/images/magic/general/Walking_Atlas.jpg Oracle:{T}: You may put a land card from your hand onto the battlefield. \ No newline at end of file diff --git a/forge-gui/src/main/java/forge/card/ability/effects/ChooseGenericEffect.java b/forge-gui/src/main/java/forge/card/ability/effects/ChooseGenericEffect.java index fdb6f134d8a..0b6f820914c 100644 --- a/forge-gui/src/main/java/forge/card/ability/effects/ChooseGenericEffect.java +++ b/forge-gui/src/main/java/forge/card/ability/effects/ChooseGenericEffect.java @@ -50,16 +50,24 @@ public class ChooseGenericEffect extends SpellAbilityEffect { continue; } SpellAbility chosenSA = null; + String choice; if (sa.hasParam("AtRandom")) { - chosenSA = AbilityFactory.getAbility(host.getSVar(Aggregates.random(choices.keySet())), host); + choice = Aggregates.random(choices.keySet()); } else { if (p.isHuman()) { - String choice = GuiChoose.one("Choose one", choices.values()); - chosenSA = AbilityFactory.getAbility(host.getSVar(choices.inverse().get(choice)), host); + choice = choices.inverse().get(GuiChoose.one("Choose one", choices.values())); } else { //Computer AI - chosenSA = AbilityFactory.getAbility(host.getSVar(sa.getParam("Choices").split(",")[0]), host); + if ("Random".equals(sa.getParam("AILogic"))) { + choice = Aggregates.random(choices.keySet()); + } else { + choice = sa.getParam("Choices").split(",")[0]; + } } } + chosenSA = AbilityFactory.getAbility(host.getSVar(choice), host); + if (sa.hasParam("ShowChoice")) { + p.getGame().getAction().nofityOfValue(sa, p, choices.get(choice), null); + } chosenSA.setActivatingPlayer(sa.getSourceCard().getController()); ((AbilitySub) chosenSA).setParent(sa); AbilityUtils.resolve(chosenSA); diff --git a/forge-gui/src/main/java/forge/card/ability/effects/RevealHandEffect.java b/forge-gui/src/main/java/forge/card/ability/effects/RevealHandEffect.java index 95031980122..90d93c32c90 100644 --- a/forge-gui/src/main/java/forge/card/ability/effects/RevealHandEffect.java +++ b/forge-gui/src/main/java/forge/card/ability/effects/RevealHandEffect.java @@ -36,9 +36,13 @@ public class RevealHandEffect extends SpellAbilityEffect { final Card host = sa.getSourceCard(); final TargetRestrictions tgt = sa.getTargetRestrictions(); + final boolean optional = sa.hasParam("Optional"); for (final Player p : getTargetPlayers(sa)) { if ((tgt == null) || p.canBeTargetedBy(sa)) { + if (optional && !p.getController().confirmAction(sa, null, "Do you want to reveal your hand?")) { + continue; + } final List hand = p.getCardsIn(ZoneType.Hand); sa.getActivatingPlayer().getController().reveal(p.getName() + "'s hand", hand, ZoneType.Hand, p); if (sa.hasParam("RememberRevealed")) { @@ -46,6 +50,9 @@ public class RevealHandEffect extends SpellAbilityEffect { host.addRemembered(c); } } + if (sa.hasParam("RememberRevealedPlayer")) { + host.addRemembered(p); + } } } } diff --git a/forge-gui/src/main/java/forge/gui/workshop/controllers/CCardScript.java b/forge-gui/src/main/java/forge/gui/workshop/controllers/CCardScript.java index f4bef073f0a..aa6393c8f41 100644 --- a/forge-gui/src/main/java/forge/gui/workshop/controllers/CCardScript.java +++ b/forge-gui/src/main/java/forge/gui/workshop/controllers/CCardScript.java @@ -1,8 +1,5 @@ package forge.gui.workshop.controllers; -import java.io.File; -import java.io.PrintWriter; - import javax.swing.JOptionPane; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; @@ -11,15 +8,12 @@ import forge.Command; import forge.Singletons; import forge.gui.framework.FScreen; import forge.gui.framework.ICDoc; -import forge.gui.match.controllers.CDetail; -import forge.gui.match.controllers.CPicture; import forge.gui.toolbox.FTextEditor; import forge.gui.workshop.menus.WorkshopFileMenu; import forge.gui.workshop.views.VCardDesigner; import forge.gui.workshop.views.VCardScript; import forge.gui.workshop.views.VWorkshopCatalog; import forge.item.PaperCard; -import forge.util.FileUtil; /**