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

Fixes rps so it works with dot prefix #475

Merged
merged 3 commits into from
Apr 22, 2023
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
4 changes: 2 additions & 2 deletions src/codeyCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ export class CodeyCommand extends SapphireCommand {
}
}

// Move the "argument picker" by one parameter if subcommand name is defined
if (subcommandName) {
// Move the "argument picker" by one parameter if subcommand name is a string
if (isNaN(parseInt(subcommandName))) {
await commandArgs.pick('string');
}
const args: CodeyCommandArguments = {};
Expand Down
10 changes: 6 additions & 4 deletions src/components/games/rps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class RpsGameTracker {
if (!game.state.player2Id) {
await adjustCoinBalanceByUserId(
game.state.player1Id,
-game.state.bet / 2,
-Math.floor(game.state.bet / 2),
UserCoinEvent.RpsDrawAgainstCodey,
);
}
Expand Down Expand Up @@ -222,9 +222,11 @@ export class RpsGame {
} ${getCoinEmoji()} from ${this.state.player1Username}!`;
case RpsGameStatus.Draw:
if (!this.state.player2Id) {
return `The match ended in a draw, so ${this.state.player2Username} has taken ${
this.state.bet / 2
} ${getCoinEmoji()} from ${this.state.player1Username}!`;
return `The match ended in a draw, so ${
this.state.player2Username
} has taken ${Math.floor(this.state.bet / 2)} ${getCoinEmoji()} from ${
this.state.player1Username
}!`;
} else {
return `The match ended in a draw!`;
}
Expand Down