UNPKG

salesman-minigames

Version:

A minigame library made with NodeJS.

127 lines (111 loc) 3.39 kB
/** * Represents the result of a Russian Roulette game. */ export class RussianRoulette { /** * Creates an instance of RussianRoulette. */ constructor(); /** * Processes the game result and sets status properties. * @returns The survival status (true if survived, false if exploded). */ run(): boolean; /** * Gets the win or lose boolean value. * @returns True if survived, false if exploded. */ getWinStat(): boolean; /** * Gets the status as a string. * @returns "Un-Exploded" if survived, "Exploded" if not. */ getStat(): string; /** * Gets the status as a boolean. * @returns True if survived, false if exploded, null if not set. */ getStatBool(): boolean | null; } /** * Represents the Rock-Paper-Scissors Minus One game. */ export class RPSMinusOne { /** * @param p1Choices - Player 1's two choices (e.g. ["rock", "scissors"]) * @param p1RemoveIndex - Player 1's index of choice to remove (0 or 1) * @param p2Choices - Player 2's two choices (e.g. ["paper", "rock"]) * @param p2RemoveIndex - Player 2's index of choice to remove (0 or 1) */ constructor( p1Choices: [string, string], p1RemoveIndex: 0 | 1, p2Choices: [string, string], p2RemoveIndex: 0 | 1 ); /** * Executes the game logic and determines the winner. * @returns The winner: "player1", "player2", "draw" or null if invalid input. */ play(): "player1" | "player2" | "draw" | null; /** * Gets the winner of the game. * @returns The winner: "player1", "player2", "draw" or null. */ getWinner(): "player1" | "player2" | "draw" | null; /** * Gets the status message describing the game result. * @returns Status string. */ getStatus(): string; } /** * Represents the Dice Roll Challenge game. */ export class DiceRollChallenge { /** * @param p1Roll - Player 1's dice roll (1-6). * @param p2Roll - Player 2's dice roll (1-6). */ constructor(p1Roll: number, p2Roll: number); /** * Executes the dice roll game logic. * @returns The winner: "player1", "player2", "draw" or null if invalid input. */ play(): "player1" | "player2" | "draw" | null; /** * Gets the winner of the dice roll challenge. * @returns The winner: "player1", "player2", "draw" or null. */ getWinner(): "player1" | "player2" | "draw" | null; /** * Gets the status message describing the dice roll result. * @returns Status string. */ getStatus(): string; } /** * Represents the Coin Flip Duel game. */ export class CoinFlipDuel { /** * @param p1Choice - Player 1's choice: "heads" or "tails". * @param p2Choice - Player 2's choice: "heads" or "tails". */ constructor(p1Choice: "heads" | "tails", p2Choice: "heads" | "tails"); /** * Executes the coin flip duel. * @returns The winner: "player1", "player2", "draw" or null if invalid input. */ play(): "player1" | "player2" | "draw" | null; /** * Gets the winner of the coin flip duel. * @returns The winner: "player1", "player2", "draw" or null. */ getWinner(): "player1" | "player2" | "draw" | null; /** * Gets the status message describing the coin flip result. * @returns Status string. */ getStatus(): string; }