mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -05:00
Gen 3: Fix Pressure PP tracking
This commit makes it so players are always informed about their own Pressure activations. This fixes Pressure PP tracking for players. PP tracking for spectators will still be wrong; there's no fix for that. Fixes https://github.com/Zarel/Pokemon-Showdown-Client/issues/766
This commit is contained in:
parent
104b2dc660
commit
2f0be453cc
|
|
@ -113,7 +113,16 @@ let BattleAbilities = {
|
|||
},
|
||||
"pressure": {
|
||||
inherit: true,
|
||||
onStart: function () { },
|
||||
onStart: function (pokemon) {
|
||||
this.add('split');
|
||||
for (const line of [false, this.sides[0], this.sides[1], true]) {
|
||||
if (line === true || line === pokemon.side) {
|
||||
this.add('-ability', pokemon, 'Pressure', '[silent]');
|
||||
} else {
|
||||
this.log.push('');
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
"roughskin": {
|
||||
inherit: true,
|
||||
|
|
|
|||
|
|
@ -88,9 +88,10 @@ class Roomlog {
|
|||
}
|
||||
log = [];
|
||||
for (let i = 0; i < this.log.length; ++i) {
|
||||
let line = this.log[i];
|
||||
const line = this.log[i];
|
||||
if (line === '|split') {
|
||||
log.push(this.log[i + channel + 1]);
|
||||
const ownLine = this.log[i + channel + 1];
|
||||
if (ownLine) log.push(ownLine);
|
||||
i += 4;
|
||||
} else {
|
||||
log.push(line);
|
||||
|
|
|
|||
|
|
@ -192,11 +192,11 @@ function getPlayerStreams(stream) {
|
|||
const [type, data] = splitFirst(chunk, `\n`);
|
||||
switch (type) {
|
||||
case 'update':
|
||||
const p1Update = data.replace(/\n\|split\n[^\n]*\n([^\n]*)\n[^\n]*\n[^\n]*/g, '\n$1');
|
||||
const p1Update = data.replace(/\n\|split\n[^\n]*\n([^\n]*)\n[^\n]*\n[^\n]*/g, '\n$1').replace(/\n\n/g, '\n');
|
||||
p1.push(p1Update);
|
||||
const p2Update = data.replace(/\n\|split\n[^\n]*\n[^\n]*\n([^\n]*)\n[^\n]*/g, '\n$1');
|
||||
const p2Update = data.replace(/\n\|split\n[^\n]*\n[^\n]*\n([^\n]*)\n[^\n]*/g, '\n$1').replace(/\n\n/g, '\n');
|
||||
p2.push(p2Update);
|
||||
const specUpdate = data.replace(/\n\|split\n([^\n]*)\n[^\n]*\n[^\n]*\n[^\n]*/g, '\n$1');
|
||||
const specUpdate = data.replace(/\n\|split\n([^\n]*)\n[^\n]*\n[^\n]*\n[^\n]*/g, '\n$1').replace(/\n\n/g, '\n');
|
||||
spectator.push(specUpdate);
|
||||
const omniUpdate = data.replace(/\n\|split\n[^\n]*\n[^\n]*\n[^\n]*/g, '');
|
||||
omniscient.push(omniUpdate);
|
||||
|
|
|
|||
|
|
@ -546,19 +546,19 @@ if (cluster.isMaster) {
|
|||
switch (subchannel ? subchannel.get(socketid) : '0') {
|
||||
case '1':
|
||||
if (!messages[1]) {
|
||||
messages[1] = message.replace(/\n\|split\n[^\n]*\n([^\n]*)\n[^\n]*\n[^\n]*/g, '\n$1');
|
||||
messages[1] = message.replace(/\n\|split\n[^\n]*\n([^\n]*)\n[^\n]*\n[^\n]*/g, '\n$1').replace(/\n\n/g, '\n');
|
||||
}
|
||||
socket.write(messages[1]);
|
||||
break;
|
||||
case '2':
|
||||
if (!messages[2]) {
|
||||
messages[2] = message.replace(/\n\|split\n[^\n]*\n[^\n]*\n([^\n]*)\n[^\n]*/g, '\n$1');
|
||||
messages[2] = message.replace(/\n\|split\n[^\n]*\n[^\n]*\n([^\n]*)\n[^\n]*/g, '\n$1').replace(/\n\n/g, '\n');
|
||||
}
|
||||
socket.write(messages[2]);
|
||||
break;
|
||||
default:
|
||||
if (!messages[0]) {
|
||||
messages[0] = message.replace(/\n\|split\n([^\n]*)\n[^\n]*\n[^\n]*\n[^\n]*/g, '\n$1');
|
||||
messages[0] = message.replace(/\n\|split\n([^\n]*)\n[^\n]*\n[^\n]*\n[^\n]*/g, '\n$1').replace(/\n\n/g, '\n');
|
||||
}
|
||||
socket.write(messages[0]);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user