Skip to content

Commit

Permalink
Multiple Output Improvements (#2)
Browse files Browse the repository at this point in the history
* Display difficulty in skill roll output

Shows the difficulty of the roll as part of the 'Sucessess'
output on the skill roll, so it is clear what difficulty you were
rolling against.

Also I changed the default for difficulty to be 0 if it is omitted
on the command line, if this should not be possible then the command
parsing should be checked over.

* Add emoji dice to combat rolls

Changes the dice displayed in the results of a combat role to
emoji representing the faces of a Fallout 2d20 combat die.

* Replace combat roll filler text

The filler text at the top of combat rolls was still the 'success'
and 'failure' text from the skill roll. It has now been replaced
with combat appropriate text showing the difference between hits for
0 damage, regular damage, or criticals.

* Remove critical text

Remove critical related text as critical hits are not certain.

* Add a backup of the emoji images
  • Loading branch information
HarkonenBade authored Sep 19, 2021
1 parent 7f684e8 commit 94c7fdb
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 14 deletions.
Binary file added docs/images/emoji/CD_BLK.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/emoji/CD_EFT.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/emoji/CD_ONE.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/emoji/CD_TWO.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/images/emoji/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
© 1997-2021 Bethesda Softworks LLC, a ZeniMax Media company. Bethesda Softworks, ZeniMax and related logos are registered trademarks or trademarks of ZeniMax Media Inc. in the U.S. and/or other countries. Fallout and related logos are trademarks or registered trademarks of Bethesda Softworks LLC in the U.S. and/or other countries. All Rights Reserved.
Ownership and copyright over the images in the folder remains with the original rights holders.
3 changes: 3 additions & 0 deletions docs/images/emoji/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Emoji Image Backup

In the event that the custom emoji used by the dice rolling system are no longer available, the images provided can be used to recreate them and restore the references in `src/utils/rolls/combat-roll.ts`.
12 changes: 6 additions & 6 deletions src/commands/rolls/combat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CombatRollCommand extends Command {
}

private getResultsText = (results: CombatRollData[]): string =>
`[ ${results.map((r) => r.output).join(", ")} ]`;
`[ ${results.map((r) => r.output).join(" ")} ]`;

private rerollOne = (
message: CommandoMessage,
Expand Down Expand Up @@ -120,12 +120,12 @@ class CombatRollCommand extends Command {
name: "main",
content: new MessageEmbed({
...getAuthorData(this.client),
title: success ? "Success!" : "Failure!",
color: success ? successColor : failureColor,
title: damage > 0 ? "Hit!" : "Miss!",
color: damage > 0 ? successColor : failureColor,

description: success
? "> Your efforts will help build a better tomorrow!"
: "> Please report to your Overseer to determine remedial actions.",
description: damage > 0
? "> A solid hit, they are gonna feel that tomorrow!"
: "> It goes wide, better luck next time.",
fields: [
{
name: "Damage",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/rolls/skill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class SkillRollCommand extends Command {
fields: [
{
name: "Successes",
value: `${successes}${complicated ? " ⚠️" : ""}`,
value: `${successes}/${options.difficulty} ${complicated ? " ⚠️" : ""}`,
inline: true,
},
{
Expand Down Expand Up @@ -179,7 +179,7 @@ class SkillRollCommand extends Command {
.slice(1)
.find((arg) => /^-?[\d.]+(?:e-?\d+)?$/.test(arg));
const difficulty =
(difficultyString && parseInt(difficultyString)) || undefined;
(difficultyString && parseInt(difficultyString)) || 0;

let dice: number | undefined;
let tag: number | undefined;
Expand Down
19 changes: 13 additions & 6 deletions src/utils/rolls/combat-roll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,20 @@ export interface CombatRollResult {
}

const getOutput = (value: number, effect: number): string => {
let output = `${value}`;

if (value > 0) {
output = effect ? `_**${value}**_` : `_${value}_`;
switch (value) {
case 1:
return `<:CD_ONE:889203020510933044>`;
case 2:
return `<:CD_TWO:889203051599114281>`;
case 3:
case 4:
return `<:CD_BLK:889203068091113583>`;
case 5:
case 6:
return `<:CD_EFT:889203079981957151>`;
default:
return `${value}`;
}

return output;
};

const getDamage = (value: number) => {
Expand Down

0 comments on commit 94c7fdb

Please sign in to comment.