From b626892dab8618af4ccbbacdd2a3abc9e080bc69 Mon Sep 17 00:00:00 2001 From: Annika Date: Sat, 2 Oct 2021 14:50:11 -0700 Subject: [PATCH] Random Battles updates --- data/formats-data.ts | 20 ++++++++++---------- data/random-teams.ts | 17 +++++++++++------ test/random-battles/gen8.js | 21 +++++++++++++++++++++ test/random-battles/tools.js | 5 +++-- 4 files changed, 45 insertions(+), 18 deletions(-) diff --git a/data/formats-data.ts b/data/formats-data.ts index 8ccd46493f..a044fc10c0 100644 --- a/data/formats-data.ts +++ b/data/formats-data.ts @@ -1353,7 +1353,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = { randomBattleMoves: ["airslash", "defog", "fireblast", "roost", "uturn"], randomBattleLevel: 80, randomDoubleBattleMoves: ["bravebird", "fireblast", "heatwave", "protect", "roost", "tailwind"], - randomDoubleBattleLevel: 83, + randomDoubleBattleLevel: 81, randomBattleNoDynamaxMoves: ["defog", "fireblast", "hurricane", "roost", "uturn"], tier: "UU", doublesTier: "(DUU)", @@ -1736,7 +1736,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = { randomBattleMoves: ["earthquake", "iceshard", "iciclecrash", "knockoff", "stealthrock", "superpower"], randomBattleLevel: 80, randomDoubleBattleMoves: ["highhorsepower", "iceshard", "iciclecrash", "protect", "rockslide"], - randomDoubleBattleLevel: 84, + randomDoubleBattleLevel: 83, tier: "UU", doublesTier: "(DUU)", }, @@ -3192,7 +3192,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = { randomBattleMoves: ["calmmind", "moonblast", "moonlight", "psyshock", "thunderwave", "toxic"], randomBattleLevel: 80, randomDoubleBattleMoves: ["allyswitch", "helpinghand", "icywind", "moonlight", "psychic"], - randomDoubleBattleLevel: 84, + randomDoubleBattleLevel: 83, tier: "NUBL", doublesTier: "DUU", }, @@ -4089,7 +4089,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = { doublesTier: "(DUU)", }, virizion: { - randomBattleMoves: ["airslash", "closecombat", "leafblade", "leafstorm", "stoneedge", "swordsdance"], + randomBattleMoves: ["closecombat", "leafblade", "stoneedge", "swordsdance"], randomBattleLevel: 82, randomDoubleBattleMoves: ["closecombat", "coaching", "leafblade", "protect", "stoneedge", "swordsdance"], randomDoubleBattleLevel: 86, @@ -4172,7 +4172,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = { }, kyuremblack: { randomBattleMoves: ["dragondance", "fusionbolt", "iciclespear", "outrage"], - randomBattleLevel: 74, + randomBattleLevel: 73, randomDoubleBattleMoves: ["dragonclaw", "dragondance", "fusionbolt", "iciclespear", "protect", "roost"], randomDoubleBattleLevel: 75, tier: "Uber", @@ -4510,7 +4510,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = { }, dedenne: { randomBattleMoves: ["protect", "recycle", "thunderbolt", "toxic"], - randomBattleLevel: 86, + randomBattleLevel: 87, randomDoubleBattleMoves: ["eerieimpulse", "helpinghand", "nuzzle", "recycle", "superfang", "thunderbolt"], randomDoubleBattleLevel: 88, tier: "(PU)", @@ -5150,7 +5150,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = { randomBattleMoves: ["defog", "flamethrower", "multiattack", "partingshot", "thunderbolt", "toxic"], randomBattleLevel: 84, randomDoubleBattleMoves: ["flamethrower", "multiattack", "partingshot", "tailwind", "thunderbolt"], - randomDoubleBattleLevel: 88, + randomDoubleBattleLevel: 87, tier: "NU", doublesTier: "(DUU)", }, @@ -5336,7 +5336,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = { }, celesteela: { randomBattleMoves: ["airslash", "earthquake", "fireblast", "flashcannon", "leechseed", "protect"], - randomBattleLevel: 78, + randomBattleLevel: 77, randomDoubleBattleMoves: ["airslash", "autotomize", "earthquake", "fireblast", "flashcannon"], randomDoubleBattleLevel: 78, randomBattleNoDynamaxMoves: ["airslash", "earthquake", "fireblast", "heavyslam", "leechseed", "protect"], @@ -5955,7 +5955,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = { randomBattleMoves: ["crunch", "fishiousrend", "icefang", "lowkick", "psychicfangs"], randomBattleLevel: 80, randomDoubleBattleMoves: ["crunch", "dragonrush", "fishiousrend", "icefang", "psychicfangs"], - randomDoubleBattleLevel: 80, + randomDoubleBattleLevel: 78, tier: "Uber", doublesTier: "DOU", }, @@ -6106,7 +6106,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = { randomBattleMoves: ["closecombat", "highhorsepower", "iciclecrash", "swordsdance"], randomBattleLevel: 82, randomDoubleBattleMoves: ["closecombat", "highhorsepower", "iciclecrash", "protect"], - randomDoubleBattleLevel: 83, + randomDoubleBattleLevel: 82, tier: "NU", doublesTier: "DUU", }, diff --git a/data/random-teams.ts b/data/random-teams.ts index ae008f5085..6330bb2d60 100644 --- a/data/random-teams.ts +++ b/data/random-teams.ts @@ -181,7 +181,7 @@ export class RandomTeams { ), Poison: (movePool, moves, abilities, types, counter) => { if (counter.get('Poison')) return false; - return types.has('Ground') || types.has('Psychic') || !!counter.setupType || movePool.includes('gunkshot'); + return types.has('Ground') || types.has('Psychic') || types.has('Grass') || !!counter.setupType || movePool.includes('gunkshot'); }, Psychic: (movePool, moves, abilities, types, counter) => { if (counter.get('Psychic')) return false; @@ -196,7 +196,7 @@ export class RandomTeams { }, Water: (movePool, moves, abilities, types, counter, species) => { if (!counter.get('Water') && !moves.has('hypervoice')) return true; - if (movePool.includes('hypervoice') || movePool.includes('liquidation')) return true; + if (['hypervoice', 'liquidation', 'surgingstrikes'].some(m => movePool.includes(m))) return true; return abilities.has('Huge Power') && movePool.includes('aquajet'); }, }; @@ -1230,8 +1230,8 @@ export class RandomTeams { return (moves.has('rapidspin') || species.nfe || isDoubles); case 'Blaze': return (isDoubles && abilities.has('Solar Power')) || (!isDoubles && !isNoDynamax && species.id === 'charizard'); - case 'Bulletproof': case 'Overcoat': - return !!counter.setupType; + // case 'Bulletproof': case 'Overcoat': + // return !!counter.setupType; case 'Chlorophyll': return (species.baseStats.spe > 100 || !counter.get('Fire') && !moves.has('sunnyday') && !teamDetails.sun); case 'Cloud Nine': @@ -1993,7 +1993,7 @@ export class RandomTeams { const srWeakness = srImmunity ? 0 : this.dex.getEffectiveness('Rock', species); while (evs.hp > 1) { const hp = Math.floor(Math.floor(2 * species.baseStats.hp + ivs.hp + Math.floor(evs.hp / 4) + 100) * level / 100 + 10); - const multipleOfFourNecessary = (moves.has('substitute') && ( + const multipleOfFourNecessary = (moves.has('substitute') && !['Leftovers', 'Black Sludge'].includes(item) && ( item === 'Sitrus Berry' || item === 'Salac Berry' || ability === 'Power Construct' @@ -2017,7 +2017,12 @@ export class RandomTeams { if (moves.has('shellsidearm') && item === 'Choice Specs') evs.atk -= 8; // Minimize confusion damage - if (!counter.get('Physical') && !moves.has('transform') && (!moves.has('shellsidearm') || !counter.get('Status'))) { + const noAttackStatMoves = [...moves].every(m => { + const move = this.dex.moves.get(m); + if (move.damageCallback || move.damage) return false; + return move.category !== 'Physical' || move.id === 'bodypress'; + }); + if (noAttackStatMoves && !moves.has('transform') && (!moves.has('shellsidearm') || !counter.get('Status'))) { evs.atk = 0; ivs.atk = 0; } diff --git a/test/random-battles/gen8.js b/test/random-battles/gen8.js index 88fb718950..ec39e50e88 100644 --- a/test/random-battles/gen8.js +++ b/test/random-battles/gen8.js @@ -122,6 +122,19 @@ describe('[Gen 8] Random Battle', () => { assert.equal(set.item, 'Heavy-Duty Boots', `set=${JSON.stringify(set)}`); }); }); + + it('should guarantee Poison STAB on all Grass/Poison types (slow)', function () { + // This test takes more than 2000ms + this.timeout(0); + + const dex = Dex.forFormat(options.format); + const pokemon = dex.species + .all() + .filter(pkmn => pkmn.randomBattleMoves && pkmn.types.includes('Grass') && pkmn.types.includes('Poison')); + for (const pkmn of pokemon) { + testHasSTAB(pkmn.name, options, ['Poison']); + } + }); }); describe('[Gen 8] Random Doubles Battle', () => { @@ -142,6 +155,14 @@ describe('[Gen 8] Random Doubles Battle', () => { it('should give Galarian Darmanitan a Choice Item', () => { testSet('darmanitangalar', options, set => assert(set.item.startsWith('Choice '))); }); + + it('should always give Urshifu-Rapid-Strike Surging Strikes', () => { + testAlwaysHasMove('urshifurapidstrike', options, 'surgingstrikes'); + }); + + it('should always give Urshifu Wicked Blow', () => { + testAlwaysHasMove('urshifu', options, 'wickedblow'); + }); }); describe('[Gen 8] Random Battle (No Dmax)', () => { diff --git a/test/random-battles/tools.js b/test/random-battles/tools.js index 56d9d4d467..0ccd290727 100644 --- a/test/random-battles/tools.js +++ b/test/random-battles/tools.js @@ -34,10 +34,11 @@ function testSet(pokemon, options, test) { * * @param {ID} pokemon * @param {{format?: string, rounds?: number, isDoubles?: boolean, isLead?: boolean, isDynamax?: boolean, seed?: PRNGSeed}} options + * @param {string[] | undefined} types */ -function testHasSTAB(pokemon, options) { +function testHasSTAB(pokemon, options, types = undefined) { const dex = Dex.forFormat(options.format || 'gen8randombattle'); - const types = dex.species.get(pokemon).types; + types = types || dex.species.get(pokemon).types; testSet(pokemon, options, set => { assert( set.moves.some(move => types.includes(dex.moves.get(move).type)),