Skip to content

Commit

Permalink
Add in-battle mod detection to /weak and /coverage (#5144)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuddenlyQ authored and HoeenCoder committed Feb 9, 2019
1 parent 248e7ed commit 0796613
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions server/chat-plugins/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,15 @@ const commands = {
if (!this.runBroadcast()) return;
target = target.trim();
let modName = target.split(',');
let mod = Dex.mod(toId(modName[modName.length - 1])) || Dex;
let mod = Dex;
/** @type {Format?} */
let format = null;
if (modName[modName.length - 1] && toId(modName[modName.length - 1]) in Dex.dexes) {
mod = Dex.mod(toId(modName[modName.length - 1]));
} else if (room && room.battle) {
format = Dex.getFormat(room.battle.format);
mod = Dex.mod(format.mod);
}
let targets = target.split(/ ?[,/] ?/);
/** @type {{types: string[], [k: string]: any}} */
let pokemon = mod.getTemplate(targets[0]);
Expand Down Expand Up @@ -831,8 +839,14 @@ const commands = {

let targets = target.split(/[,+]/);
let sources = [];
let mod = Dex.mod(toId(targets[targets.length - 1])) || Dex;

let mod = Dex;
if (room && room.battle) {
let format = Dex.getFormat(room.battle.format);
mod = Dex.mod(format.mod);
}
if (targets[targets.length - 1] && toId(targets[targets.length - 1]) in Dex.dexes) {
mod = Dex.mod(toId(targets[targets.length - 1]));
}
let dispTable = false;
let bestCoverage = {};
let hasThousandArrows = false;
Expand Down

0 comments on commit 0796613

Please sign in to comment.