Browse Source

feat: Dice 'variants' (in this case successCufOff)

Version bump to v0.3.0

UI needs work in different areas:
	- group hiding/collapsing of variants [straightforward]
	- asyncify [might be fine, might blow everything up]
tags/v0.3.0^0
bertieb 3 years ago
parent
commit
2e3c69d151
2 changed files with 21 additions and 16 deletions
  1. +1
    -1
      package.json
  2. +20
    -15
      src/ts/frontend.ts

+ 1
- 1
package.json View File

@@ -1,6 +1,6 @@
{
"name": "asphodice",
"version": "0.2.0",
"version": "0.3.0",
"description": "Dice roller for Asphodel. Includes statistical information",
"devDependencies": {
"@types/chai": "^4.2.14",


+ 20
- 15
src/ts/frontend.ts View File

@@ -368,7 +368,8 @@ function resultsHeader(resultProperties: ResultProperties): string {
resultsTitle += `<div>`
+ bigTitle(`Asphodice Results
<small class="h4 text-muted">
(<var>d=${resultProperties.numDice}</var>)
(<var>d=${resultProperties.numDice}</var>,
<var>${resultProperties.diceVariant}</var>)
</small>`)
+ `</div>`;
resultsTitle += `<div>
@@ -388,7 +389,7 @@ function resultsHeader(resultProperties: ResultProperties): string {
*/

function resultsBody(resultProperties: ResultProperties): string {
let resultsBodyId = `resultsBody-${resultProperties.numDice}`;
let resultsBodyId = `resultsBody-${resultProperties.itemId()}`;
let resultsBody = `<div id="${resultsBodyId}" class="show row resultsToggle ${resultProperties.variantClass()}">`;
resultsBody += describeRolls(resultProperties);
resultsBody += rerollReport(resultProperties)
@@ -457,19 +458,23 @@ function getResults():void {
$("#results").append(resultsControlCard);

let maxDice = 10;
for (let i = 1; i < maxDice; i++) {
let rsSetup = { numDice: i };
let rollstats = new RollStats(rsSetup);
let resultProperties = new ResultProperties({
rollstats: rollstats,
diceClass: "asphodice",
diceVariant: "c6",
numDice: i,
});
rollstats.doRolls();
addResults(resultProperties);
$("#resultsProgress").width(`${i/maxDice*100}%`);
$("#resultsProgress").text(`${i/maxDice*100}%`);
let cutoffStart = 6;
let cutoffMax = 9;
for (let cutoff = cutoffStart; cutoff <= cutoffMax; cutoff++) {
for (let i = 1; i < maxDice; i++) {
let rsSetup = { numDice: i, diceOptions: { successCutOff: cutoff } };
let rollstats = new RollStats(rsSetup);
let resultProperties = new ResultProperties({
rollstats: rollstats,
diceClass: "asphodice",
diceVariant: `c${cutoff}`,
numDice: i,
});
rollstats.doRolls();
addResults(resultProperties);
$("#resultsProgress").width(`${i/maxDice*100}%`);
$("#resultsProgress").text(`${i/maxDice*100}%`);
}
}
console.log("Results done!");
$("#resultsProgress").width("100%");


Loading…
Cancel
Save