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;
List<Integer> 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);

View File

@@ -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));

View File

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

View File

@@ -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