Lower line length limit to 120

This commit is contained in:
Guangcong Luo 2019-03-15 10:28:58 +09:00
parent 7e27321790
commit 826f7dda62
13 changed files with 194 additions and 97 deletions

View File

@ -30650,7 +30650,10 @@ BattleMoveAnims['flatter'] = {anim: BattleMoveAnims['attract'].anim};
BattleMoveAnims['armthrust'] = {anim: BattleMoveAnims['smellingsalts'].anim};
BattleMoveAnims['phantomforce'] = {anim: BattleMoveAnims['shadowforce'].anim, prepareAnim: BattleMoveAnims['shadowforce'].prepareAnim};
BattleMoveAnims['phantomforce'] = {
anim: BattleMoveAnims['shadowforce'].anim,
prepareAnim: BattleMoveAnims['shadowforce'].prepareAnim,
};
BattleMoveAnims['shadowstrike'] = {anim: BattleMoveAnims['shadowforce'].anim};
BattleMoveAnims['smackdown'] = {anim: BattleMoveAnims['rockblast'].anim};

View File

@ -569,7 +569,8 @@ class BattleScene {
}
getDetailsText(pokemon: Pokemon) {
let name = pokemon.side && pokemon.side.n && (this.battle.ignoreOpponent || this.battle.ignoreNicks) ? pokemon.species : pokemon.name;
let name = pokemon.side && pokemon.side.n &&
(this.battle.ignoreOpponent || this.battle.ignoreNicks) ? pokemon.species : pokemon.name;
if (name !== pokemon.species) {
name += ' (' + pokemon.species + ')';
}
@ -759,15 +760,15 @@ class BattleScene {
weatherLeft() {
if (this.battle.gen < 7 && this.battle.hardcoreMode) return '';
if (this.battle.weatherMinTimeLeft !== 0) {
return ' <small>(' + this.battle.weatherMinTimeLeft + ' or ' + this.battle.weatherTimeLeft + ' turns)</small>';
return ` <small>(${this.battle.weatherMinTimeLeft} or ${this.battle.weatherTimeLeft} turns)</small>`;
}
if (this.battle.weatherTimeLeft !== 0) {
return ' <small>(' + this.battle.weatherTimeLeft + ' turn' + (this.battle.weatherTimeLeft === 1 ? '' : 's') + ')</small>';
return ` <small>(${this.battle.weatherTimeLeft} turn${this.battle.weatherTimeLeft === 1 ? '' : 's'})</small>`;
}
return '';
}
upkeepWeather() {
const isIntense = (this.curWeather === 'desolateland' || this.curWeather === 'primordialsea' || this.curWeather === 'deltastream');
const isIntense = ['desolateland', 'primordialsea', 'deltastream'].includes(this.curWeather);
this.$weather.animate({
opacity: 1.0,
}, 300).animate({
@ -2326,21 +2327,24 @@ class PokemonSprite extends Sprite {
getStatbarHTML(pokemon: Pokemon) {
let buf = '<div class="statbar' + (this.siden ? ' lstatbar' : ' rstatbar') + '" style="display: none">';
buf += '<strong>' + (this.siden && (this.scene.battle.ignoreOpponent || this.scene.battle.ignoreNicks) ? pokemon.species : BattleLog.escapeHTML(pokemon.name));
const ignoreNick = this.siden && (this.scene.battle.ignoreOpponent || this.scene.battle.ignoreNicks);
buf += `<strong>${BattleLog.escapeHTML(ignoreNick ? pokemon.species : pokemon.name)}`;
let gender = pokemon.gender;
if (gender) buf += ' <img src="' + Dex.resourcePrefix + 'fx/gender-' + gender.toLowerCase() + '.png" alt="' + gender + '" />';
buf += (pokemon.level === 100 ? '' : ' <small>L' + pokemon.level + '</small>');
if (gender) {
buf += ` <img src="${Dex.resourcePrefix}fx/gender-${gender.toLowerCase()}.png" alt="${gender}" />`;
}
buf += (pokemon.level === 100 ? `` : ` <small>L${pokemon.level}</small>`);
let symbol = '';
if (pokemon.species.indexOf('-Mega') >= 0) symbol = 'mega';
else if (pokemon.species === 'Kyogre-Primal') symbol = 'alpha';
else if (pokemon.species === 'Groudon-Primal') symbol = 'omega';
if (symbol) {
buf += ' <img src="' + Dex.resourcePrefix + 'sprites/misc/' + symbol + '.png" alt="' + symbol + '" style="vertical-align:text-bottom;" />';
buf += ` <img src="${Dex.resourcePrefix}sprites/misc/${symbol}.png" alt="${symbol}" style="vertical-align:text-bottom;" />`;
}
buf += '</strong><div class="hpbar"><div class="hptext"></div><div class="hptextborder"></div><div class="prevhp"><div class="hp"></div></div><div class="status"></div>';
buf += '</div>';
buf += `</strong><div class="hpbar"><div class="hptext"></div><div class="hptextborder"></div><div class="prevhp"><div class="hp"></div></div><div class="status"></div>`;
buf += `</div>`;
return buf;
}

View File

@ -142,7 +142,10 @@ function toName(name: any) {
if (name.length > 18) name = name.substr(0, 18).trim();
// remove zalgo
name = name.replace(/[\u0300-\u036f\u0483-\u0489\u0610-\u0615\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06ED\u0E31\u0E34-\u0E3A\u0E47-\u0E4E]{3,}/g, '');
name = name.replace(
/[\u0300-\u036f\u0483-\u0489\u0610-\u0615\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06ED\u0E31\u0E34-\u0E3A\u0E47-\u0E4E]{3,}/g,
''
);
name = name.replace(/[\u239b-\u23b9]/g, '');
return name;
@ -224,7 +227,9 @@ const Dex = new class implements ModdedDex {
*/
sanitizeName(name: any) {
if (!name) return '';
return ('' + name).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').slice(0, 50);
return ('' + name)
.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;')
.slice(0, 50);
}
prefs(prop: string, value?: any, save?: boolean) {
@ -590,9 +595,13 @@ const Dex = new class implements ModdedDex {
if (pokemon && pokemon.volatiles && pokemon.volatiles.formechange && !pokemon.volatiles.transform) {
id = toId(pokemon.volatiles.formechange[1]);
}
if (pokemon && pokemon.num) num = pokemon.num;
else if (window.BattlePokemonSprites && BattlePokemonSprites[id] && BattlePokemonSprites[id].num) num = BattlePokemonSprites[id].num;
else if (window.BattlePokedex && window.BattlePokedex[id] && BattlePokedex[id].num) num = BattlePokedex[id].num;
if (pokemon && pokemon.num) {
num = pokemon.num;
} else if (window.BattlePokemonSprites && BattlePokemonSprites[id] && BattlePokemonSprites[id].num) {
num = BattlePokemonSprites[id].num;
} else if (window.BattlePokedex && window.BattlePokedex[id] && BattlePokedex[id].num) {
num = BattlePokedex[id].num;
}
if (num < 0) num = 0;
if (num > 809) num = 0;

View File

@ -78,7 +78,9 @@ class BattleLog {
}
let rank = name.charAt(0);
if (battle && battle.ignoreSpects && ' +'.includes(rank)) return;
if (battle && battle.ignoreOpponent && '\u2605\u2606'.includes(rank) && toUserid(name) !== app.user.get('userid')) return;
if (battle && battle.ignoreOpponent) {
if ('\u2605\u2606'.includes(rank) && toUserid(name) !== app.user.get('userid')) return;
}
if (window.app && app.ignore && app.ignore[toUserid(name)] && ' +\u2605\u2606'.includes(rank)) return;
let isHighlighted = window.app && app.rooms && app.rooms[battle!.roomid].getHighlight(message);
[divClass, divHTML] = this.parseChatMessage(message, name, '', isHighlighted);
@ -339,7 +341,8 @@ class BattleLog {
static escapeFormat(formatid: string): string {
let atIndex = formatid.indexOf('@@@');
if (atIndex >= 0) {
return this.escapeFormat(formatid.slice(0, atIndex)) + '<br />Custom rules: ' + this.escapeHTML(formatid.slice(atIndex + 3));
return this.escapeFormat(formatid.slice(0, atIndex)) +
'<br />Custom rules: ' + this.escapeHTML(formatid.slice(atIndex + 3));
}
if (window.BattleFormats && BattleFormats[formatid]) {
return this.escapeHTML(BattleFormats[formatid].name);

View File

@ -27,7 +27,9 @@ class BattleSceneStub {
preemptCatchup(): void { }
removeSideCondition(siden: number, id: ID): void { }
reset(): void { }
resultAnim(pokemon: Pokemon, result: string, type: "bad" | "good" | "neutral" | "par" | "psn" | "frz" | "slp" | "brn"): void { }
resultAnim(
pokemon: Pokemon, result: string, type: "bad" | "good" | "neutral" | "par" | "psn" | "frz" | "slp" | "brn"
): void { }
typeAnim(pokemon: Pokemon, types: string): void { }
resume(): void { }
runMoveAnim(moveid: ID, participants: Pokemon[]): void { }

View File

@ -566,7 +566,8 @@ class BattleTextParser {
return line1 + template.replace('[POKEMON]', this.pokemon(pokemon)).replace('[ITEM]', this.effect(item)).replace('[SOURCE]', this.pokemon(target || kwArgs.of));
}
if (id === 'frisk') {
const template = this.template(kwArgs.of && pokemon && kwArgs.of !== pokemon ? 'activate' : 'activateNoTarget', "Frisk");
const hasTarget = kwArgs.of && pokemon && kwArgs.of !== pokemon;
const template = this.template(hasTarget ? 'activate' : 'activateNoTarget', "Frisk");
return line1 + template.replace('[POKEMON]', this.pokemon(kwArgs.of)).replace('[ITEM]', this.effect(item)).replace('[TARGET]', this.pokemon(pokemon));
}
if (kwArgs.from) {
@ -643,7 +644,8 @@ class BattleTextParser {
case '-singleturn': case '-singlemove': {
const [, pokemon, effect] = args;
const line1 = this.maybeAbility(effect, kwArgs.of || pokemon) || this.maybeAbility(kwArgs.from, kwArgs.of || pokemon);
const line1 = this.maybeAbility(effect, kwArgs.of || pokemon) ||
this.maybeAbility(kwArgs.from, kwArgs.of || pokemon);
let id = BattleTextParser.effectId(effect);
if (id === 'instruct') {
const template = this.template('activate', effect);

View File

@ -26,7 +26,8 @@ class ModifiableValue {
this.serverPokemon = serverPokemon;
this.itemName = Dex.getItem(serverPokemon.item).name;
this.abilityName = Dex.getAbility(serverPokemon.ability || (pokemon && pokemon.ability) || serverPokemon.baseAbility).name;
const ability = serverPokemon.ability || (pokemon && pokemon.ability) || serverPokemon.baseAbility;
this.abilityName = Dex.getAbility(ability).name;
this.weatherName = Dex.getMove(battle.weather).name;
}
reset(value = 0, isAccuracy?: boolean) {
@ -45,7 +46,9 @@ class ModifiableValue {
this.comment.push(` (${itemName} suppressed by Embargo)`);
return false;
}
const ignoreKlutz = ["Macho Brace", "Power Anklet", "Power Band", "Power Belt", "Power Bracer", "Power Lens", "Power Weight"];
const ignoreKlutz = [
"Macho Brace", "Power Anklet", "Power Band", "Power Belt", "Power Bracer", "Power Lens", "Power Weight",
];
if (this.tryAbility('Klutz') && !ignoreKlutz.includes(itemName)) {
this.comment.push(` (${itemName} suppressed by Klutz)`);
return false;
@ -544,42 +547,42 @@ class BattleTooltips {
}
}
if ('defrost' in move.flags) {
text += '<p class="movetag">The user thaws out if it is frozen.</p>';
if (move.flags.defrost) {
text += `<p class="movetag">The user thaws out if it is frozen.</p>`;
}
if (!('protect' in move.flags) && move.target !== 'self' && move.target !== 'allySide') {
text += '<p class="movetag">Not blocked by Protect <small>(and Detect, King\'s Shield, Spiky Shield)</small></p>';
if (!move.flags.protect && !['self', 'allySide'].includes(move.target)) {
text += `<p class="movetag">Not blocked by Protect <small>(and Detect, King's Shield, Spiky Shield)</small></p>`;
}
if ('authentic' in move.flags) {
text += '<p class="movetag">Bypasses Substitute <small>(but does not break it)</small></p>';
if (move.flags.authentic) {
text += `<p class="movetag">Bypasses Substitute <small>(but does not break it)</small></p>`;
}
if (!('reflectable' in move.flags) && move.target !== 'self' && move.target !== 'allySide' && move.category === 'Status') {
text += '<p class="movetag">&#x2713; Not bounceable <small>(can\'t be bounced by Magic Coat/Bounce)</small></p>';
if (!move.flags.reflectable && !['self', 'allySide'].includes(move.target) && move.category === 'Status') {
text += `<p class="movetag">&#x2713; Not bounceable <small>(can't be bounced by Magic Coat/Bounce)</small></p>`;
}
if ('contact' in move.flags) {
text += '<p class="movetag">&#x2713; Contact <small>(triggers Iron Barbs, Spiky Shield, etc)</small></p>';
if (move.flags.contact) {
text += `<p class="movetag">&#x2713; Contact <small>(triggers Iron Barbs, Spiky Shield, etc)</small></p>`;
}
if ('sound' in move.flags) {
text += '<p class="movetag">&#x2713; Sound <small>(doesn\'t affect Soundproof pokemon)</small></p>';
if (move.flags.sound) {
text += `<p class="movetag">&#x2713; Sound <small>(doesn't affect Soundproof pokemon)</small></p>`;
}
if ('powder' in move.flags) {
text += '<p class="movetag">&#x2713; Powder <small>(doesn\'t affect Grass, Overcoat, Safety Goggles)</small></p>';
if (move.flags.powder) {
text += `<p class="movetag">&#x2713; Powder <small>(doesn't affect Grass, Overcoat, Safety Goggles)</small></p>`;
}
if ('punch' in move.flags && ability === 'ironfist') {
text += '<p class="movetag">&#x2713; Fist <small>(boosted by Iron Fist)</small></p>';
if (move.flags.punch && ability === 'ironfist') {
text += `<p class="movetag">&#x2713; Fist <small>(boosted by Iron Fist)</small></p>`;
}
if ('pulse' in move.flags && ability === 'megalauncher') {
text += '<p class="movetag">&#x2713; Pulse <small>(boosted by Mega Launcher)</small></p>';
if (move.flags.pulse && ability === 'megalauncher') {
text += `<p class="movetag">&#x2713; Pulse <small>(boosted by Mega Launcher)</small></p>`;
}
if ('bite' in move.flags && ability === 'strongjaw') {
text += '<p class="movetag">&#x2713; Bite <small>(boosted by Strong Jaw)</small></p>';
if (move.flags.bite && ability === 'strongjaw') {
text += `<p class="movetag">&#x2713; Bite <small>(boosted by Strong Jaw)</small></p>`;
}
if ((move.recoil || move.hasCustomRecoil) && ability === 'reckless') {
text += '<p class="movetag">&#x2713; Recoil <small>(boosted by Reckless)</small></p>';
text += `<p class="movetag">&#x2713; Recoil <small>(boosted by Reckless)</small></p>`;
}
if ('bullet' in move.flags) {
text += '<p class="movetag">&#x2713; Bullet-like <small>(doesn\'t affect Bulletproof pokemon)</small></p>';
if (move.flags.bullet) {
text += `<p class="movetag">&#x2713; Bullet-like <small>(doesn't affect Bulletproof pokemon)</small></p>`;
}
}
return text;
@ -1039,7 +1042,8 @@ class BattleTooltips {
let baseSpe = pokemon.getTemplate().baseStats['spe'];
let tier = this.battle.tier;
let gen = this.battle.gen;
let isRandomBattle = tier.includes('Random Battle') || (tier.includes('Random') && tier.includes('Battle') && gen >= 6);
let isRandomBattle = tier.includes('Random Battle') ||
(tier.includes('Random') && tier.includes('Battle') && gen >= 6);
let minNature = (isRandomBattle || gen < 3) ? 1 : 0.9;
let maxNature = (isRandomBattle || gen < 3) ? 1 : 1.1;
@ -1099,7 +1103,9 @@ class BattleTooltips {
}
}
// Other abilities that change the move type.
const noTypeOverride = ['judgment', 'multiattack', 'naturalgift', 'revelationdance', 'struggle', 'technoblast', 'weatherball'];
const noTypeOverride = [
'judgment', 'multiattack', 'naturalgift', 'revelationdance', 'struggle', 'technoblast', 'weatherball',
];
const allowTypeOverride = !noTypeOverride.includes(move.id);
if (allowTypeOverride && move.flags['sound'] && value.abilityModify(0, 'Liquid Voice')) {
@ -1382,7 +1388,9 @@ class BattleTooltips {
value.abilityModify(1.25, "Rivalry");
}
}
const noTypeOverride = ['judgment', 'multiattack', 'naturalgift', 'revelationdance', 'struggle', 'technoblast', 'weatherball'];
const noTypeOverride = [
'judgment', 'multiattack', 'naturalgift', 'revelationdance', 'struggle', 'technoblast', 'weatherball',
];
if (move.category !== 'Status' && !noTypeOverride.includes(move.id)) {
if (move.type === 'Normal') {
value.abilityModify(this.battle.gen > 6 ? 1.2 : 1.3, "Aerilate");
@ -1839,7 +1847,9 @@ class BattleStatGuesser {
} else if (itemid === 'salacberry') {
isFast = true;
}
if (hasMove['agility'] || hasMove['shellsmash'] || hasMove['autotomize'] || hasMove['shiftgear'] || hasMove['rockpolish']) {
const ultrafast = hasMove['agility'] || hasMove['shellsmash'] ||
hasMove['autotomize'] || hasMove['shiftgear'] || hasMove['rockpolish'];
if (ultrafast) {
moveCount['Ultrafast'] = 2;
}
moveCount['Fast'] = isFast ? 1 : 0;
@ -1943,7 +1953,9 @@ class BattleStatGuesser {
let hasMove = this.hasMove;
let moveCount = this.moveCount;
let evs: StatsTable & {plusStat?: StatName | '', minusStat?: StatName | ''} = {hp: 0, atk: 0, def: 0, spa: 0, spd: 0, spe: 0};
let evs: StatsTable & {plusStat?: StatName | '', minusStat?: StatName | ''} = {
hp: 0, atk: 0, def: 0, spa: 0, spd: 0, spe: 0,
};
let plusStat: StatName | '' = '';
let minusStat: StatName | '' = '';
@ -2161,12 +2173,12 @@ class BattleStatGuesser {
if (stat === 'hp') {
if (baseStat === 1) return 1;
if (!this.supportsEVs) return Math.floor(Math.floor(2 * baseStat + iv + 100) * level / 100 + 10) + (this.supportsAVs ? ev : 0);
return Math.floor(Math.floor(2 * baseStat + iv + Math.floor(ev / 4) + 100) * level / 100 + 10);
if (!this.supportsEVs) return ~~(~~(2 * baseStat + iv + 100) * level / 100 + 10) + (this.supportsAVs ? ev : 0);
return ~~(~~(2 * baseStat + iv + ~~(ev / 4) + 100) * level / 100 + 10);
}
let val = Math.floor(Math.floor(2 * baseStat + iv + Math.floor(ev / 4)) * level / 100 + 5);
let val = ~~(~~(2 * baseStat + iv + ~~(ev / 4)) * level / 100 + 5);
if (!this.supportsEVs) {
val = Math.floor(Math.floor(2 * baseStat + iv) * level / 100 + 5);
val = ~~(~~(2 * baseStat + iv) * level / 100 + 5);
}
if (natureOverride) {
val *= natureOverride;
@ -2176,10 +2188,10 @@ class BattleStatGuesser {
val *= 0.9;
}
if (!this.supportsEVs) {
let friendshipValue = Math.floor((70 / 255 / 10 + 1) * 100);
val = Math.floor(val) * friendshipValue / 100 + (this.supportsAVs ? ev : 0);
let friendshipValue = ~~((70 / 255 / 10 + 1) * 100);
val = ~~(val) * friendshipValue / 100 + (this.supportsAVs ? ev : 0);
}
return Math.floor(val);
return ~~(val);
}
}

View File

@ -366,20 +366,28 @@ class Pokemon implements PokemonDetails, PokemonHealth {
if (this.boosts[boostStat] < -6) this.boosts[boostStat] = -6;
if (boostStat === 'accuracy' || boostStat === 'evasion') {
if (this.boosts[boostStat] > 0) {
let goodBoostTable = ['1&times;', '1.33&times;', '1.67&times;', '2&times;', '2.33&times;', '2.67&times;', '3&times;'];
let goodBoostTable = [
'1&times;', '1.33&times;', '1.67&times;', '2&times;', '2.33&times;', '2.67&times;', '3&times;',
];
// let goodBoostTable = ['Normal', '+1', '+2', '+3', '+4', '+5', '+6'];
return '' + goodBoostTable[this.boosts[boostStat]] + '&nbsp;' + boostStatTable[boostStat];
}
let badBoostTable = ['1&times;', '0.75&times;', '0.6&times;', '0.5&times;', '0.43&times;', '0.38&times;', '0.33&times;'];
let badBoostTable = [
'1&times;', '0.75&times;', '0.6&times;', '0.5&times;', '0.43&times;', '0.38&times;', '0.33&times;',
];
// let badBoostTable = ['Normal', '&minus;1', '&minus;2', '&minus;3', '&minus;4', '&minus;5', '&minus;6'];
return '' + badBoostTable[-this.boosts[boostStat]] + '&nbsp;' + boostStatTable[boostStat];
}
if (this.boosts[boostStat] > 0) {
let goodBoostTable = ['1&times;', '1.5&times;', '2&times;', '2.5&times;', '3&times;', '3.5&times;', '4&times;'];
let goodBoostTable = [
'1&times;', '1.5&times;', '2&times;', '2.5&times;', '3&times;', '3.5&times;', '4&times;',
];
// let goodBoostTable = ['Normal', '+1', '+2', '+3', '+4', '+5', '+6'];
return '' + goodBoostTable[this.boosts[boostStat]] + '&nbsp;' + boostStatTable[boostStat];
}
let badBoostTable = ['1&times;', '0.67&times;', '0.5&times;', '0.4&times;', '0.33&times;', '0.29&times;', '0.25&times;'];
let badBoostTable = [
'1&times;', '0.67&times;', '0.5&times;', '0.4&times;', '0.33&times;', '0.29&times;', '0.25&times;',
];
// let badBoostTable = ['Normal', '&minus;1', '&minus;2', '&minus;3', '&minus;4', '&minus;5', '&minus;6'];
return '' + badBoostTable[-this.boosts[boostStat]] + '&nbsp;' + boostStatTable[boostStat];
}
@ -1411,19 +1419,33 @@ class Battle {
runMinor(args: Args, kwArgs: KWArgs, nextArgs?: Args, nextKwargs?: KWArgs) {
if (nextArgs && nextKwargs) {
if (args[2] === 'Sturdy' && args[0] === '-activate') args[2] = 'ability: Sturdy';
if (args[0] === '-crit' || args[0] === '-supereffective' || args[0] === '-resisted' || args[2] === 'ability: Sturdy') kwArgs.then = '.';
if (args[2] === 'Sturdy' && args[0] === '-activate') {
args[2] = 'ability: Sturdy';
}
if (['-crit', '-supereffective', '-resisted'].includes(args[0]) || args[2] === 'ability: Sturdy') {
kwArgs.then = '.';
}
if (args[0] === '-damage' && !kwArgs.from && args[1] !== nextArgs[1] && (
nextArgs[0] === '-crit' ||
nextArgs[0] === '-supereffective' ||
nextArgs[0] === '-resisted' ||
['-crit', '-supereffective', '-resisted'].includes(nextArgs[0]) ||
(nextArgs[0] === '-damage' && !nextKwargs.from)
)) kwArgs.then = '.';
if (args[0] === '-damage' && nextArgs[0] === '-damage' && kwArgs.from && kwArgs.from === nextKwargs.from) kwArgs.then = '.';
if (args[0] === '-ability' && (args[2] === 'Intimidate' || args[3] === 'boost')) kwArgs.then = '.';
if (args[0] === '-unboost' && nextArgs[0] === '-unboost') kwArgs.then = '.';
if (args[0] === '-boost' && nextArgs[0] === '-boost') kwArgs.then = '.';
if (args[0] === '-damage' && kwArgs.from === 'Leech Seed' && nextArgs[0] === '-heal' && nextKwargs.silent) kwArgs.then = '.';
)) {
kwArgs.then = '.';
}
if (args[0] === '-damage' && nextArgs[0] === '-damage' && kwArgs.from && kwArgs.from === nextKwargs.from) {
kwArgs.then = '.';
}
if (args[0] === '-ability' && (args[2] === 'Intimidate' || args[3] === 'boost')) {
kwArgs.then = '.';
}
if (args[0] === '-unboost' && nextArgs[0] === '-unboost') {
kwArgs.then = '.';
}
if (args[0] === '-boost' && nextArgs[0] === '-boost') {
kwArgs.then = '.';
}
if (args[0] === '-damage' && kwArgs.from === 'Leech Seed' && nextArgs[0] === '-heal' && nextKwargs.silent) {
kwArgs.then = '.';
}
if (args[0] === 'detailschange' && nextArgs[0] === '-mega') {
if (this.scene.closeMessagebar()) {
this.activityStep--;
@ -2678,7 +2700,7 @@ class Battle {
if (['electricterrain', 'grassyterrain', 'mistyterrain', 'psychicterrain'].includes(effect.id)) {
for (let i = this.pseudoWeather.length - 1; i >= 0; i--) {
let pwName = this.pseudoWeather[i][0];
if (pwName === 'Electric Terrain' || pwName === 'Grassy Terrain' || pwName === 'Misty Terrain' || pwName === 'Psychic Terrain') {
if (['Electric Terrain', 'Grassy Terrain', 'Misty Terrain', 'Psychic Terrain'].includes(pwName)) {
this.pseudoWeather.splice(i, 1);
continue;
}

View File

@ -63,12 +63,17 @@ class MainMenuPanel extends PSRoomPanel {
<p class="error"><strong>Pok&eacute;mon Showdown is offline due to a DDoS attack!</strong></p> :
<p class="error"><strong>Pok&eacute;mon Showdown is offline due to technical difficulties!</strong></p>}
<p>
<div style={{textAlign: 'center'}}><img width="96" height="96" src="//play.pokemonshowdown.com/sprites/bw/teddiursa.png" alt="" /></div>
<div style={{textAlign: 'center'}}>
<img width="96" height="96" src="//play.pokemonshowdown.com/sprites/bw/teddiursa.png" alt="" />
</div>
Bear with us as we freak out.
</p>
<p>(We'll be back up in a few hours.)</p>
</div> : <div class="menugroup">
<p><button class="button mainmenu1 big" name="search"><strong>Battle!</strong><br /><small>Find a random opponent</small></button></p>
<p><button class="button mainmenu1 big" name="search">
<strong>Battle!</strong><br />
<small>Find a random opponent</small>
</button></p>
</div>);
const onlineButton = ' button' + (PS.connected ? '' : ' disabled');
return <PSPanelWrapper room={this.props.room}>
@ -77,9 +82,17 @@ class MainMenuPanel extends PSRoomPanel {
<div class="activitymenu">
<div class="pmbox">
<div class="pm-window news-embed" data-newsid="<!-- newsid -->">
<h3><button class="closebutton" tabIndex={-1}><i class="fa fa-times-circle"></i></button><button class="minimizebutton" tabIndex={-1}><i class="fa fa-minus-circle"></i></button>News</h3>
<h3>
<button class="closebutton" tabIndex={-1}><i class="fa fa-times-circle"></i></button>
<button class="minimizebutton" tabIndex={-1}><i class="fa fa-minus-circle"></i></button>
News
</h3>
<div class="pm-log" style="max-height:none">
<div class="newsentry"><h4>Test client</h4><p>Welcome to the test client! You can test client changes here!</p><p>&mdash;<strong>Zarel</strong> <small class="date">on Sep 25, 2015</small></p></div>
<div class="newsentry">
<h4>Test client</h4>
<p>Welcome to the test client! You can test client changes here!</p>
<p>&mdash;<strong>Zarel</strong> <small class="date">on Sep 25, 2015</small></p>
</div>
</div>
</div>
</div>
@ -99,13 +112,23 @@ class MainMenuPanel extends PSRoomPanel {
</div>
</div>
<div class="rightmenu" style={{display: PS.leftRoomWidth ? 'none' : 'block'}}>
<div class="menugroup">
{PS.server.id === 'showdown' ?
<div class="menugroup"><p><button class={"mainmenu1" + onlineButton} name="joinRoom" value="rooms">Join chat</button></p></div> :
<div class="menugroup"><p><button class={"mainmenu1" + onlineButton} name="joinRoom" value="lobby">Join lobby chat</button></p></div>}
<p><button class={"mainmenu1" + onlineButton} name="joinRoom" value="rooms">Join chat</button></p>
:
<p><button class={"mainmenu1" + onlineButton} name="joinRoom" value="lobby">Join lobby chat</button></p>
}
</div>
</div>
<div class="mainmenufooter">
<div class="bgcredit"></div>
<small><a href="//dex.pokemonshowdown.com/" target="_blank">Pok&eacute;dex</a> | <a href="//replay.pokemonshowdown.com/" target="_blank">Replays</a> | <a href="//pokemonshowdown.com/rules" target="_blank">Rules</a> | <a href="//pokemonshowdown.com/credits" target="_blank">Credits</a> | <a href="http://smogon.com/forums/" target="_blank">Forum</a></small>
<small>
<a href="//dex.pokemonshowdown.com/" target="_blank">Pok&eacute;dex</a> | {}
<a href="//replay.pokemonshowdown.com/" target="_blank">Replays</a> | {}
<a href="//pokemonshowdown.com/rules" target="_blank">Rules</a> | {}
<a href="//pokemonshowdown.com/credits" target="_blank">Credits</a> | {}
<a href="http://smogon.com/forums/" target="_blank">Forum</a>
</small>
</div>
</div>
</PSPanelWrapper>;

View File

@ -532,8 +532,12 @@ class TeambuilderPanel extends PSRoomPanel {
{filterFolder ?
<h2>
<i class="fa fa-folder-open"></i> {filterFolder} {}
<button class="button small" style="margin-left:5px" name="renameFolder"><i class="fa fa-pencil"></i> Rename</button> {}
<button class="button small" style="margin-left:5px" name="promptDeleteFolder"><i class="fa fa-times"></i> Remove</button>
<button class="button small" style="margin-left:5px" name="renameFolder">
<i class="fa fa-pencil"></i> Rename
</button> {}
<button class="button small" style="margin-left:5px" name="promptDeleteFolder">
<i class="fa fa-times"></i> Remove
</button>
</h2>
: filterFolder === '' ?
<h2><i class="fa fa-folder-open-o"></i> Teams not in any folders</h2>

View File

@ -76,13 +76,21 @@ class PSHeader extends preact.Component<{style: {}}> {
break;
}
if (closable) {
closeButton = <button class="closebutton" name="closeRoom" value={id} aria-label="Close"><i class="fa fa-times-circle"></i></button>;
closeButton = <button class="closebutton" name="closeRoom" value={id} aria-label="Close">
<i class="fa fa-times-circle"></i>
</button>;
}
return <li><a class={className} href={`/${id}`} draggable={true}>{icon} <span>{title}</span></a>{closeButton}</li>;
}
render() {
return <div id="header" class="header" style={this.props.style}>
<img class="logo" src="https://play.pokemonshowdown.com/pokemonshowdownbeta.png" srcset="https://play.pokemonshowdown.com/pokemonshowdownbeta@2x.png 2x" alt="Pokémon Showdown! (beta)" width="146" height="44" />
<img
class="logo"
src="https://play.pokemonshowdown.com/pokemonshowdownbeta.png"
srcset="https://play.pokemonshowdown.com/pokemonshowdownbeta@2x.png 2x"
alt="Pokémon Showdown! (beta)"
width="146" height="44"
/>
<div class="maintabbarbottom"></div>
<div class="tabbar maintabbar"><div class="inner">
<ul>
@ -98,10 +106,10 @@ class PSHeader extends preact.Component<{style: {}}> {
<div class="userbar">
<span class="username" data-name={PS.user.name} style="color:hsl(96,67%,36%);">
<i class="fa fa-user" style="color:#779EC5"></i> {PS.user.name}
</span>{' '}
</span> {}
<button class="icon button" name="joinRoom" value="volume" title="Sound" aria-label="Sound">
<i class="fa fa-volume-up"></i>
</button>{' '}
</button> {}
<button class="icon button" name="joinRoom" value="options" title="Options" aria-label="Options">
<i class="fa fa-cog"></i>
</button>
@ -179,7 +187,9 @@ class UserPanel extends PSRoomPanel<UserRoom> {
battlebuf.push(roomLink);
}
} else {
const roomLink = <a href={`/${roomid}`} class={'ilink' + (roomid in PS.rooms ? ' yours' : '')}>{roomrank}{roomid}</a>;
const roomLink = <a href={`/${roomid}`} class={'ilink' + (roomid in PS.rooms ? ' yours' : '')}>
{roomrank}{roomid}
</a>;
if (curRoom.isPrivate) {
if (privatebuf.length) privatebuf.push(", ");
privatebuf.push(roomLink);
@ -204,7 +214,10 @@ class UserPanel extends PSRoomPanel<UserRoom> {
return <PSPanelWrapper room={room}>
<div class="userdetails">
{user.avatar !== '[loading]' &&
<img class={'trainersprite' + (room.isSelf ? ' yours' : '')} src={Dex.resolveAvatar('' + (user.avatar || 'unknown'))} />
<img
class={'trainersprite' + (room.isSelf ? ' yours' : '')}
src={Dex.resolveAvatar('' + (user.avatar || 'unknown'))}
/>
}
<strong><a href={`//pokemonshowdown.com/users/${user.userid}`} target="_blank">{name}</a></strong><br />
{groupName && <small>{groupName}</small>}
@ -214,19 +227,19 @@ class UserPanel extends PSRoomPanel<UserRoom> {
</div>
{isSelf || !PS.user.named ?
<p class="buttonbar">
<button class="button disabled" disabled>Challenge</button>{' '}
<button class="button disabled" disabled>Challenge</button> {}
<button class="button disabled" disabled>Chat</button>
</p>
:
<p class="buttonbar">
<button class="button" name="challenge">Challenge</button>{' '}
<button class="button" name="pm">Chat</button>{' '}
<button class="button" name="challenge">Challenge</button> {}
<button class="button" name="pm">Chat</button> {}
<button class="button" name="userOptions">{'\u2026'}</button>
</p>
}
{isSelf && <hr />}
{isSelf && <p class="buttonbar" style="text-align: right">
<button class="button" name="login"><i class="fa fa-pencil"></i> Change name</button>{' '}
<button class="button" name="login"><i class="fa fa-pencil"></i> Change name</button> {}
<button class="button" name="logout"><i class="fa fa-power-off"></i> Log out</button>
</p>}
</PSPanelWrapper>;

View File

@ -209,7 +209,7 @@ class PSMain extends preact.Component {
let elem = e.target as HTMLInputElement | null;
if (elem) {
let isTextInput = (elem.tagName === 'INPUT' || elem.tagName === 'TEXTAREA');
if (isTextInput && (elem.type === 'button' || elem.type === 'radio' || elem.type === 'checkbox' || elem.type === 'file')) {
if (isTextInput && ['button', 'radio', 'checkbox', 'file'].includes(elem.type)) {
isTextInput = false;
}
if (isTextInput && elem.value) {

View File

@ -18,8 +18,8 @@
"max-line-length": {
"severity": "warning",
"options": {
"limit": 140,
"ignore-pattern": "\\.replace\\(('\\[|/)|^\\s*(// \\s*)?(return |(let |const )?[a-zA-Z0-9$.]+ \\+?= (\\$\\()?|[a-zA-Z0-9$.]+\\()?['\"`]"
"limit": 120,
"ignore-pattern": "template\\.replace\\(('\\[|/)|^\\s*(// \\s*)?((let |const )?[a-zA-Z0-9$.]+ \\+?= (\\$\\()?|(return |throw )?(new )?([a-zA-Z0-9$.]+\\()?)?['\"`/]"
}
},
"interface-name": false,