Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Zarel/Pokemon-Showdown in…
Browse files Browse the repository at this point in the history
…to HEAD
  • Loading branch information
Morfent committed Sep 19, 2017
2 parents ddb4153 + 8315e8a commit 9ea8bac
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 40 deletions.
14 changes: 6 additions & 8 deletions chat-plugins/trivia.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,12 @@ class Trivia extends Rooms.RoomGame {
}
// Formats the player list for display when using /trivia players.
formatPlayerList() {
return Object.keys(this.players)
.map(userid => {
let player = this.players[userid];
let username = player.name;
if (player.isAbsent) return `<span style="color: #444444">${username}</span>`;
return username;
})
.join(', ');
return Object.values(this.players)
.sort(function (p1, p2) {return p2.points - p1.points; })
.map(player => {
const usernamePoints = `${player.name} (${player.points})`;
return player.isAbsent ? `<span style="color: #444444">${usernamePoints}</span>` : usernamePoints;
}).join(', ');
}

// Kicks a player from the game, preventing them from joining it again
Expand Down
24 changes: 18 additions & 6 deletions config/config-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,28 @@
// The server port - the port to run Pokemon Showdown under
exports.port = 8000;

// The server bind address - the address to run Pokemon Showdown under
// This should be left set to 0.0.0.0 unless you know what you are doing.
// The server address - the address at which Pokemon Showdown should be hosting
// This should be kept set to 0.0.0.0 unless you know what you're doing.
exports.bindaddress = '0.0.0.0';

// workers - the number of sockets workers to spawn
// This should not be set any higher than the number of cores available on
// the server's CPU(s). This can be checked from a REPL using
// require('os').cpus().length if you are unsure.
// workers - the number of networking child processes to spawn
// This should be no greater than the number of threads available on your
// server's CPU. If you're not sure how many you have, you can check from a
// terminal by running:
//
// $ node -e "console.log(require('os').cpus().length)"
//
// Using more workers than there are available threads will cause performance
// issues. Keeping a couple threads available for use for OS-related work and
// other PS processes will likely give you the best performance, if your
// server's CPU is capable of multithreading. If you don't know what any of
// this means or you are unfamiliar with PS' networking code, leave this set
// to 1.
exports.workers = 1;

// TODO: allow SSL to actually be possible to use for third-party servers at
// some point.

// golang - toggle using Go instead of Node for sockets workers
// Node workers are more unstable at handling connections because of bugs in
// sockjs-node, but sending/receiving messages over connections on Go workers
Expand Down
19 changes: 5 additions & 14 deletions config/formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,8 @@ exports.Formats = [
],

