deno fmt & sonar fix
This commit is contained in:
		
							parent
							
								
									a06042e6d4
								
							
						
					
					
						commit
						edac1db702
					
				|  | @ -106,13 +106,13 @@ export const roll = (rollStr: string, maximiseRoll: boolean, nominalRoll: boolea | ||||||
| 	} else { | 	} else { | ||||||
| 		// roll20 dice setup
 | 		// roll20 dice setup
 | ||||||
| 		rollConf.dieCount = parseInt(tempDC); | 		rollConf.dieCount = parseInt(tempDC); | ||||||
| 	 | 
 | ||||||
| 		// Finds the end of the die size/beginnning of the additional options
 | 		// Finds the end of the die size/beginnning of the additional options
 | ||||||
| 		let afterDieIdx = dpts[0].search(/\D/); | 		let afterDieIdx = dpts[0].search(/\D/); | ||||||
| 		if (afterDieIdx === -1) { | 		if (afterDieIdx === -1) { | ||||||
| 			afterDieIdx = dpts[0].length; | 			afterDieIdx = dpts[0].length; | ||||||
| 		} | 		} | ||||||
| 	 | 
 | ||||||
| 		// Get the die size out of the remains and into the rollConf
 | 		// Get the die size out of the remains and into the rollConf
 | ||||||
| 		rollConf.dieSize = parseInt(remains.slice(0, afterDieIdx)); | 		rollConf.dieSize = parseInt(remains.slice(0, afterDieIdx)); | ||||||
| 		remains = remains.slice(afterDieIdx); | 		remains = remains.slice(afterDieIdx); | ||||||
|  | @ -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