From ffe39bb40f55c734e6bb10937178925a3d0465f8 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Wed, 25 Oct 2023 16:01:52 -0400 Subject: [PATCH] improvements --- .../java/forge/game/ability/AbilityUtils.java | 16 +++++++--------- .../game/ability/effects/RollDiceEffect.java | 2 +- .../src/main/java/forge/game/card/Card.java | 5 +++-- .../res/cardsfolder/b/bamboozling_beeble.txt | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java index b5bd5ca9647..420db29504b 100644 --- a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java +++ b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java @@ -2629,19 +2629,17 @@ public class AbilityUtils { int max = 0; List rolls = c.getStoredRolls(); if (rolls != null) { - int lastNum = 1; - int tally = 0; + int lastNum = 0; for (int i = 0; i < rolls.size(); i++) { Integer roll = rolls.get(i); if (roll.equals(lastNum)) { - tally++; - } else { - if (tally > max) { - max = tally; - } - lastNum = roll; - tally = 1; + continue; // no need to count instances of the same roll multiple times } + int tally = Collections.frequency(rolls, roll); + if (tally > max) { + max = tally; + } + lastNum = roll; } } return doXMath(max, expr, c, ctb); diff --git a/forge-game/src/main/java/forge/game/ability/effects/RollDiceEffect.java b/forge-game/src/main/java/forge/game/ability/effects/RollDiceEffect.java index 8dd6210b749..a12c6629308 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/RollDiceEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/RollDiceEffect.java @@ -206,7 +206,7 @@ public class RollDiceEffect extends SpellAbilityEffect { int total = rollDiceForPlayer(sa, player, amount, sides, ignore, modifier, rolls); if (sa.hasParam("StoreResults")) { - host.setStoredRolls(rolls); + host.addStoredRolls(rolls); } if (sa.hasParam("ResultSVar")) { sa.setSVar(sa.getParam("ResultSVar"), Integer.toString(total)); 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 5d779d38763..b28e682aa48 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -1290,11 +1290,12 @@ public class Card extends GameEntity implements Comparable, IHasSVars { } return forView; } - public final void setStoredRolls(final List results) { + public final void addStoredRolls(final List results) { if (storedRolls == null) { storedRolls = Lists.newArrayList(); } - storedRolls = results; + storedRolls.addAll(results); + storedRolls.sort(null); view.updateStoredRolls(this); } public final void replaceStoredRoll(final Map replaceMap) { diff --git a/forge-gui/res/cardsfolder/b/bamboozling_beeble.txt b/forge-gui/res/cardsfolder/b/bamboozling_beeble.txt index 9a373683779..3901b6d6993 100644 --- a/forge-gui/res/cardsfolder/b/bamboozling_beeble.txt +++ b/forge-gui/res/cardsfolder/b/bamboozling_beeble.txt @@ -4,7 +4,7 @@ Types:Creature Beeble PT:1/1 K:Protection from Robots A:AB$ Effect | Cost$ 1 T | ValidTgts$ Player | ReplacementEffects$ RigRoll | RememberObjects$ Targeted | ExileOnMoved$ Battlefield | SpellDescription$ The next time target player would roll one or more dice this turn, instead they roll that many dice plus one and you choose one of those rolls to ignore. -SVar:RigRoll:Event$ RollDice | ActiveZones$ Command | ValidPlayer$ Player.IsRemembered | ReplaceWith$ PlusRoll | Description$ The next time target player would roll one or more dice this turn, instead they roll that many dice plus one and you choose one of those rolls to ignore. +SVar:RigRoll:Event$ RollDice | ValidPlayer$ Player.IsRemembered | ReplaceWith$ PlusRoll | Description$ The next time target player would roll one or more dice this turn, instead they roll that many dice plus one and you choose one of those rolls to ignore. SVar:PlusRoll:DB$ ReplaceEffect | VarName$ Number | VarValue$ ReplaceCount$Number/Plus.1 | SubAbility$ IgnoreRoll SVar:IgnoreRoll:DB$ ReplaceEffect | VarName$ IgnoreChosen | VarType$ Map | VarKey$ You | VarValue$ 1 | SubAbility$ DBExileEffect SVar:DBExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile