deno fmt & sonar fix
This commit is contained in:
parent
a06042e6d4
commit
edac1db702
|
@ -565,21 +565,21 @@ export const roll = (rollStr: string, maximiseRoll: boolean, nominalRoll: boolea
|
||||||
const rollVals: Array<number> = new Array(rollConf.dieSize).fill(0);
|
const rollVals: Array<number> = new Array(rollConf.dieSize).fill(0);
|
||||||
|
|
||||||
// Sum up all rolls
|
// Sum up all rolls
|
||||||
for (const roll of rollSet) {
|
for (const ovaRoll of rollSet) {
|
||||||
loggingEnabled && log(LT.LOG, `handling ${rollType} ${rollStr} | incrementing rollVals for ${roll}`);
|
loggingEnabled && log(LT.LOG, `handling ${rollType} ${rollStr} | incrementing rollVals for ${ovaRoll}`);
|
||||||
rollVals[roll.roll - 1] += roll.roll;
|
rollVals[ovaRoll.roll - 1] += ovaRoll.roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find max value, using lastIndexOf to use the greatest die size max in case of duplicate maximums
|
// Find max value, using lastIndexOf to use the greatest die size max in case of duplicate maximums
|
||||||
const maxRoll = rollVals.lastIndexOf(Math.max(...rollVals)) + 1;
|
const maxRoll = rollVals.lastIndexOf(Math.max(...rollVals)) + 1;
|
||||||
|
|
||||||
// Drop all dice that are not a part of the max
|
// Drop all dice that are not a part of the max
|
||||||
for (let i = 0; i < rollSet.length; i++) {
|
for (const ovaRoll of rollSet) {
|
||||||
loggingEnabled && log(LT.LOG, `handling ${rollType} ${rollStr} | checking if this roll should be dropped ${rollSet[i].roll} | to keep: ${maxRoll}`);
|
loggingEnabled && log(LT.LOG, `handling ${rollType} ${rollStr} | checking if this roll should be dropped ${ovaRoll.roll} | to keep: ${maxRoll}`);
|
||||||
if (rollSet[i].roll !== maxRoll) {
|
if (ovaRoll.roll !== maxRoll) {
|
||||||
rollSet[i].dropped = true;
|
ovaRoll.dropped = true;
|
||||||
rollSet[i].critFail = false;
|
ovaRoll.critFail = false;
|
||||||
rollSet[i].critHit = false;
|
ovaRoll.critHit = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue