From bee7d08afe1e225d93b2e37badba7c2ac168c57d Mon Sep 17 00:00:00 2001 From: taylorhansen Date: Sun, 26 Nov 2023 19:31:44 -0800 Subject: [PATCH] Fix prettier/eslint --- environment.yml | 2 +- package-lock.json | 8 +-- package.json | 2 +- src/ts/battle/agent/maxDamage.ts | 80 ++++++++++++------------- src/ts/battle/parser/events.ts | 28 ++++----- src/ts/battle/state/encoder/encoders.ts | 28 +++++---- src/ts/battle/state/index.test.ts | 52 ++++++++-------- 7 files changed, 102 insertions(+), 98 deletions(-) diff --git a/environment.yml b/environment.yml index 0eca79be..92f197d4 100644 --- a/environment.yml +++ b/environment.yml @@ -5,4 +5,4 @@ dependencies: - python=3.9 - pip>=23.0 - pip: - - -r requirements.txt + - -r requirements.txt diff --git a/package-lock.json b/package-lock.json index 8400641e..840b8ad0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,7 @@ "prettier": "^3.1.0", "source-map-support": "^0.5.21", "ts-node": "^10.9.1", - "typescript": "^5.3.2" + "typescript": "5.2.2" }, "engines": { "node": ">=16.0.0" @@ -5354,9 +5354,9 @@ } }, "node_modules/typescript": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", - "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index 9f6ae99b..ea92f566 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,6 @@ "prettier": "^3.1.0", "source-map-support": "^0.5.21", "ts-node": "^10.9.1", - "typescript": "^5.3.2" + "typescript": "5.2.2" } } diff --git a/src/ts/battle/agent/maxDamage.ts b/src/ts/battle/agent/maxDamage.ts index 8042fc4b..e1351f9c 100644 --- a/src/ts/battle/agent/maxDamage.ts +++ b/src/ts/battle/agent/maxDamage.ts @@ -335,8 +335,8 @@ function calcDamge( benchMon === undefined ? "" : benchMon === null - ? "" - : benchMon.species, + ? "" + : benchMon.species, ]; } @@ -692,16 +692,16 @@ function calcDamge( critRatio === true ? 1 : critRatio === false - ? 0 - : critRatio < 1 - ? 1 / 16 - : critRatio < 2 - ? 1 / 8 - : critRatio < 3 - ? 1 / 4 - : critRatio < 4 - ? 1 / 3 - : 1 / 2; + ? 0 + : critRatio < 1 + ? 1 / 16 + : critRatio < 2 + ? 1 / 8 + : critRatio < 3 + ? 1 / 4 + : critRatio < 4 + ? 1 / 3 + : 1 / 2; let critModifier = psMove.critModifier ?? 2; if (ourActive.ability === "sniper") { @@ -730,12 +730,12 @@ function calcDamge( ratio < 1 ? 40 : ratio < 2 - ? 60 - : ratio < 3 - ? 80 - : ratio < 4 - ? 120 - : 150; + ? 60 + : ratio < 3 + ? 80 + : ratio < 4 + ? 120 + : 150; break; } case "eruption": @@ -755,14 +755,14 @@ function calcDamge( ratio < 2 ? 200 : ratio < 6 - ? 150 - : ratio < 13 - ? 100 - : ratio < 22 - ? 80 - : ratio < 43 - ? 40 - : 20; + ? 150 + : ratio < 13 + ? 100 + : ratio < 22 + ? 80 + : ratio < 43 + ? 40 + : 20; break; } case "fling": @@ -782,14 +782,14 @@ function calcDamge( theirSpecies.weightkg < 10 ? 20 : theirSpecies.weightkg < 25 - ? 40 - : theirSpecies.weightkg < 50 - ? 60 - : theirSpecies.weightkg < 100 - ? 80 - : theirSpecies.weightkg < 200 - ? 100 - : 120; + ? 40 + : theirSpecies.weightkg < 50 + ? 60 + : theirSpecies.weightkg < 100 + ? 80 + : theirSpecies.weightkg < 200 + ? 100 + : 120; break; case "gyroball": basePower = 1 + Math.floor((25 * theirSpe) / ourSpe); @@ -855,12 +855,12 @@ function calcDamge( move.pp > 3 ? 40 : move.pp > 2 - ? 50 - : move.pp > 1 - ? 60 - : move.pp > 0 - ? 80 - : 200; + ? 50 + : move.pp > 1 + ? 60 + : move.pp > 0 + ? 80 + : 200; break; case "wringout": basePower = diff --git a/src/ts/battle/parser/events.ts b/src/ts/battle/parser/events.ts index 61a5dc27..5461f8ec 100644 --- a/src/ts/battle/parser/events.ts +++ b/src/ts/battle/parser/events.ts @@ -761,8 +761,8 @@ handlersImpl["|-fail|"] = async function (ctx) { const side = event.kwArgs.of ? Protocol.parsePokemonIdent(event.kwArgs.of).player : ident.player === "p1" - ? "p2" - : "p1"; + ? "p2" + : "p1"; const mon = ctx.state.getTeam(side).active; if (from.type === "ability") { mon.revealAbility(from.name); @@ -1567,8 +1567,8 @@ handlersImpl["|-activate|"] = async function (ctx) { const targetSide = event.kwArgs.of ? Protocol.parsePokemonIdent(event.kwArgs.of).player : ident.player === "p1" - ? "p2" - : "p1"; + ? "p2" + : "p1"; const opp = ctx.state.getTeam(targetSide).active; opp.moveset.reveal(warnMoveId); @@ -1605,8 +1605,8 @@ handlersImpl["|-activate|"] = async function (ctx) { const targetSide = event.kwArgs.of ? Protocol.parsePokemonIdent(event.kwArgs.of).player : ident.player === "p1" - ? "p2" - : "p1"; + ? "p2" + : "p1"; v.lockOn(ctx.state.getTeam(targetSide).active.volatile); break; } @@ -1783,14 +1783,14 @@ export const handlers = }, } : handlersImpl[key] === "unsupported" - ? { - // Unsupported parser throws an error. - async [key](ctx: BattleParserContext) { - await unsupportedParser(ctx, key); - }, - } - : // Handler already implemented, don't override it. - undefined, + ? { + // Unsupported parser throws an error. + async [key](ctx: BattleParserContext) { + await unsupportedParser(ctx, key); + }, + } + : // Handler already implemented, don't override it. + undefined, ), ) as Required; diff --git a/src/ts/battle/state/encoder/encoders.ts b/src/ts/battle/state/encoder/encoders.ts index e2028a37..d606bddf 100644 --- a/src/ts/battle/state/encoder/encoders.ts +++ b/src/ts/battle/state/encoder/encoders.ts @@ -169,10 +169,10 @@ export const definedMajorStatusCounterEncoder: Encoder = concat( item ? [item] : usage && usage.size > 0 - ? constraintWithUsage(dex.itemKeys, usage, smoothing) - : itemSet, + ? constraintWithUsage(dex.itemKeys, usage, smoothing) + : itemSet, itemKeyEncoder, ), augment( @@ -533,8 +533,8 @@ export const definedItemEncoder: Encoder = concat( lastItem ? [lastItem] : usage && usage.size > 0 - ? constraintWithUsage(dex.itemKeys, usage, smoothing) - : itemSet, + ? constraintWithUsage(dex.itemKeys, usage, smoothing) + : itemSet, itemKeyEncoder, ), ); @@ -610,10 +610,14 @@ export const definedMoveEncoder: Encoder = concat( move.name !== "hiddenpower" ? [move.name] : typeof hpType === "string" - ? [`hiddenpower${hpType}`] - : hpType instanceof Map && hpType.size > 0 - ? constraintWithUsage(hiddenPowerMoveKeys, hpType, smoothing) - : hiddenPowerMoveKeysSet, + ? [`hiddenpower${hpType}`] + : hpType instanceof Map && hpType.size > 0 + ? constraintWithUsage( + hiddenPowerMoveKeys, + hpType, + smoothing, + ) + : hiddenPowerMoveKeysSet, moveKeyEncoder, ), // Ratio of pp to maxpp. diff --git a/src/ts/battle/state/index.test.ts b/src/ts/battle/state/index.test.ts index 3f6ba37f..e48bd66a 100644 --- a/src/ts/battle/state/index.test.ts +++ b/src/ts/battle/state/index.test.ts @@ -1,35 +1,35 @@ import "mocha"; -import * as Hp from "./Hp.test"; -import * as MajorStatusCounter from "./MajorStatusCounter.test"; -import * as Move from "./Move.test"; -import * as Moveset from "./Moveset.test"; -import * as MultiTempStatus from "./MultiTempStatus.test"; -import * as Pokemon from "./Pokemon.test"; -import * as RoomStatus from "./RoomStatus.test"; -import * as StatRange from "./StatRange.test"; -import * as StatTable from "./StatTable.test"; -import * as Team from "./Team.test"; -import * as TeamStatus from "./TeamStatus.test"; -import * as TempStatus from "./TempStatus.test"; -import * as VolatileStatus from "./VolatileStatus.test"; +import * as hp from "./Hp.test"; +import * as majorStatusCounter from "./MajorStatusCounter.test"; +import * as move from "./Move.test"; +import * as moveset from "./Moveset.test"; +import * as multiTempStatus from "./MultiTempStatus.test"; +import * as pokemon from "./Pokemon.test"; +import * as roomStatus from "./RoomStatus.test"; +import * as statRange from "./StatRange.test"; +import * as statTable from "./StatTable.test"; +import * as team from "./Team.test"; +import * as teamStatus from "./TeamStatus.test"; +import * as tempStatus from "./TempStatus.test"; +import * as volatileStatus from "./VolatileStatus.test"; import * as encoder from "./encoder/index.test"; import * as utility from "./utility.test"; export const test = () => describe("state", function () { - Hp.test(); - MajorStatusCounter.test(); - Move.test(); - Moveset.test(); - MultiTempStatus.test(); - Pokemon.test(); - RoomStatus.test(); - StatRange.test(); - StatTable.test(); - Team.test(); - TeamStatus.test(); - TempStatus.test(); - VolatileStatus.test(); + hp.test(); + majorStatusCounter.test(); + move.test(); + moveset.test(); + multiTempStatus.test(); + pokemon.test(); + roomStatus.test(); + statRange.test(); + statTable.test(); + team.test(); + teamStatus.test(); + tempStatus.test(); + volatileStatus.test(); utility.test(); encoder.test(); });