From 852328888406d6c0d14b70f9868158b3aaac9371 Mon Sep 17 00:00:00 2001 From: Sol Date: Sun, 5 Apr 2020 23:56:37 +0000 Subject: [PATCH] Revert "Merge branch 'keywordCounter' into 'master'" This reverts merge request !2667 --- .../ability/effects/CountersPutEffect.java | 13 ---- .../src/main/java/forge/game/card/Card.java | 63 ------------------- .../java/forge/game/card/CounterType.java | 53 +--------------- forge-gui/res/cardsfolder/d/dismantle.txt | 14 +++-- forge-gui/res/cardsfolder/f/find_finality.txt | 6 +- .../cardsfolder/h/haphazard_bombardment.txt | 8 ++- .../res/cardsfolder/s/settle_the_score.txt | 5 +- .../res/cardsfolder/t/the_elderspell.txt | 5 +- .../res/cardsfolder/upcoming/fully_grown.txt | 6 -- 9 files changed, 25 insertions(+), 148 deletions(-) delete mode 100644 forge-gui/res/cardsfolder/upcoming/fully_grown.txt diff --git a/forge-game/src/main/java/forge/game/ability/effects/CountersPutEffect.java b/forge-game/src/main/java/forge/game/ability/effects/CountersPutEffect.java index 63a8536f1ff..76c8ed3b6a8 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/CountersPutEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/CountersPutEffect.java @@ -150,19 +150,6 @@ public class CountersPutEffect extends SpellAbilityEffect { CardCollection leastToughness = new CardCollection(Aggregates.listWithMin(creatsYouCtrl, CardPredicates.Accessors.fnGetDefense)); tgtCards.addAll(pc.chooseCardsForEffect(leastToughness, sa, Localizer.getInstance().getMessage("lblChooseACreatureWithLeastToughness"), 1, 1, false)); tgtObjects.addAll(tgtCards); - } else if (sa.hasParam("Choices")) { - ZoneType choiceZone = ZoneType.Battlefield; - if (sa.hasParam("ChoiceZone")) { - choiceZone = ZoneType.smartValueOf(sa.getParam("ChoiceZone")); - } - CardCollection choices = new CardCollection(game.getCardsIn(choiceZone)); - - int n = sa.hasParam("ChoiceAmount") ? Integer.parseInt(sa.getParam("ChoiceAmount")) : 1; - - choices = CardLists.getValidCards(choices, sa.getParam("Choices"), activator, card); - - String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChooseaCard") + " "; - tgtObjects.addAll(new CardCollection(pc.chooseCardsForEffect(choices, sa, title, n, n, !sa.hasParam("ChoiceOptional")))); } else { tgtObjects.addAll(getDefinedOrTargeted(sa, "Defined")); } diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index 722b532282e..d89ebcdaaf7 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -129,8 +129,6 @@ public class Card extends GameEntity implements Comparable { private final Multimap cantHaveKeywords = MultimapBuilder.hashKeys().enumSetValues(Keyword.class).build(); - private final Map counterTypeTimestamps = Maps.newEnumMap(CounterType.class); - private final Map canBlockAdditional = Maps.newTreeMap(); private final Set canBlockAny = Sets.newHashSet(); @@ -1307,44 +1305,12 @@ public class Card extends GameEntity implements Comparable { getController().addCounterToPermThisTurn(counterType, addAmount); view.updateCounters(this); } - if (newValue <= 0) { - removeCounterTimestamp(counterType); - } else { - addCounterTimestamp(counterType); - } if (table != null) { table.put(this, counterType, addAmount); } return addAmount; } - public boolean addCounterTimestamp(CounterType counterType) { - return addCounterTimestamp(counterType, true); - } - public boolean addCounterTimestamp(CounterType counterType, boolean updateView) { - if (!counterType.isKeywordCounter()) { - return false; - } - removeCounterTimestamp(counterType); - - long timestamp = game.getNextTimestamp(); - counterTypeTimestamps.put(counterType, timestamp); - addChangedCardKeywords(List.of(counterType.getKeyword().toString()), null, false, false, timestamp, updateView); - return true; - } - - public boolean removeCounterTimestamp(CounterType counterType) { - return removeCounterTimestamp(counterType, true); - } - - public boolean removeCounterTimestamp(CounterType counterType, boolean updateView) { - Long old = counterTypeTimestamps.remove(counterType); - if (old != null) { - removeChangedCardKeywords(old, updateView); - } - return old != null; - } - /** *

* addCountersAddedBy. @@ -1392,10 +1358,6 @@ public class Card extends GameEntity implements Comparable { setCounters(counterName, newValue); view.updateCounters(this); - if (newValue <= 0) { - this.removeCounterTimestamp(counterName); - } - //fire card stats changed event if p/t bonuses or loyalty changed from subtracted counters if (powerBonusBefore != getPowerBonusFromCounters() || toughnessBonusBefore != getToughnessBonusFromCounters() || loyaltyBefore != getCurrentLoyalty()) { getGame().fireEvent(new GameEventCardStatsChanged(this)); @@ -1418,23 +1380,8 @@ public class Card extends GameEntity implements Comparable { @Override public final void setCounters(final Map allCounters) { - boolean changed = false; - for (CounterType ct : counters.keySet()) { - if (removeCounterTimestamp(ct, false)) { - changed = true; - } - } counters = allCounters; view.updateCounters(this); - - for (CounterType ct : counters.keySet()) { - if (addCounterTimestamp(ct, false)) { - changed = true; - } - } - if (changed) { - updateKeywords(); - } } @Override @@ -1442,16 +1389,6 @@ public class Card extends GameEntity implements Comparable { if (counters.isEmpty()) { return; } counters.clear(); view.updateCounters(this); - - boolean changed = false; - for (CounterType ct : counterTypeTimestamps.keySet()) { - if (removeCounterTimestamp(ct, false)) { - changed = true; - } - } - if (changed) { - updateKeywords(); - } } public final String getSVar(final String var) { diff --git a/forge-game/src/main/java/forge/game/card/CounterType.java b/forge-game/src/main/java/forge/game/card/CounterType.java index 80825fa1f03..5d9fd5970d6 100644 --- a/forge-game/src/main/java/forge/game/card/CounterType.java +++ b/forge-game/src/main/java/forge/game/card/CounterType.java @@ -20,8 +20,6 @@ package forge.game.card; import com.google.common.collect.ImmutableList; -import forge.game.keyword.Keyword; - /** * The class Counters. * @@ -311,23 +309,7 @@ public enum CounterType { EXPERIENCE("EXP"), - POISON("POISN"), - - // Keyword Counters - - FLYING("Flying"), - FIRST_STRIKE("First Strike"), - DOUBLE_STRIKE("Double Strike"), - DEATHTOUCH("Deathtouch"), - HEXPROOF("Hexproof"), - INDESTRUCTIBLE("Indestructible"), - LIFELINK("Lifelink"), - MENACE("Menace"), - REACH("Reach"), - TRAMPLE("Trample"), - VIGILANCE("Vigilance") - - ; + POISON("POISN"); private String name, counterOnCardDisplayName; private int red, green, blue; @@ -383,39 +365,6 @@ public enum CounterType { return Enum.valueOf(CounterType.class, replacedName); } - public boolean isKeywordCounter() { - return this.getKeyword() != null; - } - - public Keyword getKeyword() { - switch (this) { - case FLYING: - return Keyword.FLYING; - case FIRST_STRIKE: - return Keyword.FIRST_STRIKE; - case DOUBLE_STRIKE: - return Keyword.DOUBLE_STRIKE; - case DEATHTOUCH: - return Keyword.DEATHTOUCH; - case HEXPROOF: - return Keyword.HEXPROOF; - case INDESTRUCTIBLE: - return Keyword.INDESTRUCTIBLE; - case LIFELINK: - return Keyword.LIFELINK; - case MENACE: - return Keyword.MENACE; - case REACH: - return Keyword.REACH; - case TRAMPLE: - return Keyword.TRAMPLE; - case VIGILANCE: - return Keyword.VIGILANCE; - default: - return null; - } - } - public static final ImmutableList values = ImmutableList.copyOf(values()); } diff --git a/forge-gui/res/cardsfolder/d/dismantle.txt b/forge-gui/res/cardsfolder/d/dismantle.txt index 69a7d4e4fb4..c39d32dfd26 100644 --- a/forge-gui/res/cardsfolder/d/dismantle.txt +++ b/forge-gui/res/cardsfolder/d/dismantle.txt @@ -1,9 +1,13 @@ Name:Dismantle ManaCost:2 R Types:Sorcery -A:SP$ Destroy | Cost$ 2 R | ValidTgts$ Artifact | TgtPrompt$ Select target artifact | SubAbility$ DBChoice | SpellDescription$ Destroy target artifact. If that artifact had counters on it, put that many +1/+1 counters or charge counters on an artifact you control. -SVar:DBChoice:DB$ GenericChoice | Choices$ DBPutP1P1,DBPutCharge | ConditionDefined$ Targeted | ConditionPresent$ Card.HasCounters | ConditionCompare$ GE1 | StackDescription$ put that many +1/+1 counters or charge counters on an artifact you control. -SVar:DBPutP1P1:DB$ PutCounter | Choices$ Artifact.YouCtrl | CounterType$ P1P1 | CounterNum$ X | References$ X | SpellDescription$ +1/+1 -SVar:DBPutCharge:DB$ PutCounter | Choices$ Artifact.YouCtrl | CounterType$ CHARGE | CounterNum$ X | References$ X | SpellDescription$ Charge -SVar:X:TargetedLKI$CardCounters.ALL +A:SP$ Destroy | Cost$ 2 R | ValidTgts$ Artifact | TgtPrompt$ Select target artifact | RememberTargets$ True | SubAbility$ DBChoice | SpellDescription$ Destroy target artifact. If that artifact had counters on it, put that many +1/+1 counters or charge counters on an artifact you control. +SVar:DBChoice:DB$ GenericChoice | Choices$ DBP1P1,DBCharge | ConditionDefined$ Targeted | ConditionPresent$ Card.HasCounters | ConditionCompare$ GE1 | StackDescription$ put that many +1/+1 counters or charge counters on an artifact you control. +SVar:DBP1P1:DB$ ChooseCard | Choices$ Artifact.YouCtrl | Amount$ 1 | SpellDescription$ +1/+1 | SubAbility$ DBPutP1P1 +SVar:DBPutP1P1:DB$ PutCounter | Defined$ ChosenCard | CounterType$ P1P1 | CounterNum$ X | References$ X | SubAbility$ DBCleanup +SVar:DBCharge:DB$ ChooseCard | Choices$ Artifact.YouCtrl | Amount$ 1 | SpellDescription$ charge | SubAbility$ DBPutCharge +SVar:DBPutCharge:DB$ PutCounter | Defined$ ChosenCard | CounterType$ CHARGE | CounterNum$ X | References$ X | SpellDescription$ Charge | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:X:RememberedLKI$CardCounters.ALL +SVar:Picture:http://www.wizards.com/global/images/magic/general/dismantle.jpg Oracle:Destroy target artifact. If that artifact had counters on it, put that many +1/+1 counters or charge counters on an artifact you control. diff --git a/forge-gui/res/cardsfolder/f/find_finality.txt b/forge-gui/res/cardsfolder/f/find_finality.txt index a4c41981640..2b85d2313fd 100644 --- a/forge-gui/res/cardsfolder/f/find_finality.txt +++ b/forge-gui/res/cardsfolder/f/find_finality.txt @@ -10,7 +10,9 @@ ALTERNATE Name:Finality ManaCost:4 B G Types:Sorcery -A:SP$ PutCounter | Cost$ 4 B G | Choices$ Creature.YouCtrl | ChoiceOptional$ True | CounterType$ P1P1 | CounterNum$ 2 | SubAbility$ DBPumpAll | StackDescription$ SpellDescription | SpellDescription$ You may put two +1/+1 counters on a creature you control. Then all creatures get -4/-4 until end of turn. -SVar:DBPumpAll:DB$ PumpAll | ValidCards$ Creature | NumAtt$ -4 | NumDef$ -4 | IsCurse$ True +A:SP$ ChooseCard | Cost$ 4 B G | Defined$ You | Amount$ 1 | MinAmount$ 0 | Choices$ Creature.YouCtrl | SubAbility$ DBPutCounter | SpellDescription$ You may put two +1/+1 counters on a creature you control. Then all creatures get -4/-4 until end of turn. +SVar:DBPutCounter:DB$ PutCounter | Defined$ ChosenCard | CounterType$ P1P1 | CounterNum$ 2 | SubAbility$ DBPumpAll +SVar:DBPumpAll:DB$ PumpAll | ValidCards$ Creature | NumAtt$ -4 | NumDef$ -4 | IsCurse$ True | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearChosenCard$ True DeckHas:Ability$Counters Oracle:You may put two +1/+1 counters on a creature you control. Then all creatures get -4/-4 until end of turn. diff --git a/forge-gui/res/cardsfolder/h/haphazard_bombardment.txt b/forge-gui/res/cardsfolder/h/haphazard_bombardment.txt index eccf46ba889..d598dd69a28 100644 --- a/forge-gui/res/cardsfolder/h/haphazard_bombardment.txt +++ b/forge-gui/res/cardsfolder/h/haphazard_bombardment.txt @@ -1,10 +1,12 @@ Name:Haphazard Bombardment ManaCost:5 R Types:Enchantment -T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ DBPutCounter | TriggerDescription$ When CARDNAME enters the battlefield, choose four nonenchantment permanents you don't control and put an aim counter on each of them. -SVar:DBPutCounter:DB$ PutCounter | Choices$ Permanent.YouDontCtrl+nonEnchantment | ChoiceAmount§ 4 | Defined$ ChosenCard | CounterType$ AIM | CounterNum$ 1 +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChoose | TriggerDescription$ When CARDNAME enters the battlefield, choose four nonenchantment permanents you don't control and put an aim counter on each of them. +SVar:TrigChoose:DB$ ChooseCard | Defined$ You | Amount$ 4 | Choices$ Permanent.YouDontCtrl+nonEnchantment | SubAbility$ DBPutCounter | AILogic$ AtLeast1 | Mandatory$ True +SVar:DBPutCounter:DB$ PutCounter | Defined$ ChosenCard | CounterType$ AIM | CounterNum$ 1 | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearChosenCard$ True T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | TriggerZones$ Battlefield | IsPresent$ Permanent.YouDontCtrl+counters_GE1_AIM | PresentCompare$ GE2 | Execute$ TrigDestroy | TriggerDescription$ At the beginning of your end step, if two or more permanents you don't control have an aim counter on them, destroy one of those permanents at random. SVar:TrigDestroy:DB$ ChooseCard | Amount$ 1 | AtRandom$ True | Choices$ Permanent.YouDontCtrl+counters_GE1_AIM | SubAbility$ DBDestroy SVar:DBDestroy:DB$ Destroy | Defined$ ChosenCard | SubAbility$ DBCleanup -SVar:DBCleanup:DB$ Cleanup | ClearChosenCard$ True +SVar:Picture:http://www.wizards.com/global/images/magic/general/haphazard_bombardment.jpg Oracle:When Haphazard Bombardment enters the battlefield, choose four nonenchantment permanents you don't control and put an aim counter on each of them.\nAt the beginning of your end step, if two or more permanents you don't control have an aim counter on them, destroy one of those permanents at random. diff --git a/forge-gui/res/cardsfolder/s/settle_the_score.txt b/forge-gui/res/cardsfolder/s/settle_the_score.txt index 4820ed006f0..08d18bef014 100644 --- a/forge-gui/res/cardsfolder/s/settle_the_score.txt +++ b/forge-gui/res/cardsfolder/s/settle_the_score.txt @@ -1,6 +1,7 @@ Name:Settle the Score ManaCost:2 B B Types:Sorcery -A:SP$ ChangeZone | Cost$ 2 B B | ValidTgts$ Creature | TgtPrompt$ Select target creature | Origin$ Battlefield | Destination$ Exile | SubAbility$ DBPutLoyalty | SpellDescription$ Exile target creature. Put two loyalty counters on a planeswalker you control. -SVar:DBPutLoyalty:DB$ PutCounter | Choices$ Planeswalker.YouCtrl | CounterType$ LOYALTY | CounterNum$ 2 +A:SP$ ChangeZone | Cost$ 2 B B | ValidTgts$ Creature | TgtPrompt$ Select target creature | Origin$ Battlefield | Destination$ Exile | SubAbility$ DBChoice | SpellDescription$ Exile target creature. Put two loyalty counters on a planeswalker you control. +SVar:DBChoice:DB$ ChooseCard | Choices$ Planeswalker.YouCtrl | Amount$ 1 | Mandatory$ True | SubAbility$ DBPutLoyalty +SVar:DBPutLoyalty:DB$ PutCounter | Defined$ ChosenCard | CounterType$ LOYALTY | CounterNum$ 2 Oracle:Exile target creature. Put two loyalty counters on a planeswalker you control. diff --git a/forge-gui/res/cardsfolder/t/the_elderspell.txt b/forge-gui/res/cardsfolder/t/the_elderspell.txt index 2255b8d308f..ec0e5f85773 100644 --- a/forge-gui/res/cardsfolder/t/the_elderspell.txt +++ b/forge-gui/res/cardsfolder/t/the_elderspell.txt @@ -1,8 +1,9 @@ Name:The Elderspell ManaCost:B B Types:Sorcery -A:SP$ Destroy | Cost$ B B | ValidTgts$ Planeswalker | TgtPrompt$ Select target planeswalker | TargetMin$ 0 | TargetMax$ MaxTargets | References$ MaxTargets | SubAbility$ DBPutLoyalty | RememberDestroyed$ True | SpellDescription$ Destroy any number of target planeswalkers. Choose a planeswalker you control. Put two loyalty counters on it for each planeswalker destroyed this way. -SVar:DBPutLoyalty:DB$ PutCounter | Choices$ Planeswalker.YouCtrl | CounterType$ LOYALTY | CounterNum$ X | References$ X | SubAbility$ DBCleanup +A:SP$ Destroy | Cost$ B B | ValidTgts$ Planeswalker | TgtPrompt$ Select target planeswalker | TargetMin$ 0 | TargetMax$ MaxTargets | References$ MaxTargets | SubAbility$ DBChooseCard | RememberDestroyed$ True | SpellDescription$ Destroy any number of target planeswalkers. Choose a planeswalker you control. Put two loyalty counters on it for each planeswalker destroyed this way. +SVar:DBChooseCard:DB$ ChooseCard | Defined$ You | Amount$ 1 | Choices$ Planeswalker.YouCtrl | Mandatory$ True | SubAbility$ DBPutLoyalty +SVar:DBPutLoyalty:DB$ PutCounter | Defined$ ChosenCard | CounterType$ LOYALTY | CounterNum$ X | References$ X | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:MaxTargets:Count$Valid Planeswalker SVar:X:Count$RememberedSize/Twice diff --git a/forge-gui/res/cardsfolder/upcoming/fully_grown.txt b/forge-gui/res/cardsfolder/upcoming/fully_grown.txt deleted file mode 100644 index edfefc1522a..00000000000 --- a/forge-gui/res/cardsfolder/upcoming/fully_grown.txt +++ /dev/null @@ -1,6 +0,0 @@ -Name:Fully Grown -ManaCost:2 G -Types:Instant -A:SP$ Pump | Cost$ 2 G | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +3 | NumDef$ +3 | SubAbility$ PutCounter | SpellDescription$ Target creature gets +3/+3 until end of turn. Put a trample counter on it. -SVar:PutCounter:DB$ PutCounter | Defined$ Targeted | CounterType$ TRAMPLE | CounterNum$ 1 -Oracle:Target creature gets +3/+3 until end of turn. Put a trample counter on it.