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 f28a59017d2..2e8cb693437 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -73,6 +73,7 @@ import io.sentry.Sentry; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.commons.lang3.tuple.Pair; +import org.apache.commons.lang3.tuple.Triple; import java.util.*; import java.util.Map.Entry; @@ -140,7 +141,7 @@ public class Card extends GameEntity implements Comparable, IHasSVars { private final Table changedCardKeywords = TreeBasedTable.create(); // Layer 6 // stores the keywords created by static abilities - private final Table storedKeywords = TreeBasedTable.create(); + private final Map, KeywordInterface> storedKeywords = Maps.newHashMap(); // x=timestamp y=StaticAbility id private final Table changedCardTraitsByText = TreeBasedTable.create(); // Layer 3 by Text Change @@ -4638,8 +4639,10 @@ public class Card extends GameEntity implements Comparable, IHasSVars { final boolean removeAllKeywords, final long timestamp, final long staticId, final boolean updateView) { List kws = Lists.newArrayList(); if (keywords != null) { + long idx = 1; for (String kw : keywords) { - kws.add(getKeywordForStaticAbility(kw, staticId)); + kws.add(getKeywordForStaticAbility(kw, staticId, idx)); + idx++; } } @@ -4653,45 +4656,46 @@ public class Card extends GameEntity implements Comparable, IHasSVars { } } - public final KeywordInterface getKeywordForStaticAbility(String kw, final long staticId) { + public final KeywordInterface getKeywordForStaticAbility(String kw, final long staticId, final long idx) { KeywordInterface result; - if (staticId < 1 || !storedKeywords.contains(staticId, kw)) { + Triple triple = Triple.of(kw, staticId, idx); + if (staticId < 1 || !storedKeywords.containsKey(triple)) { result = Keyword.getInstance(kw); result.setStaticId(staticId); result.createTraits(this, false); if (staticId > 0) { - storedKeywords.put(staticId, kw, result); + storedKeywords.put(triple, result); } } else { - result = storedKeywords.get(staticId, kw); + result = storedKeywords.get(triple); } return result; } public final void addKeywordForStaticAbility(KeywordInterface kw) { if (kw.getStaticId() > 0) { - storedKeywords.put(kw.getStaticId(), kw.getOriginal(), kw); + storedKeywords.put(Triple.of(kw.getOriginal(), kw.getStaticId(), 0l), kw); } } - public Table getStoredKeywords() { + public Map, KeywordInterface> getStoredKeywords() { return storedKeywords; } - public void setStoredKeywords(Table table, boolean lki) { + public void setStoredKeywords(Map, KeywordInterface> map, boolean lki) { storedKeywords.clear(); - for (Table.Cell c : table.cellSet()) { - storedKeywords.put(c.getRowKey(), c.getColumnKey(), getCopyForStoredKeyword(c, lki)); + for (Map.Entry, KeywordInterface> e : map.entrySet()) { + storedKeywords.put(e.getKey(), getCopyForStoredKeyword(e, lki)); } } - private final KeywordInterface getCopyForStoredKeyword(Table.Cell c, boolean lki) { + private final KeywordInterface getCopyForStoredKeyword(Map.Entry, KeywordInterface> e, boolean lki) { // for performance check if we already copied this if (lki) { - for (KeywordsChange kc : changedCardKeywords.column(c.getRowKey()).values()) { + for (KeywordsChange kc : changedCardKeywords.column(e.getKey().getMiddle()).values()) { // same static id for (KeywordInterface kw : kc.getKeywords()) { - if (kw.getOriginal().equals(c.getValue().getOriginal())) { + if (kw.getOriginal().equals(e.getValue().getOriginal())) { // same kw return kw; } @@ -4699,7 +4703,7 @@ public class Card extends GameEntity implements Comparable, IHasSVars { } } - return c.getValue().copy(this, lki); + return e.getValue().copy(this, lki); } public final void addChangedCardKeywordsByText(final List keywords, final long timestamp, final long staticId, final boolean updateView) { diff --git a/forge-gui/res/cardsfolder/a/abaddon_the_despoiler.txt b/forge-gui/res/cardsfolder/a/abaddon_the_despoiler.txt index df19079308f..86f323d29e4 100644 --- a/forge-gui/res/cardsfolder/a/abaddon_the_despoiler.txt +++ b/forge-gui/res/cardsfolder/a/abaddon_the_despoiler.txt @@ -3,6 +3,6 @@ ManaCost:2 U B R Types:Legendary Creature Astartes Warrior PT:5/5 K:Trample -S:Mode$ Continuous | EffectZone$ Battlefield | Condition$ PlayerTurn | Affected$ Card.YouCtrl+YouOwn+wasCastFromHand+cmcLEX | AffectedZone$ Stack | AddKeyword$ Cascade | Description$ Mark of Chaos Ascendant — During your turn, spells you cast from your hand with mana value X or less have cascade, where X is the total amount of life your opponents have lost this turn. +S:Mode$ Continuous | Condition$ PlayerTurn | Affected$ Card.YouCtrl+YouOwn+wasCastFromHand+cmcLEX | AffectedZone$ Stack | AddKeyword$ Cascade | Description$ Mark of Chaos Ascendant — During your turn, spells you cast from your hand with mana value X or less have cascade, where X is the total amount of life your opponents have lost this turn. SVar:X:Count$LifeOppsLostThisTurn -Oracle:Trample\nMark of Chaos Ascendant — During your turn, spells you cast from your hand with mana value X or less have cascade, where X is the total amount of life your opponents have lost this turn. \ No newline at end of file +Oracle:Trample\nMark of Chaos Ascendant — During your turn, spells you cast from your hand with mana value X or less have cascade, where X is the total amount of life your opponents have lost this turn. diff --git a/forge-gui/res/cardsfolder/upcoming/zhulodok_void_gorger.txt b/forge-gui/res/cardsfolder/upcoming/zhulodok_void_gorger.txt new file mode 100644 index 00000000000..725748be054 --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/zhulodok_void_gorger.txt @@ -0,0 +1,7 @@ +Name:Zhulodok, Void Gorger +ManaCost:5 C +Types:Legendary Creature Eldrazi +PT:7/4 +S:Mode$ Continuous | Affected$ Card.Colorless+YouCtrl+YouOwn+wasCastFromHand+cmcGE7 | AffectedZone$ Stack | AddKeyword$ Cascade & Cascade | Description$ Spells you cast with mana value 6 or greater have cascade. +DeckHints:Type$Eldrazi|Construct|Golem +Oracle:Colorless spells you cast from your hand with mana value 7 or greater have “Cascade, cascade.” (When you cast one, exile cards from the top of your library until you exile a nonland card that costs less. You may cast it without paying its mana cost. Put the exiled cards on the bottom of your library in a random order. Then do it again.)