improvements

This commit is contained in:
Northmoc
2023-10-25 16:01:52 -04:00
parent 0ac4047560
commit ffe39bb40f
4 changed files with 12 additions and 13 deletions

View File

@@ -2629,19 +2629,17 @@ public class AbilityUtils {
int max = 0; int max = 0;
List<Integer> rolls = c.getStoredRolls(); List<Integer> rolls = c.getStoredRolls();
if (rolls != null) { if (rolls != null) {
int lastNum = 1; int lastNum = 0;
int tally = 0;
for (int i = 0; i < rolls.size(); i++) { for (int i = 0; i < rolls.size(); i++) {
Integer roll = rolls.get(i); Integer roll = rolls.get(i);
if (roll.equals(lastNum)) { if (roll.equals(lastNum)) {
tally++; continue; // no need to count instances of the same roll multiple times
} else {
if (tally > max) {
max = tally;
}
lastNum = roll;
tally = 1;
} }
int tally = Collections.frequency(rolls, roll);
if (tally > max) {
max = tally;
}
lastNum = roll;
} }
} }
return doXMath(max, expr, c, ctb); return doXMath(max, expr, c, ctb);

View File

@@ -206,7 +206,7 @@ public class RollDiceEffect extends SpellAbilityEffect {
int total = rollDiceForPlayer(sa, player, amount, sides, ignore, modifier, rolls); int total = rollDiceForPlayer(sa, player, amount, sides, ignore, modifier, rolls);
if (sa.hasParam("StoreResults")) { if (sa.hasParam("StoreResults")) {
host.setStoredRolls(rolls); host.addStoredRolls(rolls);
} }
if (sa.hasParam("ResultSVar")) { if (sa.hasParam("ResultSVar")) {
sa.setSVar(sa.getParam("ResultSVar"), Integer.toString(total)); sa.setSVar(sa.getParam("ResultSVar"), Integer.toString(total));

View File

@@ -1290,11 +1290,12 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
} }
return forView; return forView;
} }
public final void setStoredRolls(final List<Integer> results) { public final void addStoredRolls(final List<Integer> results) {
if (storedRolls == null) { if (storedRolls == null) {
storedRolls = Lists.newArrayList(); storedRolls = Lists.newArrayList();
} }
storedRolls = results; storedRolls.addAll(results);
storedRolls.sort(null);
view.updateStoredRolls(this); view.updateStoredRolls(this);
} }
public final void replaceStoredRoll(final Map<Integer, Integer> replaceMap) { public final void replaceStoredRoll(final Map<Integer, Integer> replaceMap) {

View File

@@ -4,7 +4,7 @@ Types:Creature Beeble
PT:1/1 PT:1/1
K:Protection from Robots 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. 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: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:IgnoreRoll:DB$ ReplaceEffect | VarName$ IgnoreChosen | VarType$ Map | VarKey$ You | VarValue$ 1 | SubAbility$ DBExileEffect
SVar:DBExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile SVar:DBExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile