Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Output Improvements #2

Merged
merged 5 commits into from
Sep 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
DTCurrie marked this conversation as resolved.
Show resolved Hide resolved

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}`;
DTCurrie marked this conversation as resolved.
Show resolved Hide resolved
}

return output;
};

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