npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

discord-fight-game

v1.0.3

Published

An module to make a Player VS Player game for discord bots.

Downloads

52

Readme

Installations

npm i discord-fight-game

What ?

This package is to make a PVP game for discord bots, Both Solo and Duo mode available.

Why ?

  • Easy to use.
  • Highly Customizable. ( works with 0 configuration too )
  • Fast and advanced.

Note

  • Supports Discord.js V-13 and above.

How ?

const game = require('discord-fight-game');
const fight = new game(client); // Your discord Client

/**
  * An solo mode for fighting game, User VS Bot.
  * @param {Discord.Message} message The message in which command was used
  */
fight.solo(mesage);

/**
 * An duo mode for fighting game, User1 VS User2.
 * @param {Discord.Message} message The message in which command was used
 * @param {Discord.User} player2 The player 2
 */
fight.duo(message,player2) 

Advanced

Custom Messages And Buttons

const game = require('discord-fight-game');

const fight = new game(client, {
    // Settings
    moveTime: 30000,

    // Custom Buttons
    oneName: "Sword",
    oneEmoji: "🤺",
    twoName: "Bow",
    twoEmoji: "🏹",
    threeName: "Shield",
    threeEmoji: "🛡",
    endName: "End Game",
    endEmoji: "🛑",

    // Custom Messages
    startMessage: "The war has begun, get ready warriors",
    midMessage: "The fighters chose their move, Current battle condition :",
    endMessage: "{winner} gloriously defeated {looser}",
    forceEndMessage: "{user} was scared so they ended the war",
    timeEndMessage: "{user} ran away from the war",
})

Custom Game logic

const game = require('discord-fight-game');

const fight = new game(client,{
    //  Starting health of players
    startHealth: 69,

    // Melee move's settings ( First / One Move )
    maxMelee: 18, // Maximum Melee damage possible
    minMelee: 5, // Minimum Melee damage possible
    meleeSuccessRate: 50, // Chance of successful attack
    meleeTimeoutRate: 30, // Chances of getting timedout from using Melee attack again

    // Ranged move's settings ( Second / Two Move )
    maxRanged: 12, // Maximum Ranged damage possible
    minRanged: 6, // Minimum Ranged damage possible
    rangedSuccessRate: 70, // Chance of successful attack
    rangedTimeoutRate: 20, // Chances of getting timedout from using Ranged attack again

    // Defense move's settings ( Third / Three Move )
    maxDefense: 10, // Maximum defense damage possible
    minDefense: 2, // Minimum defense damage possible
    defenseSuccessRateAgainstDefense: 50, // Chance of successful defense against defense
    defenseSuccessRateAgainstMelee: 60, // Chance of successful defense against Melee
    defenseSuccessRateAgainstRanged: 35, // Chance of successful defense against Ranged
    defenseTimeoutRate: 55,// Chances of getting timedout from using defense again  
});

All Available Options

/**
  * @typedef {Object} Options The options of fighting module
  * @property {String} startMessage The message title during game's starting
  * @property {String} midMessage The message title when both user chose their move
  * @property {String} endMessage The message title at the end of the game
  * @property {String} forceEndMessage The message title when game is ended forcefully
  * @property {String} timeEndMessage The message title when user didn't responded to bot's DM
  * @property {String} oneName First move's name
  * @property {String} oneEmoji First move's emoji
  * @property {String} twoName Second move's name
  * @property {String} twoEmoji Second move's emoji
  * @property {String} threeName Third move's name
  * @property {String} threeEmoji Third move's emoji
  * @property {String} endName Game end's name
  * @property {String} endEmoji Game end's emoji
  * @property {Number} startHealth The starting health of players
  * @property {Number} defenseSuccessRateAgainstDefense Success rate of defending against enemy defending
  * @property {Number} defenseSuccessRateAgainstMelee Success rate of defending against enemy using melee move
  * @property {Number} defenseSuccessRateAgainstRanged Success rate of defending against enemy using ranged move
  * @property {Number} maxDefense Maximum defense points
  * @property {Number} minDefense Minimum defense points
  * @property {Number} defenseTimeoutRate Chances to get timeout to use defense move
  * @property {Number} maxMelee Maximum Melee points
  * @property {Number} minMelee Minimum Melee points
  * @property {Number} meleeSuccessRate Chances of Melee move success
  * @property {Number} meleeTimeoutRate Chances to get timeout to use melee move
  * @property {Number} maxRanged Maximum Ranged points
  * @property {Number} minRanged Minimum Ranged points
  * @property {Number} rangedTimeoutRate Chances to get timeout to use ranged move
  * @property {Number} rangedSuccessRate Chances of Ranged move success
  */

Supports

For support or issues or queries contace me on my discord server.