From fcd711673d3a70e96d9fae5c527b080f96c10fac Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 28 Apr 2023 00:25:33 -0400 Subject: [PATCH] Fix some bugs --- src/data/biome.ts | 6 +++--- src/modifier/modifier-type.ts | 8 ++++---- src/pokemon.ts | 8 ++++++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/data/biome.ts b/src/data/biome.ts index e35009c66a8..c11aad71bf1 100644 --- a/src/data/biome.ts +++ b/src/data/biome.ts @@ -74,11 +74,11 @@ export const biomeLinks: BiomeLinks = { [Biome.CAVE]: [ Biome.LAND, Biome.BEACH ], [Biome.DESERT]: Biome.RUINS, [Biome.ICE_CAVE]: Biome.LAKE, - [Biome.MEADOW]: Biome.GRASS, - [Biome.POWER_PLANT]: Biome.GRASS, + [Biome.MEADOW]: Biome.PLAINS, + [Biome.POWER_PLANT]: Biome.PLAINS, [Biome.VOLCANO]: Biome.ICE_CAVE, [Biome.GRAVEYARD]: Biome.ABYSS, - [Biome.DOJO]: Biome.GRASS, + [Biome.DOJO]: Biome.PLAINS, [Biome.RUINS]: Biome.FOREST, [Biome.WASTELAND]: Biome.LAND, [Biome.ABYSS]: Biome.SPACE, diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 9eba0f1c2bc..09480673918 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -575,11 +575,11 @@ const modifierPool = { return thresholdPartyMemberCount; }), new WeightedModifierType(modifierTypes.ETHER, (party: Pokemon[]) => { - const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.moveset.filter(m => (m.getMove().pp - m.ppUsed) <= 5).length).length, 3); + const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.moveset.filter(m => m.getPpRatio() <= 0.2).length).length, 3); return thresholdPartyMemberCount * 3; }), new WeightedModifierType(modifierTypes.MAX_ETHER, (party: Pokemon[]) => { - const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.moveset.filter(m => (m.getMove().pp - m.ppUsed) <= 5).length).length, 3); + const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.moveset.filter(m => m.getPpRatio() <= 0.2).length).length, 3); return thresholdPartyMemberCount; }), new WeightedModifierType(modifierTypes.TEMP_STAT_BOOSTER, 4), @@ -611,11 +611,11 @@ const modifierPool = { return thresholdPartyMemberCount; }), new WeightedModifierType(modifierTypes.ELIXIR, (party: Pokemon[]) => { - const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.moveset.filter(m => (m.getMove().pp - m.ppUsed) <= 5).length).length, 3); + const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.moveset.filter(m => m.getPpRatio() <= 0.2).length).length, 3); return thresholdPartyMemberCount * 3; }), new WeightedModifierType(modifierTypes.MAX_ELIXIR, (party: Pokemon[]) => { - const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.moveset.filter(m => (m.getMove().pp - m.ppUsed) <= 5).length).length, 3); + const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.moveset.filter(m => m.getPpRatio() <= 0.2).length).length, 3); return thresholdPartyMemberCount; }), new WeightedModifierType(modifierTypes.MAP, (party: Pokemon[]) => { diff --git a/src/pokemon.ts b/src/pokemon.ts index a3a5e07b5a7..bb38ef134a3 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -23,7 +23,7 @@ import { WeatherType } from './data/weather'; import { TempBattleStat } from './data/temp-battle-stat'; import { WeakenMoveTypeTag } from './data/arena-tag'; import { Biome } from './data/biome'; -import { Abilities, Ability, TypeImmunityAbAttr, VariableMovePowerAbAttr, abilities, applyPreAttackAbAttrs, applyPreDefendAbAttrs } from './data/ability'; +import { Ability, TypeImmunityAbAttr, VariableMovePowerAbAttr, abilities, applyPreAttackAbAttrs, applyPreDefendAbAttrs } from './data/ability'; export default abstract class Pokemon extends Phaser.GameObjects.Container { public id: integer; @@ -943,7 +943,7 @@ export class EnemyPokemon extends Pokemon { public aiType: AiType; constructor(scene: BattleScene, species: PokemonSpecies, level: integer) { - super(scene, -66, 84, species, level, scene.arena.getFormIndex(species)); + super(scene, -66, 84, species, level, undefined, scene.arena.getFormIndex(species)); let prevolution: Species; let speciesId = species.speciesId; @@ -1143,6 +1143,10 @@ export class PokemonMove { return allMoves[this.moveId]; } + getPpRatio(): number { + return 1 - (this.ppUsed / (this.getMove().pp + this.ppUp)); + } + getName(): string { return this.getMove().name; }