From 0019b72cc990aabeec090f32f290d32f1373816f Mon Sep 17 00:00:00 2001 From: Sloth Date: Wed, 28 Nov 2012 12:52:27 +0000 Subject: [PATCH] - Fixed max hand size. --- res/cardsfolder/a/anvil_of_bogardan.txt | 2 +- res/cardsfolder/c/chronatog_avatar.txt | 2 +- res/cardsfolder/g/graceful_adept.txt | 2 +- res/cardsfolder/p/praetors_counsel.txt | 2 +- res/cardsfolder/r/reliquary_tower.txt | 2 +- res/cardsfolder/s/spellbook.txt | 2 +- res/cardsfolder/t/tamiyo_the_moon_sage.txt | 2 +- res/cardsfolder/v/vensers_journal.txt | 2 +- src/main/java/forge/StaticEffects.java | 3 +++ .../staticability/StaticAbilityContinuous.java | 12 ++++++++---- .../java/forge/control/input/InputCleanup.java | 4 ++-- src/main/java/forge/game/GameNew.java | 2 -- src/main/java/forge/game/player/Player.java | 18 ++++++++++++++++++ .../forge/gui/match/nonsingleton/VField.java | 2 +- 14 files changed, 40 insertions(+), 17 deletions(-) diff --git a/res/cardsfolder/a/anvil_of_bogardan.txt b/res/cardsfolder/a/anvil_of_bogardan.txt index 7e890f8ba5e..4c96b00aaff 100644 --- a/res/cardsfolder/a/anvil_of_bogardan.txt +++ b/res/cardsfolder/a/anvil_of_bogardan.txt @@ -2,7 +2,7 @@ Name:Anvil of Bogardan ManaCost:2 Types:Artifact Text:no text -S:Mode$ Continuous | Affected$ Player | SetMaxHandSize$ -1 | Description$ Players have no maximum hand size. +S:Mode$ Continuous | Affected$ Player | SetMaxHandSize$ Unlimited | Description$ Players have no maximum hand size. T:Mode$ Phase | Phase$ Draw | ValidPlayer$ Player | TriggerZones$ Battlefield | Execute$ TrigDraw | TriggerDescription$ At the beginning of each player's draw step, that player draws an additional card, then discards a card. SVar:TrigDraw:AB$ Draw | Cost$ 0 | NumCards$ 1 | Defined$ TriggeredPlayer | SubAbility$ DBDiscard SVar:DBDiscard:DB$Discard | Defined$ TriggeredPlayer | NumCards$ 1 | Mode$ TgtChoose diff --git a/res/cardsfolder/c/chronatog_avatar.txt b/res/cardsfolder/c/chronatog_avatar.txt index a2c774251bb..c22723236c3 100644 --- a/res/cardsfolder/c/chronatog_avatar.txt +++ b/res/cardsfolder/c/chronatog_avatar.txt @@ -3,7 +3,7 @@ ManaCost:no cost Types:Vanguard Text:no text HandLifeModifier:-1/+1 -S:Mode$ Continuous | EffectZone$ Command | Affected$ You | SetMaxHandSize$ -1 | Description$ You have no maximum hand size. +S:Mode$ Continuous | EffectZone$ Command | Affected$ You | SetMaxHandSize$ Unlimited | Description$ You have no maximum hand size. A:AB$ Draw | ActivationZone$ Command | Cost$ 0 | NumCards$ 3 | Defined$ You | ActivationLimit$ 1 | SubAbility$ DBSkipTurn | SpellDescription$ Draw three cards. You skip your next turn. Activate this ability only once each turn. SVar:DBSkipTurn:DB$ AddTurn | NumTurns$ 1 | Defined$ Opponent SVar:RemAIDeck:True diff --git a/res/cardsfolder/g/graceful_adept.txt b/res/cardsfolder/g/graceful_adept.txt index b05a96c2b70..76072a79d78 100644 --- a/res/cardsfolder/g/graceful_adept.txt +++ b/res/cardsfolder/g/graceful_adept.txt @@ -3,7 +3,7 @@ ManaCost:2 U Types:Creature Human Wizard Text:no text PT:1/3 -S:Mode$ Continuous | Affected$ You | SetMaxHandSize$ -1 | Description$ You have no maximum hand size. +S:Mode$ Continuous | Affected$ You | SetMaxHandSize$ Unlimited | Description$ You have no maximum hand size. SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/graceful_adept.jpg SetInfo:CHK|Uncommon|http://magiccards.info/scans/en/chk/63.jpg diff --git a/res/cardsfolder/p/praetors_counsel.txt b/res/cardsfolder/p/praetors_counsel.txt index db7392c51f2..63739bbb2b3 100644 --- a/res/cardsfolder/p/praetors_counsel.txt +++ b/res/cardsfolder/p/praetors_counsel.txt @@ -5,7 +5,7 @@ Text:no text A:SP$ ChangeZoneAll | Cost$ 5 G G G | Origin$ Graveyard | Destination$ Hand | ChangeType$ Card.YouOwn | SubAbility$ DBChange | SpellDescription$ Return all cards from your graveyard to your hand. Exile CARDNAME. You have no maximum hand size for the rest of the game. SVar:DBChange:DB$ChangeZone | Origin$ Stack | Destination$ Exile | SubAbility$ DBEffect SVar:DBEffect:DB$ Effect | Name$ Praetor's Counsel Effect | StaticAbilities$ STHandSize | Duration$ Permanent -SVar:STHandSize:Mode$ Continuous | EffectZone$ Command | Affected$ You | SetMaxHandSize$ -1 | Description$ You have no maximum hand size. +SVar:STHandSize:Mode$ Continuous | EffectZone$ Command | Affected$ You | SetMaxHandSize$ Unlimited | Description$ You have no maximum hand size. SVar:Rarity:Mythic SVar:Picture:http://www.wizards.com/global/images/magic/general/praetors_counsel.jpg SetInfo:MBS|Mythic|http://magiccards.info/scans/en/mbs/88.jpg diff --git a/res/cardsfolder/r/reliquary_tower.txt b/res/cardsfolder/r/reliquary_tower.txt index 7d4c94869c3..2d0a60d61f9 100644 --- a/res/cardsfolder/r/reliquary_tower.txt +++ b/res/cardsfolder/r/reliquary_tower.txt @@ -2,7 +2,7 @@ Name:Reliquary Tower ManaCost:no cost Types:Land Text:no text -S:Mode$ Continuous | Affected$ You | SetMaxHandSize$ -1 | Description$ You have no maximum hand size. +S:Mode$ Continuous | Affected$ You | SetMaxHandSize$ Unlimited | Description$ You have no maximum hand size. A:AB$ Mana | Cost$ T | Produced$ 1 | SpellDescription$ Add 1 to your mana pool. SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/reliquary_tower.jpg diff --git a/res/cardsfolder/s/spellbook.txt b/res/cardsfolder/s/spellbook.txt index 6d53d7a679b..e5f29230f7f 100644 --- a/res/cardsfolder/s/spellbook.txt +++ b/res/cardsfolder/s/spellbook.txt @@ -2,7 +2,7 @@ Name:Spellbook ManaCost:0 Types:Artifact Text:no text -S:Mode$ Continuous | Affected$ You | SetMaxHandSize$ -1 | Description$ You have no maximum hand size. +S:Mode$ Continuous | Affected$ You | SetMaxHandSize$ Unlimited | Description$ You have no maximum hand size. SVar:RemRandomDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/spellbook.jpg diff --git a/res/cardsfolder/t/tamiyo_the_moon_sage.txt b/res/cardsfolder/t/tamiyo_the_moon_sage.txt index 5d848ee0b1a..1479eafec82 100644 --- a/res/cardsfolder/t/tamiyo_the_moon_sage.txt +++ b/res/cardsfolder/t/tamiyo_the_moon_sage.txt @@ -8,7 +8,7 @@ SVar:TamiyoPump:DB$ Pump | Defined$ Targeted | Permanent$ True | KW$ HIDDEN This A:AB$ Draw | Cost$ SubCounter<2/LOYALTY> | ValidTgts$ Player | TgtPrompt$ Select target player | Defined$ You | NumCards$ X | References$ X | Planeswalker$ True | SpellDescription$ Draw a card for each tapped creature target player controls. SVar:X:Count$Valid Creature.tapped+TargetedPlayerCtrl A:AB$ Effect | Cost$ SubCounter<8/LOYALTY> | Planeswalker$ True | Ultimate$ True | Name$ Tamiyo, the Moon Sage emblem | Image$ tamiyo_the_moon_sage_emblem | StaticAbilities$ UnlimitedHand | Triggers$ TamiyoCardToGrave | SVars$ TamiyoReturn | Stackable$ False | Duration$ Permanent | AILogic$ Always | SpellDescription$ You get an emblem with "You have no maximum hand size" and "Whenever a card is put into your graveyard from anywhere, you may return it to your hand." -SVar:UnlimitedHand:Mode$ Continuous | EffectZone$ Command | Affected$ You | SetMaxHandSize$ -1 | Description$ You have no maximum hand size. +SVar:UnlimitedHand:Mode$ Continuous | EffectZone$ Command | Affected$ You | SetMaxHandSize$ Unlimited | Description$ You have no maximum hand size. SVar:TamiyoCardToGrave:Mode$ ChangesZone | Origin$ Any | Destination$ Graveyard | ValidCard$ Card.nonToken+YouCtrl | OptionalDecider$ You | Execute$ TamiyoReturn | TriggerDescription$ Whenever a card is put into your graveyard from anywhere, you may return it to your hand. SVar:TamiyoReturn:AB$ ChangeZone | Cost$ 0 | Defined$ TriggeredCard | Origin$ Graveyard | Destination$ Hand SVar:Rarity:Mythic diff --git a/res/cardsfolder/v/vensers_journal.txt b/res/cardsfolder/v/vensers_journal.txt index 7fa4864539b..cff92bb54bc 100644 --- a/res/cardsfolder/v/vensers_journal.txt +++ b/res/cardsfolder/v/vensers_journal.txt @@ -2,7 +2,7 @@ Name:Venser's Journal ManaCost:5 Types:Artifact Text:no text -S:Mode$ Continuous | Affected$ You | SetMaxHandSize$ -1 | Description$ You have no maximum hand size. +S:Mode$ Continuous | Affected$ You | SetMaxHandSize$ Unlimited | Description$ You have no maximum hand size. T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigGainLife | TriggerDescription$ At the beginning of your upkeep, you gain 1 life for each card in your hand. SVar:TrigGainLife:AB$GainLife | Cost$ 0 | LifeAmount$ X | References$ X SVar:X:Count$InYourHand diff --git a/src/main/java/forge/StaticEffects.java b/src/main/java/forge/StaticEffects.java index ceba54c7239..06fdd6e8eed 100644 --- a/src/main/java/forge/StaticEffects.java +++ b/src/main/java/forge/StaticEffects.java @@ -159,6 +159,9 @@ public class StaticEffects { // modify players for (final Player p : affectedPlayers) { + p.setUnlimitedHandSize(false); + p.setMaxHandSize(7); + if (params.containsKey("AddKeyword")) { addKeywords = params.get("AddKeyword").split(" & "); } diff --git a/src/main/java/forge/card/staticability/StaticAbilityContinuous.java b/src/main/java/forge/card/staticability/StaticAbilityContinuous.java index 3d89d2395d2..8379a42fdde 100644 --- a/src/main/java/forge/card/staticability/StaticAbilityContinuous.java +++ b/src/main/java/forge/card/staticability/StaticAbilityContinuous.java @@ -285,12 +285,16 @@ public class StaticAbilityContinuous { if (params.containsKey("SetMaxHandSize")) { String mhs = params.get("SetMaxHandSize"); - int max = mhs.matches("[0-9][0-9]?") ? Integer.parseInt(mhs) - : AbilityFactory.calculateAmount(hostCard, mhs, null); - p.setMaxHandSize(max); + if (mhs.equals("Unlimited")) { + p.setUnlimitedHandSize(true); + } else { + int max = mhs.matches("[0-9][0-9]?") ? Integer.parseInt(mhs) + : AbilityFactory.calculateAmount(hostCard, mhs, null); + p.setMaxHandSize(max); + } } - if (params.containsKey("RaiseMaxHandSize") && p.getMaxHandSize() != -1) { + if (params.containsKey("RaiseMaxHandSize")) { String rmhs = params.get("RaiseMaxHandSize"); int rmax = rmhs.matches("[0-9][0-9]?") ? Integer.parseInt(rmhs) : AbilityFactory.calculateAmount(hostCard, rmhs, null); diff --git a/src/main/java/forge/control/input/InputCleanup.java b/src/main/java/forge/control/input/InputCleanup.java index 0789c4e0c9f..e131fd29771 100644 --- a/src/main/java/forge/control/input/InputCleanup.java +++ b/src/main/java/forge/control/input/InputCleanup.java @@ -50,7 +50,7 @@ public class InputCleanup extends Input { final int n = active.getCardsIn(ZoneType.Hand).size(); final int max = active.getMaxHandSize(); // goes to the next phase - if (n <= max || n <= 0) { + if (active.isUnlimitedHandSize() || n <= max || n <= 0) { Singletons.getModel().getGame().getPhaseHandler().passPriority(); return; } @@ -84,7 +84,7 @@ public class InputCleanup extends Input { public void aiCleanupDiscard(final Player ai) { final int size = ai.getCardsIn(ZoneType.Hand).size(); - if (ai.getMaxHandSize() != -1) { + if (!ai.isUnlimitedHandSize()) { final int numDiscards = size - ai.getMaxHandSize(); ai.discard(numDiscards, null); } diff --git a/src/main/java/forge/game/GameNew.java b/src/main/java/forge/game/GameNew.java index 05b684573e8..4712d5fa178 100644 --- a/src/main/java/forge/game/GameNew.java +++ b/src/main/java/forge/game/GameNew.java @@ -20,7 +20,6 @@ import forge.CardPredicates; import forge.CardUtil; import forge.GameAction; import forge.Singletons; -import forge.card.cardfactory.CardFactoryUtil; import forge.card.trigger.TriggerHandler; import forge.card.trigger.TriggerType; import forge.control.input.InputControl; @@ -34,7 +33,6 @@ import forge.game.player.Player; import forge.game.zone.PlayerZone; import forge.game.zone.ZoneType; import forge.gui.match.views.VAntes; -import forge.item.CardDb; import forge.item.CardPrinted; import forge.properties.ForgePreferences.FPref; import forge.util.Aggregates; diff --git a/src/main/java/forge/game/player/Player.java b/src/main/java/forge/game/player/Player.java index e5832e4fbe9..a4274a090c3 100644 --- a/src/main/java/forge/game/player/Player.java +++ b/src/main/java/forge/game/player/Player.java @@ -108,6 +108,9 @@ public abstract class Player extends GameEntity implements Comparable { /** The max hand size. */ private int maxHandSize = 7; + /** The unlimited hand size. */ + private boolean unlimitedHandSize = false; + /** The last drawn card. */ private Card lastDrawnCard = null; @@ -2520,6 +2523,21 @@ public abstract class Player extends GameEntity implements Comparable { maxHandSize = size; } + /** + * @return the unlimitedHandSize + */ + public boolean isUnlimitedHandSize() { + return unlimitedHandSize; + } + + /** + * @param unlimitedHandSize0 the unlimitedHandSize to set + */ + public void setUnlimitedHandSize(boolean unlimited) { + this.unlimitedHandSize = unlimited; + } + + /** *

* Getter for the field maxLandsToPlay. diff --git a/src/main/java/forge/gui/match/nonsingleton/VField.java b/src/main/java/forge/gui/match/nonsingleton/VField.java index 134d7c27734..ddce9193226 100644 --- a/src/main/java/forge/gui/match/nonsingleton/VField.java +++ b/src/main/java/forge/gui/match/nonsingleton/VField.java @@ -325,7 +325,7 @@ public class VField implements IVDoc { */ public void updateZones(final Player p0) { this.getLblHand().setText("" + p0.getZone(ZoneType.Hand).size()); - final String handMaxToolTip = p0.getMaxHandSize() < 0 + final String handMaxToolTip = p0.isUnlimitedHandSize() ? "no maximum hand size" : String.valueOf(p0.getMaxHandSize()); this.getLblHand().setToolTipText("Cards in hand (max: " + handMaxToolTip + ")"); this.getLblGraveyard().setText("" + p0.getZone(ZoneType.Graveyard).size());