Skip to content

Commit

Permalink
Merge pull request #39 from Rezzo64/main
Browse files Browse the repository at this point in the history
January 25th, 2024: Merge with PS
  • Loading branch information
Rezzo64 authored Jan 25, 2024
2 parents 52634c8 + 339e775 commit 02e9d38
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 16 deletions.
21 changes: 20 additions & 1 deletion play.pokemonshowdown.com/js/client-teambuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,10 @@
app.addPopupMessage("Names can't contain slashes, since they're used as a folder separator.");
name = name.replace(/[\\\/]/g, '');
}
if (name.indexOf('|') >= 0) {
app.addPopupMessage("Names can't contain the character |, since they're used for storing teams.");
name = name.replace(/\|/g, '');
}
if (!name) return;
self.selectFolder(name + '/');
}});
Expand All @@ -668,6 +672,10 @@
app.addPopupMessage("Names can't contain slashes, since they're used as a folder separator.");
name = name.replace(/[\\\/]/g, '');
}
if (name.indexOf('|') >= 0) {
app.addPopupMessage("Names can't contain the character |, since they're used for storing teams.");
name = name.replace(/\|/g, '');
}
if (!name) return;
if (name === oldFolder) return;
for (var i = 0; i < Storage.teams.length; i++) {
Expand Down Expand Up @@ -3317,6 +3325,9 @@
minSpe = true;
}

// only available through an event with 31 Spe IVs
if (set.species.startsWith('Terapagos')) minSpe = false;

if (this.curTeam.format === 'gen7hiddentype') return;

