Skip to content

Commit

Permalink
/calc: Update credits and add Battle Spot calculator (#5554)
Browse files Browse the repository at this point in the history
  • Loading branch information
LegoFigure11 authored and Zarel committed Jun 25, 2019
1 parent c1dde23 commit cb60a80
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions server/chat-plugins/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -1520,31 +1520,47 @@ const commands = {
},

'!calc': true,
bsscalc: 'calc',
calculator: 'calc',
cantsaycalc: 'calc',
damagecalculator: 'calc',
damagecalc: 'calc',
honkalculator: 'calc',
honkocalc: 'calc',
randomscalc: 'calc',
randbatscalc: 'calc',
rcalc: 'calc',
calc(target, room, user, connection, cmd) {
if (cmd === 'calc' && target) return this.parse(`/math ${target}`);
if (!this.runBroadcast()) return;
const DEFAULT_CALC_COMMANDS = ['honkalculator', 'honkocalc'];
const RANDOMS_CALC_COMMANDS = ['randomscalc', 'randbatscalc', 'rcalc'];
const BATTLESPOT_CALC_COMMANDS = ['bsscalc', 'cantsaycalc'];
const SUPPORTED_RANDOM_FORMATS = ['gen7randombattle', 'gen7unratedrandombattle'];
const SUPPORTED_BATTLESPOT_FORMATS = ['gen5gbusingles', 'gen5gbudoubles', 'gen6battlespotsingles', 'gen6battlespotdoubles', 'gen6battlespottriples', 'gen7battlespotsingles', 'gen7battlespotdoubles', 'gen7bssfactory'];
const isRandomBattle = (room && room.battle && SUPPORTED_RANDOM_FORMATS.includes(room.battle.format));
if (['randomscalc', 'randbatscalc', 'rcalc'].includes(cmd) || isRandomBattle) {
const isBattleSpotBattle = (room && room.battle && (SUPPORTED_BATTLESPOT_FORMATS.includes(room.battle.format) || room.battle.format.includes("battlespotspecial")));
if (RANDOMS_CALC_COMMANDS.includes(cmd) || (isRandomBattle && !DEFAULT_CALC_COMMANDS.includes(cmd) && !BATTLESPOT_CALC_COMMANDS.includes(cmd))) {
return this.sendReplyBox(
`Random Battles damage calculator. (Courtesy of LegoFigure11 &amp; Smoochyena)<br />` +
`Random Battles damage calculator. (Courtesy of LegoFigure11 &amp; Wiggleetuff)<br />` +
`- <a href="https://randbatscalc.github.io/">Random Battles Damage Calculator</a>`
);
}
if (BATTLESPOT_CALC_COMMANDS.includes(cmd) || (isBattleSpotBattle && !DEFAULT_CALC_COMMANDS.includes(cmd))) {
return this.sendReplyBox(
`Battle Spot damage calculator. (Courtesy of cant say &amp; LegoFigure11)<br />` +
`- <a href="https://cantsay.github.io/">Battle Spot Damage Calculator</a>`
);
}
this.sendReplyBox(
`Pok&eacute;mon Showdown! damage calculator. (Courtesy of Honko)<br />` +
`Pok&eacute;mon Showdown! damage calculator. (Courtesy of Honko &amp; Austin)<br />` +
`- <a href="https://pokemonshowdown.com/damagecalc/">Damage Calculator</a>`
);
},
calchelp: [
`/calc - Provides a link to a damage calculator`,
`/rcalc - Provides a link to the random battles damage calculator`,
`/bsscalc - Provides a link to the Battle Spot damage calculator`,
`!calc - Shows everyone a link to a damage calculator. Requires: + % @ # & ~`,
],

Expand Down

0 comments on commit cb60a80

Please sign in to comment.