Fix some bugs

This commit is contained in:
Flashfyre 2023-04-28 00:25:33 -04:00
parent 14ba169ea5
commit fcd711673d
3 changed files with 13 additions and 9 deletions

View File

@ -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,

View File

@ -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[]) => {

View File

@ -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;
}