var minAtk = true;
Expand Down Expand Up @@ -3370,7 +3381,15 @@
if (!set.ivs['atk'] && set.ivs['atk'] !== 0) set.ivs['atk'] = 31;
if (minAtk) {
// min Atk
set.ivs['atk'] = (hasHiddenPower ? set.ivs['atk'] % hpModulo : 0);
if (['Gouging Fire', 'Iron Boulder', 'Iron Crown', 'Raging Bolt'].includes(set.species)) {
// only available with 20 Atk IVs
set.ivs['atk'] = 20;
} else if (set.species.startsWith('Terapagos')) {
// only available with 15 Atk IVs
set.ivs['atk'] = 15;
} else {
set.ivs['atk'] = (hasHiddenPower ? set.ivs['atk'] % hpModulo : 0);
}
} else {
// max Atk
set.ivs['atk'] = (hasHiddenPower ? 30 + (set.ivs['atk'] % 2) : 31);
Expand Down
2 changes: 2 additions & 0 deletions play.pokemonshowdown.com/src/battle-dex-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,7 @@ class Move implements Effect {
readonly hasCrashDamage: boolean;
readonly basePowerCallback: boolean;
readonly noPPBoosts: boolean;
readonly status: string;
readonly secondaries: ReadonlyArray<any> | null;
readonly noSketch: boolean;
readonly num: number;
Expand Down Expand Up @@ -1278,6 +1279,7 @@ class Move implements Effect {
this.hasCrashDamage = data.hasCrashDamage || false;
this.basePowerCallback = !!data.basePowerCallback;
this.noPPBoosts = data.noPPBoosts || false;
this.status = data.status || '';
this.secondaries = data.secondaries || (data.secondary ? [data.secondary] : null);
this.noSketch = !!data.noSketch;

Expand Down
41 changes: 30 additions & 11 deletions play.pokemonshowdown.com/src/battle-dex-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1536,15 +1536,14 @@ class BattleMoveSearch extends BattleTypedSearch<'move'> {
if (itemid === 'glalitite') abilityid = 'refrigerate' as ID;

switch (id) {
case 'fakeout': case 'flamecharge': case 'nuzzle': case 'poweruppunch':
case 'fakeout': case 'flamecharge': case 'nuzzle': case 'poweruppunch': case 'trailblaze':
return abilityid !== 'sheerforce';
case 'solarbeam': case 'solarblade':
return ['desolateland', 'drought', 'chlorophyll', 'orichalcumpulse'].includes(abilityid) || itemid === 'powerherb';
case 'dynamicpunch': case 'grasswhistle': case 'inferno': case 'sing': case 'zapcannon':
return abilityid === 'noguard';
case 'heatcrash': case 'heavyslam':
return species.weightkg >= (species.evos ? 75 : 130);

case 'aerialace':
return ['technician', 'toughclaws'].includes(abilityid) && !moves.includes('bravebird');
case 'ancientpower':
Expand All @@ -1564,10 +1563,14 @@ class BattleMoveSearch extends BattleTypedSearch<'move'> {
return !moves.includes('scald');
case 'counter':
return species.baseStats.hp >= 65;
case 'dazzlinggleam':
return !moves.includes('alluringvoice') || this.formatType?.includes('doubles');
case 'darkvoid':
return dex.gen < 7;
case 'dualwingbeat':
return abilityid === 'technician' || !moves.includes('drillpeck');
case 'electroshot':
return true;
case 'feint':
return abilityid === 'refrigerate';
case 'grassyglide':
Expand Down Expand Up @@ -1617,6 +1620,8 @@ class BattleMoveSearch extends BattleTypedSearch<'move'> {
return set && set.moves.length < 3;
case 'leechlife':
return dex.gen > 6;
case 'meteorbeam':
return true;
case 'mysticalfire':
return dex.gen > 6 && !moves.includes('flamethrower');
case 'naturepower':
Expand Down Expand Up @@ -1661,42 +1666,56 @@ class BattleMoveSearch extends BattleTypedSearch<'move'> {
return dex.gen > 5 && itemid.endsWith('drive') || itemid === 'dousedrive';
case 'teleport':
return dex.gen > 7;
case 'temperflare':
return (!moves.includes('flareblitz') && !moves.includes('pyroball') && !moves.includes('sacredfire') &&
!moves.includes('bitterblade') && !moves.includes('firepunch')) || this.formatType === 'doubles';
case 'terrainpulse': case 'waterpulse':
return ['megalauncher', 'technician'].includes(abilityid) && !moves.includes('originpulse');
case 'toxicspikes':
return abilityid !== 'toxicdebris';
case 'trickroom':
return species.baseStats.spe <= 100;
case 'wildcharge':
return !moves.includes('supercellslam');
}

if (this.formatType === 'doubles' && BattleMoveSearch.GOOD_DOUBLES_MOVES.includes(id)) {
return true;
}
const moveData = dex.moves.get(id);
if (!moveData) return true;

const move = dex.moves.get(id);
if (!move.exists) return true;
if (!BattleMovedex[id].exists) return true; //Flag custom moves as viable by default
if (moveData.category === 'Status') {
if ((move.status === 'slp' || id === 'yawn') && dex.gen === 9 && !this.formatType) {
return false;
}
if (move.category === 'Status') {
return BattleMoveSearch.GOOD_STATUS_MOVES.includes(id);
}
if (moveData.flags?.charge) {
if (move.basePower < 75) {
return BattleMoveSearch.GOOD_WEAK_MOVES.includes(id);
}
if (id === 'skydrop') return true;
// strong moves
if (move.flags['charge']) {
return itemid === 'powerherb';
}
if (moveData.flags?.recharge) {
if (move.flags['recharge']) {
return false;
}
if (moveData.flags?.slicing && abilityid === 'sharpness') {
if (move.flags['slicing'] && abilityid === 'sharpness') {
return true;
}
if (moveData.basePower < 75 && !(abilityid === 'technician' && moveData.basePower <= 60 && moveData.basePower >= 50)) {
if (move.basePower < 75 && !(abilityid === 'technician' && move.basePower <= 60 && move.basePower >= 50)) {
return BattleMoveSearch.GOOD_WEAK_MOVES.includes(id);
}
return !BattleMoveSearch.BAD_STRONG_MOVES.includes(id);
}
static readonly GOOD_STATUS_MOVES = [
'acidarmor', 'agility', 'aromatherapy', 'auroraveil', 'autotomize', 'banefulbunker', 'batonpass', 'bellydrum', 'bulkup', 'calmmind', 'chillyreception', 'clangoroussoul', 'coil', 'cottonguard', 'courtchange', 'curse', 'defog', 'destinybond', 'detect', 'disable', 'dragondance', 'encore', 'extremeevoboost', 'filletaway', 'geomancy', 'glare', 'haze', 'healbell', 'healingwish', 'healorder', 'heartswap', 'honeclaws', 'kingsshield', 'leechseed', 'lightscreen', 'lovelykiss', 'lunardance', 'magiccoat', 'maxguard', 'memento', 'milkdrink', 'moonlight', 'morningsun', 'nastyplot', 'naturesmadness', 'noretreat', 'obstruct', 'painsplit', 'partingshot', 'perishsong', 'protect', 'quiverdance', 'recover', 'reflect', 'reflecttype', 'rest', 'revivalblessing', 'roar', 'rockpolish', 'roost', 'shedtail', 'shellsmash', 'shiftgear', 'shoreup', 'silktrap', 'slackoff', 'sleeppowder', 'sleeptalk', 'softboiled', 'spikes', 'spikyshield', 'spore', 'stealthrock', 'stickyweb', 'strengthsap', 'substitute', 'switcheroo', 'swordsdance', 'synthesis', 'tailglow', 'tailwind', 'taunt', 'thunderwave', 'tidyup', 'toxic', 'transform', 'trick', 'victorydance', 'whirlwind', 'willowisp', 'wish', 'yawn',
'acidarmor', 'agility', 'aromatherapy', 'auroraveil', 'autotomize', 'banefulbunker', 'batonpass', 'bellydrum', 'bulkup', 'burningbulwark', 'calmmind', 'chillyreception', 'clangoroussoul', 'coil', 'cottonguard', 'courtchange', 'curse', 'defog', 'destinybond', 'detect', 'disable', 'dragondance', 'encore', 'extremeevoboost', 'filletaway', 'geomancy', 'glare', 'haze', 'healbell', 'healingwish', 'healorder', 'heartswap', 'honeclaws', 'kingsshield', 'leechseed', 'lightscreen', 'lovelykiss', 'lunardance', 'magiccoat', 'maxguard', 'memento', 'milkdrink', 'moonlight', 'morningsun', 'nastyplot', 'naturesmadness', 'noretreat', 'obstruct', 'painsplit', 'partingshot', 'perishsong', 'protect', 'quiverdance', 'recover', 'reflect', 'reflecttype', 'rest', 'revivalblessing', 'roar', 'rockpolish', 'roost', 'shedtail', 'shellsmash', 'shiftgear', 'shoreup', 'silktrap', 'slackoff', 'sleeppowder', 'sleeptalk', 'softboiled', 'spikes', 'spikyshield', 'spore', 'stealthrock', 'stickyweb', 'strengthsap', 'substitute', 'switcheroo', 'swordsdance', 'synthesis', 'tailglow', 'tailwind', 'taunt', 'thunderwave', 'tidyup', 'toxic', 'transform', 'trick', 'victorydance', 'whirlwind', 'willowisp', 'wish', 'yawn',
] as ID[] as readonly ID[];
static readonly GOOD_WEAK_MOVES = [
'accelerock', 'acrobatics', 'aquacutter', 'avalanche', 'barbbarrage', 'bonemerang', 'bouncybubble', 'bulletpunch', 'buzzybuzz', 'ceaselessedge', 'circlethrow', 'clearsmog', 'doubleironbash', 'dragondarts', 'dragontail', 'drainingkiss', 'endeavor', 'facade', 'firefang', 'flipturn', 'flowertrick', 'freezedry', 'frustration', 'geargrind', 'grassknot', 'gyroball', 'icefang', 'iceshard', 'iciclespear', 'infernalparade', 'jetpunch', 'knockoff', 'lastrespects', 'lowkick', 'machpunch', 'mortalspin', 'mysticalpower', 'naturesmadness', 'nightshade', 'nuzzle', 'pikapapow', 'populationbomb', 'psychocut', 'psyshieldbash', 'pursuit', 'quickattack', 'ragefist', 'rapidspin', 'return', 'rockblast', 'ruination', 'saltcure', 'scorchingsands', 'seismictoss', 'shadowclaw', 'shadowsneak', 'sizzlyslide', 'skydrop', 'stoneaxe', 'storedpower', 'stormthrow', 'suckerpunch', 'superfang', 'surgingstrikes', 'tailslap', 'trailblaze', 'tripleaxel', 'tripledive', 'twinbeam', 'uturn', 'veeveevolley', 'voltswitch', 'watershuriken', 'weatherball',
'accelerock', 'acrobatics', 'aquacutter', 'avalanche', 'barbbarrage', 'bonemerang', 'bouncybubble', 'bulletpunch', 'buzzybuzz', 'ceaselessedge', 'circlethrow', 'clearsmog', 'doubleironbash', 'dragondarts', 'dragontail', 'drainingkiss', 'endeavor', 'facade', 'firefang', 'flipturn', 'flowertrick', 'freezedry', 'frustration', 'geargrind', 'grassknot', 'gyroball', 'icefang', 'iceshard', 'iciclespear', 'infernalparade', 'knockoff', 'lastrespects', 'lowkick', 'machpunch', 'mortalspin', 'mysticalpower', 'naturesmadness', 'nightshade', 'nuzzle', 'pikapapow', 'populationbomb', 'psychocut', 'psyshieldbash', 'pursuit', 'quickattack', 'ragefist', 'rapidspin', 'return', 'rockblast', 'ruination', 'saltcure', 'scorchingsands', 'seismictoss', 'shadowclaw', 'shadowsneak', 'sizzlyslide', 'stoneaxe', 'storedpower', 'stormthrow', 'suckerpunch', 'superfang', 'surgingstrikes', 'tachyoncutter', 'tailslap', 'thunderclap', 'tripleaxel', 'tripledive', 'twinbeam', 'uturn', 'veeveevolley', 'voltswitch', 'watershuriken', 'weatherball',
] as ID[] as readonly ID[];
static readonly BAD_STRONG_MOVES = [
'belch', 'burnup', 'crushclaw', 'dragonrush', 'dreameater', 'eggbomb', 'firepledge', 'flyingpress', 'grasspledge', 'hyperbeam', 'hyperfang', 'hyperspacehole', 'jawlock', 'landswrath', 'megakick', 'megapunch', 'mistyexplosion', 'muddywater', 'nightdaze', 'pollenpuff', 'rockclimb', 'selfdestruct', 'shelltrap', 'skyuppercut', 'slam', 'strength', 'submission', 'synchronoise', 'takedown', 'thrash', 'uproar', 'waterpledge',
Expand Down
10 changes: 7 additions & 3 deletions play.pokemonshowdown.com/src/battle-tooltips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1674,13 +1674,16 @@ class BattleTooltips {
value.modify(2, "Acrobatics + no item");
}
}
if (['crushgrip', 'hardpress', 'wringout'].includes(move.id) && target) {
let variableBPCap = ['crushgrip', 'wringout'].includes(move.id) ? 120 : move.id === 'hardpress' ? 100 : undefined;
if (variableBPCap && target) {
value.set(
Math.floor(Math.floor((120 * (100 * Math.floor(target.hp * 4096 / target.maxhp)) + 2048 - 1) / 4096) / 100) || 1,
Math.floor(
Math.floor((variableBPCap * (100 * Math.floor(target.hp * 4096 / target.maxhp)) + 2048 - 1) / 4096) / 100
) || 1,
'approximate'
);
}
if (['terablast'].includes(move.id) && pokemon.terastallized === 'Stellar') {
if (move.id === 'terablast' && pokemon.terastallized === 'Stellar') {
value.set(100, 'Tera Stellar boost');
}
if (move.id === 'brine' && target && target.hp * 2 <= target.maxhp) {
Expand Down Expand Up @@ -2046,6 +2049,7 @@ class BattleTooltips {
'Black Glasses': 'Dark',
'Charcoal': 'Fire',
'Dragon Fang': 'Dragon',
'Fairy Feather': 'Fairy',
'Hard Stone': 'Rock',
'Magnet': 'Electric',
'Metal Coat': 'Steel',
Expand Down
1 change: 0 additions & 1 deletion play.pokemonshowdown.com/style/battle-log.css
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ select.button {
font-size: 9pt;
font-family: Verdana, sans-serif;
text-align: left;
white-space: nowrap;
overflow: hidden;
}
.option.sel, .option.cur {
Expand Down

0 comments on commit 02e9d38

Please sign in to comment.