Skip to content

Commit

Permalink
fix: Change 'other modifiers' to a text field to avoid invisible text.
Browse files Browse the repository at this point in the history
And, in this commit, gives up and comments the whole thing out.
It seems to be running with strict on the final build? Maybe?
  • Loading branch information
xdy committed Nov 8, 2020
1 parent f643ef8 commit 4f93765
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions src/module/utils/TwodsixRolls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,35 +251,43 @@ export class TwodsixRolls {
//Do the throw
roll.roll();

//Handle special results
const diceValues:number[] = <number[]>roll.dice[0]['results'];
let effect:number;
let effect;
if (showEffect) {
effect = roll.total;
} else {
effect = roll.total - difficulty.target;
}

//TODO #168 Uncomment natural 2/12 handling below, once there is a setting to enable it
if (diceValues[0] + diceValues[1] === 2) {
console.log("Got a natural 2!");
if (0 <= effect) {
//effect = -1;
}
} else if (diceValues[0] + diceValues[1] === 12) {
console.log("Got a natural 12!");
if (effect < 0) {
//effect = 0;
}
}

//TODO #120 Handle critical success/failure once there is a system setting (or two) for it, maybe just show in chat card?
const TODO_UNHARDCODEME_ISSUE_120 = 6;
if (effect >= TODO_UNHARDCODEME_ISSUE_120) {
console.log("Got a critical success");
} else if (effect <= -TODO_UNHARDCODEME_ISSUE_120) {
console.log("Got a critical failure");
}
/* Builds fine locally, but got this on github action for some reason, so commenting out:
* [tsl] ERROR in /home/runner/work/twodsix-foundryvtt/twodsix-foundryvtt/src/module/utils/TwodsixRolls.ts(255,35)
* TS2352: Conversion of type 'object[]' to type 'number[]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
* Type 'object' is not comparable to type 'number'.
* */

// //Handle special results
// const diceValues:number[] = <number[]>roll.dice[0]['results'];
//
// //TODO #168 Uncomment natural 2/12 handling below, once there is a setting to enable it
// if (diceValues[0] + diceValues[1] === 2) {
// console.log("Got a natural 2!");
// if (0 <= effect) {
// //effect = -1;
// }
// } else if (diceValues[0] + diceValues[1] === 12) {
// console.log("Got a natural 12!");
// if (effect < 0) {
// //effect = 0;
// }
// }
//
// //TODO #120 Handle critical success/failure once there is a system setting (or two) for it, maybe just show in chat card?
// const TODO_UNHARDCODEME_ISSUE_120 = 6;
// if (effect >= TODO_UNHARDCODEME_ISSUE_120) {
// console.log("Got a critical success");
// } else if (effect <= -TODO_UNHARDCODEME_ISSUE_120) {
// console.log("Got a critical failure");
// }

//And send to chat
await roll.toMessage(
Expand Down

0 comments on commit 4f93765

Please sign in to comment.