mod: 'gen7',
searchShow: false,
ruleset: ['Pokemon', 'Standard', 'Team Preview'],
banlist: ['Uber', 'Power Construct', 'Shadow Tag', 'Baton Pass'],
},
{
name: "[Gen 7] OU (suspect test)",
desc: ["&bullet; <a href=\"https://www.smogon.com/forums/threads/3613890/\">OU Suspect Test</a>"],

mod: 'gen7',
challengeShow: false,
ruleset: ['[Gen 7] OU'],
banlist: ['Arena Trap'],
banlist: ['Uber', 'Arena Trap', 'Power Construct', 'Shadow Tag', 'Baton Pass'],
},
{
name: "[Gen 7] Ubers",
Expand Down Expand Up @@ -93,7 +83,7 @@ exports.Formats = [

mod: 'gen7',
ruleset: ['[Gen 7] UU'],
banlist: ['UU', 'BL2'],
banlist: ['UU', 'BL2', 'Aurora Veil'],
},
{
name: "[Gen 7] NU",
Expand All @@ -105,7 +95,7 @@ exports.Formats = [

mod: 'gen7',
ruleset: ['[Gen 7] RU'],
banlist: ['RU', 'BL3', 'Drought', 'Aurora Veil'],
banlist: ['RU', 'BL3', 'Drought'],
},
{
name: "[Gen 7] PU",
Expand Down Expand Up @@ -387,7 +377,8 @@ exports.Formats = [
if (tier.charAt(0) === '(') tier = tier.slice(1, -1);
let boost = (tier in boosts) ? boosts[tier] : 0;
if (boost > 0 && (pokemon.set.ability === 'Drizzle' || pokemon.set.item === 'Mewnium Z')) boost = 0;
if (boost > 20 && (pokemon.set.ability === 'Drought' || pokemon.set.moves.includes('auroraveil'))) boost = 20;
if (boost > 10 && pokemon.set.moves.includes('auroraveil')) boost = 10;
if (boost > 20 && pokemon.set.ability === 'Drought') boost = 20;
tsTemplate.baseStats = Object.assign({}, tsTemplate.baseStats);
for (let statName in tsTemplate.baseStats) {
tsTemplate.baseStats[statName] = this.clampIntRange(tsTemplate.baseStats[statName] + boost, 1, 255);
Expand Down
1 change: 0 additions & 1 deletion data/aliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ exports.BattleAliases = {
"aaa": "[Gen 7] Almost Any Ability",
"ht": "[Gen 7] Hidden Type",
"2v2": "[Gen 7] 2v2 Doubles",
"theorymon": "[Gen 6] OU Theorymon",
"cc1v1": "[Gen 7] Challenge Cup 1v1",
"hc": "[Gen 7] Hackmons Cup",
"monorandom": "[Gen 7] Monotype Random Battle",
Expand Down
7 changes: 4 additions & 3 deletions data/moves.js
Original file line number Diff line number Diff line change
Expand Up @@ -8610,7 +8610,7 @@ exports.BattleMovedex = {
accuracy: true,
basePower: 0,
category: "Status",
desc: "The target immediately uses its last used move. Fails if the target has not made a move, if the target is preparing to use Beak Blast, Focus Punch, or Shell Trap, or if the move is Beak Blast, Bide, Copycat, Focus Punch, Ice Ball, Instruct, Me First, Metronome, Mimic, Mirror Move, Outrage, Petal Dance, Rollout, Shell Trap, Sleep Talk, Thrash, a charge move, a recharge move, or a Z-Move.",
desc: "The target immediately uses its last used move. Fails if the target has not made a move, if the move has 0 PP, if the target is preparing to use Beak Blast, Focus Punch, or Shell Trap, or if the move is Assist, Beak Blast, Bide, Copycat, Focus Punch, Ice Ball, Instruct, Me First, Metronome, Mimic, Mirror Move, Nature Power, Outrage, Petal Dance, Rollout, Shell Trap, Sketch, Sleep Talk, Thrash, Transform, a charge move, a recharge move, or a Z-Move.",
shortDesc: "The target immediately uses its last used move.",
id: "instruct",
name: "Instruct",
Expand All @@ -8620,10 +8620,11 @@ exports.BattleMovedex = {
onHit: function (target, source) {
if (!target.lastMove) return false;
let lastMove = this.getMove(target.lastMove);
let moveIndex = target.moves.indexOf(target.lastMove);
let noInstruct = {
beakblast:1, bide:1, copycat:1, focuspunch:1, iceball:1, instruct:1, mefirst:1, metronome:1, mimic:1, mirrormove:1, outrage:1, petaldance:1, rollout:1, shelltrap:1, sleeptalk:1, thrash:1, // TODO: fill this up
assist:1, beakblast:1, bide:1, copycat:1, focuspunch:1, iceball:1, instruct:1, mefirst:1, metronome:1, mimic:1, mirrormove:1, naturepower:1, outrage:1, petaldance:1, rollout:1, shelltrap:1, sketch:1, sleeptalk:1, thrash:1, transform:1,
};
if (noInstruct[lastMove.id] || lastMove.isZ || lastMove.flags['charge'] || lastMove.flags['recharge'] || target.volatiles['beakblast'] || target.volatiles['focuspunch'] || target.volatiles['shelltrap']) {
if (noInstruct[lastMove.id] || lastMove.isZ || lastMove.flags['charge'] || lastMove.flags['recharge'] || target.volatiles['beakblast'] || target.volatiles['focuspunch'] || target.volatiles['shelltrap'] || (target.moveset[moveIndex] && target.moveset[moveIndex].pp <= 0)) {
return false;
}
this.add('-singleturn', target, 'move: Instruct', '[of] ' + source);
Expand Down
2 changes: 1 addition & 1 deletion data/statuses.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ exports.BattleStatuses = {
},
choicelock: {
onStart: function (pokemon) {
if (!this.activeMove.id || this.activeMove.sourceEffect && this.activeMove.sourceEffect !== this.activeMove.id) return false;
if (!this.activeMove.id || this.activeMove.hasBounced) return false;
this.effectData.move = this.activeMove.id;
},
onBeforeMove: function (pokemon, target, move) {
Expand Down
7 changes: 4 additions & 3 deletions mods/gen4/random-teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ class RandomGen4Teams extends RandomGen5Teams {
(hasType['Ground'] && !counter['Ground']) ||
(hasType['Ice'] && !counter['Ice'] && (!hasType['Water'] || !counter['Water'])) ||
(hasType['Psychic'] && !!counter['Psychic'] && !hasType['Flying'] && template.types.length > 1 && counter.stab < 2) ||
(hasType['Rock'] && !counter['Rock'] && movePool.includes('headsmash')) ||
(hasType['Water'] && !counter['Water'] && (!hasType['Ice'] || !counter['Ice'])) ||
((hasAbility['Adaptability'] && !counter.setupType && template.types.length > 1 && (!counter[template.types[0]] || !counter[template.types[1]])) ||
(hasAbility['Guts'] && hasType['Normal'] && movePool.includes('facade')) ||
Expand Down Expand Up @@ -576,9 +577,9 @@ class RandomGen4Teams extends RandomGen5Teams {
item = 'Sitrus Berry';

// Medium priority
} else if (counter.Physical >= 4 && !hasMove['fakeout'] && !hasMove['rapidspin'] && !hasMove['suckerpunch']) {
} else if (counter.Physical >= 4 && !(hasMove['bodyslam'] && hasAbility['Serene Grace']) && !hasMove['fakeout'] && !hasMove['rapidspin'] && !hasMove['suckerpunch']) {
item = template.baseStats.spe >= 60 && template.baseStats.spe <= 108 && !counter['priority'] && !hasMove['bodyslam'] && this.random(3) ? 'Choice Scarf' : 'Choice Band';
} else if ((counter.Special >= 4 || (counter.Special >= 3 && (hasMove['batonpass'] || hasMove['uturn']))) && !hasMove['chargebeam']) {
} else if ((counter.Special >= 4 || (counter.Special >= 3 && (hasMove['batonpass'] || hasMove['uturn'] || hasMove['waterspout'] && hasMove['selfdestruct']))) && !hasMove['chargebeam']) {
item = template.baseStats.spe >= 60 && template.baseStats.spe <= 108 && ability !== 'Speed Boost' && !counter['priority'] && this.random(3) ? 'Choice Scarf' : 'Choice Specs';
} else if (hasMove['endeavor'] || hasMove['flail'] || hasMove['reversal']) {
item = 'Focus Sash';
Expand Down Expand Up @@ -607,7 +608,7 @@ class RandomGen4Teams extends RandomGen5Teams {
item = 'Black Sludge';
} else if (this.getEffectiveness('Rock', template) >= 1 || hasMove['roar']) {
item = 'Leftovers';
} else if (counter.Status <= 1 && !hasMove['rapidspin']) {
} else if (counter.Status <= 1 && !hasMove['rapidspin'] && !hasMove['superfang']) {
item = 'Life Orb';
} else {
item = 'Leftovers';
Expand Down
2 changes: 1 addition & 1 deletion mods/gennext/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Major changes:

- Twister is now a 80 base power Flying move with a 30% confusion chance

- Floette-Eternal-Flower are released.
- Floette-Eternal-Flower is released.

New mechanic: Signature Pokémon:

Expand Down
2 changes: 1 addition & 1 deletion sim/dex.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ class ModdedDex {
}
name = (name || '').trim();
let id = toId(name);
if (this.data.Aliases[id]) {
if (this.data.Aliases.hasOwnProperty(id)) {
name = this.data.Aliases[id];
id = toId(name);
}
Expand Down
4 changes: 2 additions & 2 deletions sockets.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const path = require('path');

if (cluster.isMaster) {
cluster.setupMaster({
exec: path.resolve(process.cwd(), 'sockets-workers'),
exec: path.resolve(__dirname, 'sockets-workers'),
});
}

Expand Down Expand Up @@ -714,4 +714,4 @@ module.exports = {
channelRemove,
subchannelBroadcast,
subchannelMove,
};
};

0 comments on commit 9ea8bac

Please sign in to comment.