mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 16:32:16 +02:00
Refactor PokemonBaseStatModifier
Slightly
This commit is contained in:
parent
34a574e498
commit
8461ca3fc2
@ -10,7 +10,7 @@ import * as Utils from "../utils";
|
|||||||
import { Type, TypeDamageMultiplier, getTypeDamageMultiplier, getTypeRgb } from "../data/type";
|
import { Type, TypeDamageMultiplier, getTypeDamageMultiplier, getTypeRgb } from "../data/type";
|
||||||
import { getLevelTotalExp } from "../data/exp";
|
import { getLevelTotalExp } from "../data/exp";
|
||||||
import { Stat } from "../data/pokemon-stat";
|
import { Stat } from "../data/pokemon-stat";
|
||||||
import { DamageMoneyRewardModifier, EnemyDamageBoosterModifier, EnemyDamageReducerModifier, EnemyEndureChanceModifier, EnemyFusionChanceModifier, HiddenAbilityRateBoosterModifier, PokemonBaseStatModifier, PokemonFriendshipBoosterModifier, PokemonHeldItemModifier, PokemonNatureWeightModifier, ShinyRateBoosterModifier, SurviveDamageModifier, TempStatStageBoosterModifier, TempCritBoosterModifier, StatBoosterModifier, CritBoosterModifier, TerastallizeModifier } from "../modifier/modifier";
|
import { DamageMoneyRewardModifier, EnemyDamageBoosterModifier, EnemyDamageReducerModifier, EnemyEndureChanceModifier, EnemyFusionChanceModifier, HiddenAbilityRateBoosterModifier, BaseStatModifier, PokemonFriendshipBoosterModifier, PokemonHeldItemModifier, PokemonNatureWeightModifier, ShinyRateBoosterModifier, SurviveDamageModifier, TempStatStageBoosterModifier, TempCritBoosterModifier, StatBoosterModifier, CritBoosterModifier, TerastallizeModifier } from "../modifier/modifier";
|
||||||
import { PokeballType } from "../data/pokeball";
|
import { PokeballType } from "../data/pokeball";
|
||||||
import { Gender } from "../data/gender";
|
import { Gender } from "../data/gender";
|
||||||
import { initMoveAnim, loadMoveAnimAssets } from "../data/battle-anims";
|
import { initMoveAnim, loadMoveAnimAssets } from "../data/battle-anims";
|
||||||
@ -707,10 +707,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the entire set of in-battle stat stages of the {@linkcode Pokemon}.
|
* Retrieves the entire set of in-battle stat stages of the {@linkcode Pokemon}.
|
||||||
* @returns the numeric values of the {@linkcode Pokemon}'s in-battle stat stages if available, undefined otherwise
|
* @returns the numeric values of the {@linkcode Pokemon}'s in-battle stat stages if available, a fresh stat stage array otherwise
|
||||||
*/
|
*/
|
||||||
getStatStages(): number[] | undefined {
|
getStatStages(): number[] {
|
||||||
return this.summonData ? this.summonData.statStages : undefined;
|
return this.summonData ? this.summonData.statStages : [ 0, 0, 0, 0, 0, 0, 0 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -817,22 +817,23 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.stats = [ 0, 0, 0, 0, 0, 0 ];
|
this.stats = [ 0, 0, 0, 0, 0, 0 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get and manipulate base stats
|
||||||
const baseStats = this.getSpeciesForm(true).baseStats.slice();
|
const baseStats = this.getSpeciesForm(true).baseStats.slice();
|
||||||
if (this.isFusion()) {
|
if (this.isFusion()) {
|
||||||
const fusionBaseStats = this.getFusionSpeciesForm(true).baseStats;
|
const fusionBaseStats = this.getFusionSpeciesForm(true).baseStats;
|
||||||
for (let s = 0; s < this.stats.length; s++) {
|
for (const s of PERMANENT_STATS) {
|
||||||
baseStats[s] = Math.ceil((baseStats[s] + fusionBaseStats[s]) / 2);
|
baseStats[s] = Math.ceil((baseStats[s] + fusionBaseStats[s]) / 2);
|
||||||
}
|
}
|
||||||
} else if (this.scene.gameMode.isSplicedOnly) {
|
} else if (this.scene.gameMode.isSplicedOnly) {
|
||||||
for (let s = 0; s < this.stats.length; s++) {
|
for (const s of PERMANENT_STATS) {
|
||||||
baseStats[s] = Math.ceil(baseStats[s] / 2);
|
baseStats[s] = Math.ceil(baseStats[s] / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.scene.applyModifiers(BaseStatModifier, this.isPlayer(), this, baseStats);
|
||||||
|
|
||||||
this.scene.applyModifiers(PokemonBaseStatModifier, this.isPlayer(), this, baseStats);
|
// Using base stats, calculate and store stats one by one
|
||||||
for (const s of PERMANENT_STATS) {
|
for (const s of PERMANENT_STATS) {
|
||||||
const baseStat = baseStats[s];
|
let value = Math.floor(((2 * baseStats[s] + this.ivs[s]) * this.level) * 0.01);
|
||||||
let value = Math.floor(((2 * baseStat + this.ivs[s]) * this.level) * 0.01);
|
|
||||||
if (s === Stat.HP) {
|
if (s === Stat.HP) {
|
||||||
value = value + this.level + 10;
|
value = value + this.level + 10;
|
||||||
if (this.hasAbility(Abilities.WONDER_GUARD, false, true)) {
|
if (this.hasAbility(Abilities.WONDER_GUARD, false, true)) {
|
||||||
|
@ -63,8 +63,8 @@ export const modifierType: ModifierTypeTranslationEntries = {
|
|||||||
"AllPokemonLevelIncrementModifierType": {
|
"AllPokemonLevelIncrementModifierType": {
|
||||||
description: "Increases all party members' level by {{levels}}.",
|
description: "Increases all party members' level by {{levels}}.",
|
||||||
},
|
},
|
||||||
"PokemonBaseStatBoosterModifierType": {
|
"BaseStatBoosterModifierType": {
|
||||||
description: "Increases the holder's base {{statName}} by 10%. The higher your IVs, the higher the stack limit.",
|
description: "Increases the holder's base {{stat}} by 10%. The higher your IVs, the higher the stack limit.",
|
||||||
},
|
},
|
||||||
"AllPokemonFullHpRestoreModifierType": {
|
"AllPokemonFullHpRestoreModifierType": {
|
||||||
description: "Restores 100% HP for all Pokémon.",
|
description: "Restores 100% HP for all Pokémon.",
|
||||||
|
@ -63,8 +63,8 @@ export const modifierType: ModifierTypeTranslationEntries = {
|
|||||||
"AllPokemonLevelIncrementModifierType": {
|
"AllPokemonLevelIncrementModifierType": {
|
||||||
description: "Erhöht das Level aller Teammitglieder um {{levels}}.",
|
description: "Erhöht das Level aller Teammitglieder um {{levels}}.",
|
||||||
},
|
},
|
||||||
"PokemonBaseStatBoosterModifierType": {
|
"BaseStatBoosterModifierType": {
|
||||||
description: "Erhöht den {{statName}} Basiswert des Trägers um 10%. Das Stapellimit erhöht sich, je höher dein IS-Wert ist.",
|
description: "Erhöht den {{stat}} Basiswert des Trägers um 10%. Das Stapellimit erhöht sich, je höher dein IS-Wert ist.",
|
||||||
},
|
},
|
||||||
"AllPokemonFullHpRestoreModifierType": {
|
"AllPokemonFullHpRestoreModifierType": {
|
||||||
description: "Stellt 100% der KP aller Pokémon her.",
|
description: "Stellt 100% der KP aller Pokémon her.",
|
||||||
|
@ -63,8 +63,8 @@ export const modifierType: ModifierTypeTranslationEntries = {
|
|||||||
"AllPokemonLevelIncrementModifierType": {
|
"AllPokemonLevelIncrementModifierType": {
|
||||||
description: "Increases all party members' level by {{levels}}.",
|
description: "Increases all party members' level by {{levels}}.",
|
||||||
},
|
},
|
||||||
"PokemonBaseStatBoosterModifierType": {
|
"BaseStatBoosterModifierType": {
|
||||||
description: "Increases the holder's base {{statName}} by 10%. The higher your IVs, the higher the stack limit.",
|
description: "Increases the holder's base {{stat}} by 10%. The higher your IVs, the higher the stack limit.",
|
||||||
},
|
},
|
||||||
"AllPokemonFullHpRestoreModifierType": {
|
"AllPokemonFullHpRestoreModifierType": {
|
||||||
description: "Restores 100% HP for all Pokémon.",
|
description: "Restores 100% HP for all Pokémon.",
|
||||||
|
@ -63,8 +63,8 @@ export const modifierType: ModifierTypeTranslationEntries = {
|
|||||||
"AllPokemonLevelIncrementModifierType": {
|
"AllPokemonLevelIncrementModifierType": {
|
||||||
description: "Aumenta el nivel de todos los miembros del equipo en {{levels}}.",
|
description: "Aumenta el nivel de todos los miembros del equipo en {{levels}}.",
|
||||||
},
|
},
|
||||||
"PokemonBaseStatBoosterModifierType": {
|
"BaseStatBoosterModifierType": {
|
||||||
description: "Aumenta la est. {{statName}} base del portador en un 10%.\nCuanto mayores sean tus IVs, mayor será el límite de acumulación.",
|
description: "Aumenta la est. {{stat}} base del portador en un 10%.\nCuanto mayores sean tus IVs, mayor será el límite de acumulación.",
|
||||||
},
|
},
|
||||||
"AllPokemonFullHpRestoreModifierType": {
|
"AllPokemonFullHpRestoreModifierType": {
|
||||||
description: "Restaura el 100% de los PS de todos los Pokémon.",
|
description: "Restaura el 100% de los PS de todos los Pokémon.",
|
||||||
|
@ -63,8 +63,8 @@ export const modifierType: ModifierTypeTranslationEntries = {
|
|||||||
"AllPokemonLevelIncrementModifierType": {
|
"AllPokemonLevelIncrementModifierType": {
|
||||||
description: "Fait monter toute l’équipe de {{levels}} niveau·x.",
|
description: "Fait monter toute l’équipe de {{levels}} niveau·x.",
|
||||||
},
|
},
|
||||||
"PokemonBaseStatBoosterModifierType": {
|
"BaseStatBoosterModifierType": {
|
||||||
description: "Augmente de 10% {{statName}} de base de son porteur. Plus les IV sont hauts, plus il peut en porter.",
|
description: "Augmente de 10% {{stat}} de base de son porteur. Plus les IV sont hauts, plus il peut en porter.",
|
||||||
},
|
},
|
||||||
"AllPokemonFullHpRestoreModifierType": {
|
"AllPokemonFullHpRestoreModifierType": {
|
||||||
description: "Restaure tous les PV de toute l’équipe.",
|
description: "Restaure tous les PV de toute l’équipe.",
|
||||||
|
@ -63,8 +63,8 @@ export const modifierType: ModifierTypeTranslationEntries = {
|
|||||||
"AllPokemonLevelIncrementModifierType": {
|
"AllPokemonLevelIncrementModifierType": {
|
||||||
description: "Aumenta i livell di tutti i Pokémon della squadra di {{levels}}.",
|
description: "Aumenta i livell di tutti i Pokémon della squadra di {{levels}}.",
|
||||||
},
|
},
|
||||||
"PokemonBaseStatBoosterModifierType": {
|
"BaseStatBoosterModifierType": {
|
||||||
description: "Aumenta {{statName}} di base del possessore del 10%.",
|
description: "Aumenta {{stat}} di base del possessore del 10%.",
|
||||||
},
|
},
|
||||||
"AllPokemonFullHpRestoreModifierType": {
|
"AllPokemonFullHpRestoreModifierType": {
|
||||||
description: "Restituisce il 100% dei PS a tutti i Pokémon.",
|
description: "Restituisce il 100% dei PS a tutti i Pokémon.",
|
||||||
|
@ -63,8 +63,8 @@ export const modifierType: ModifierTypeTranslationEntries = {
|
|||||||
"AllPokemonLevelIncrementModifierType": {
|
"AllPokemonLevelIncrementModifierType": {
|
||||||
description: "すべてのパーティメンバーのレベルを1あげる",
|
description: "すべてのパーティメンバーのレベルを1あげる",
|
||||||
},
|
},
|
||||||
"PokemonBaseStatBoosterModifierType": {
|
"BaseStatBoosterModifierType": {
|
||||||
description: "ポケモンの{{statName}}のきほんステータスを10パーセントあげる。こたいちがたかいほどスタックのげんかいもたかくなる。",
|
description: "ポケモンの{{stat}}のきほんステータスを10パーセントあげる。こたいちがたかいほどスタックのげんかいもたかくなる。",
|
||||||
},
|
},
|
||||||
"AllPokemonFullHpRestoreModifierType": {
|
"AllPokemonFullHpRestoreModifierType": {
|
||||||
description: "すべてのポケモンのHPを100パーセントかいふくする",
|
description: "すべてのポケモンのHPを100パーセントかいふくする",
|
||||||
|
@ -63,8 +63,8 @@ export const modifierType: ModifierTypeTranslationEntries = {
|
|||||||
"AllPokemonLevelIncrementModifierType": {
|
"AllPokemonLevelIncrementModifierType": {
|
||||||
description: "자신의 모든 포켓몬의 레벨이 {{levels}}만큼 상승한다.",
|
description: "자신의 모든 포켓몬의 레벨이 {{levels}}만큼 상승한다.",
|
||||||
},
|
},
|
||||||
"PokemonBaseStatBoosterModifierType": {
|
"BaseStatBoosterModifierType": {
|
||||||
description: "지니게 하면 {{statName}} 종족값을 10% 올려준다. 개체값이 높을수록 더 많이 누적시킬 수 있다.",
|
description: "지니게 하면 {{stat}} 종족값을 10% 올려준다. 개체값이 높을수록 더 많이 누적시킬 수 있다.",
|
||||||
},
|
},
|
||||||
"AllPokemonFullHpRestoreModifierType": {
|
"AllPokemonFullHpRestoreModifierType": {
|
||||||
description: "자신의 포켓몬의 HP를 모두 회복한다.",
|
description: "자신의 포켓몬의 HP를 모두 회복한다.",
|
||||||
|
@ -63,8 +63,8 @@ export const modifierType: ModifierTypeTranslationEntries = {
|
|||||||
"AllPokemonLevelIncrementModifierType": {
|
"AllPokemonLevelIncrementModifierType": {
|
||||||
description: "Aumenta em {{levels}} o nível de todos os membros da equipe.",
|
description: "Aumenta em {{levels}} o nível de todos os membros da equipe.",
|
||||||
},
|
},
|
||||||
"PokemonBaseStatBoosterModifierType": {
|
"BaseStatBoosterModifierType": {
|
||||||
description: "Aumenta o atributo base de {{statName}} em 10%. Quanto maior os IVs, maior o limite de aumento.",
|
description: "Aumenta o atributo base de {{stat}} em 10%. Quanto maior os IVs, maior o limite de aumento.",
|
||||||
},
|
},
|
||||||
"AllPokemonFullHpRestoreModifierType": {
|
"AllPokemonFullHpRestoreModifierType": {
|
||||||
description: "Restaura totalmente os PS de todos os Pokémon.",
|
description: "Restaura totalmente os PS de todos os Pokémon.",
|
||||||
|
@ -63,8 +63,8 @@ export const modifierType: ModifierTypeTranslationEntries = {
|
|||||||
"AllPokemonLevelIncrementModifierType": {
|
"AllPokemonLevelIncrementModifierType": {
|
||||||
description: "使一只寶可夢的等級提升{{levels}}級。",
|
description: "使一只寶可夢的等級提升{{levels}}級。",
|
||||||
},
|
},
|
||||||
"PokemonBaseStatBoosterModifierType": {
|
"BaseStatBoosterModifierType": {
|
||||||
description: "增加10%持有者的{{statName}},\n个体值越高堆叠上限越高。",
|
description: "增加10%持有者的{{stat}},\n个体值越高堆叠上限越高。",
|
||||||
},
|
},
|
||||||
"AllPokemonFullHpRestoreModifierType": {
|
"AllPokemonFullHpRestoreModifierType": {
|
||||||
description: "所有宝可梦完全回复HP。",
|
description: "所有宝可梦完全回复HP。",
|
||||||
|
@ -63,9 +63,9 @@ export const modifierType: ModifierTypeTranslationEntries = {
|
|||||||
AllPokemonLevelIncrementModifierType: {
|
AllPokemonLevelIncrementModifierType: {
|
||||||
description: "Increases all party members' level by {{levels}}.",
|
description: "Increases all party members' level by {{levels}}.",
|
||||||
},
|
},
|
||||||
PokemonBaseStatBoosterModifierType: {
|
BaseStatBoosterModifierType: {
|
||||||
description:
|
description:
|
||||||
"增加持有者的{{statName}}10%,個體值越高堆疊\n上限越高。",
|
"增加持有者的{{stat}}10%,個體值越高堆疊\n上限越高。",
|
||||||
},
|
},
|
||||||
AllPokemonFullHpRestoreModifierType: {
|
AllPokemonFullHpRestoreModifierType: {
|
||||||
description: "所有寶可夢完全恢復HP。",
|
description: "所有寶可夢完全恢復HP。",
|
||||||
|
@ -3,7 +3,6 @@ import { AttackMove, allMoves, selfStatLowerMoves } from "../data/move";
|
|||||||
import { MAX_PER_TYPE_POKEBALLS, PokeballType, getPokeballCatchMultiplier, getPokeballName } from "../data/pokeball";
|
import { MAX_PER_TYPE_POKEBALLS, PokeballType, getPokeballCatchMultiplier, getPokeballName } from "../data/pokeball";
|
||||||
import Pokemon, { EnemyPokemon, PlayerPokemon, PokemonMove } from "../field/pokemon";
|
import Pokemon, { EnemyPokemon, PlayerPokemon, PokemonMove } from "../field/pokemon";
|
||||||
import { EvolutionItem, pokemonEvolutions } from "../data/pokemon-evolutions";
|
import { EvolutionItem, pokemonEvolutions } from "../data/pokemon-evolutions";
|
||||||
import { Stat, getStatName } from "../data/pokemon-stat";
|
|
||||||
import { tmPoolTiers, tmSpecies } from "../data/tms";
|
import { tmPoolTiers, tmSpecies } from "../data/tms";
|
||||||
import { Type } from "../data/type";
|
import { Type } from "../data/type";
|
||||||
import PartyUiHandler, { PokemonMoveSelectFilter, PokemonSelectFilter } from "../ui/party-ui-handler";
|
import PartyUiHandler, { PokemonMoveSelectFilter, PokemonSelectFilter } from "../ui/party-ui-handler";
|
||||||
@ -27,7 +26,7 @@ import { BerryType } from "#enums/berry-type";
|
|||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages.js";
|
import { getPokemonNameWithAffix } from "#app/messages.js";
|
||||||
import { TEMP_BATTLE_STATS, TempBattleStat } from "#app/enums/stat";
|
import { PermanentStat, TEMP_BATTLE_STATS, TempBattleStat, Stat } from "#app/enums/stat";
|
||||||
|
|
||||||
const outputModifierData = false;
|
const outputModifierData = false;
|
||||||
const useMaxWeightForOutput = false;
|
const useMaxWeightForOutput = false;
|
||||||
@ -593,40 +592,24 @@ export class AllPokemonLevelIncrementModifierType extends ModifierType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBaseStatBoosterItemName(stat: Stat) {
|
export class BaseStatBoosterModifierType extends PokemonHeldItemModifierType implements GeneratedPersistentModifierType {
|
||||||
switch (stat) {
|
private stat: PermanentStat;
|
||||||
case Stat.HP:
|
private key: string;
|
||||||
return "HP Up";
|
|
||||||
case Stat.ATK:
|
|
||||||
return "Protein";
|
|
||||||
case Stat.DEF:
|
|
||||||
return "Iron";
|
|
||||||
case Stat.SPATK:
|
|
||||||
return "Calcium";
|
|
||||||
case Stat.SPDEF:
|
|
||||||
return "Zinc";
|
|
||||||
case Stat.SPD:
|
|
||||||
return "Carbos";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class PokemonBaseStatBoosterModifierType extends PokemonHeldItemModifierType implements GeneratedPersistentModifierType {
|
constructor(stat: PermanentStat) {
|
||||||
private localeName: string;
|
const key = BaseStatBoosterModifierTypeGenerator.items[stat];
|
||||||
private stat: Stat;
|
super("", key, (_type, args) => new Modifiers.BaseStatModifier(this, (args[0] as Pokemon).id, this.stat));
|
||||||
|
|
||||||
constructor(localeName: string, stat: Stat) {
|
|
||||||
super("", localeName.replace(/[ \-]/g, "_").toLowerCase(), (_type, args) => new Modifiers.PokemonBaseStatModifier(this, (args[0] as Pokemon).id, this.stat));
|
|
||||||
|
|
||||||
this.localeName = localeName;
|
|
||||||
this.stat = stat;
|
this.stat = stat;
|
||||||
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
get name(): string {
|
get name(): string {
|
||||||
return i18next.t(`modifierType:BaseStatBoosterItem.${this.localeName.replace(/[ \-]/g, "_").toLowerCase()}`);
|
return i18next.t(`modifierType:BaseStatBoosterItem.${this.key}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getDescription(scene: BattleScene): string {
|
getDescription(_scene: BattleScene): string {
|
||||||
return i18next.t("modifierType:ModifierType.PokemonBaseStatBoosterModifierType.description", { statName: getStatName(this.stat) });
|
return i18next.t("modifierType:ModifierType.BaseStatBoosterModifierType.description", { stat: i18next.t(`pokemonInfo:Stat.${Stat[this.stat]}`) });
|
||||||
}
|
}
|
||||||
|
|
||||||
getPregenArgs(): any[] {
|
getPregenArgs(): any[] {
|
||||||
@ -904,6 +887,27 @@ class AttackTypeBoosterModifierTypeGenerator extends ModifierTypeGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BaseStatBoosterModifierTypeGenerator extends ModifierTypeGenerator {
|
||||||
|
public static readonly items: Record<PermanentStat, string> = {
|
||||||
|
[Stat.HP]: "hp_up",
|
||||||
|
[Stat.ATK]: "protein",
|
||||||
|
[Stat.DEF]: "iron",
|
||||||
|
[Stat.SPATK]: "calcium",
|
||||||
|
[Stat.SPDEF]: "zinc",
|
||||||
|
[Stat.SPD]: "carbos"
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super((_party: Pokemon[], pregenArgs?: any[]) => {
|
||||||
|
if (pregenArgs) {
|
||||||
|
return new BaseStatBoosterModifierType(pregenArgs[0]);
|
||||||
|
}
|
||||||
|
const randStat: PermanentStat = Utils.randSeedInt(Stat.SPD + 1);
|
||||||
|
return new BaseStatBoosterModifierType(randStat);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class TempStatStageBoosterModifierTypeGenerator extends ModifierTypeGenerator {
|
class TempStatStageBoosterModifierTypeGenerator extends ModifierTypeGenerator {
|
||||||
public static readonly items: Record<TempBattleStat, string> = {
|
public static readonly items: Record<TempBattleStat, string> = {
|
||||||
[Stat.ATK]: "x_attack",
|
[Stat.ATK]: "x_attack",
|
||||||
@ -1304,14 +1308,7 @@ export const modifierTypes = {
|
|||||||
}
|
}
|
||||||
}("modifierType:ModifierType.DIRE_HIT", "dire_hit", (type, _args) => new Modifiers.TempCritBoosterModifier(type)),
|
}("modifierType:ModifierType.DIRE_HIT", "dire_hit", (type, _args) => new Modifiers.TempCritBoosterModifier(type)),
|
||||||
|
|
||||||
BASE_STAT_BOOSTER: () => new ModifierTypeGenerator((party: Pokemon[], pregenArgs?: any[]) => {
|
BASE_STAT_BOOSTER: () => new BaseStatBoosterModifierTypeGenerator(),
|
||||||
if (pregenArgs) {
|
|
||||||
const stat = pregenArgs[0] as Stat;
|
|
||||||
return new PokemonBaseStatBoosterModifierType(getBaseStatBoosterItemName(stat)!, stat); // TODO: Stat
|
|
||||||
}
|
|
||||||
const randStat = Utils.randSeedInt(6) as Stat;
|
|
||||||
return new PokemonBaseStatBoosterModifierType(getBaseStatBoosterItemName(randStat)!, randStat); // TODO: Stat
|
|
||||||
}),
|
|
||||||
|
|
||||||
ATTACK_TYPE_BOOSTER: () => new AttackTypeBoosterModifierTypeGenerator(),
|
ATTACK_TYPE_BOOSTER: () => new AttackTypeBoosterModifierTypeGenerator(),
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import Overrides from "#app/overrides";
|
|||||||
import { ModifierType, modifierTypes } from "./modifier-type";
|
import { ModifierType, modifierTypes } from "./modifier-type";
|
||||||
import { Command } from "#app/ui/command-ui-handler.js";
|
import { Command } from "#app/ui/command-ui-handler.js";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import { BATTLE_STATS, TEMP_BATTLE_STATS, TempBattleStat } from "#app/enums/stat";
|
import { BATTLE_STATS, PermanentStat, TEMP_BATTLE_STATS, TempBattleStat } from "#app/enums/stat"; // TODO: Add Type
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
||||||
import { allMoves } from "#app/data/move.js";
|
import { allMoves } from "#app/data/move.js";
|
||||||
@ -708,24 +708,30 @@ export class TerastallizeModifier extends LapsingPokemonHeldItemModifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PokemonBaseStatModifier extends PokemonHeldItemModifier {
|
/**
|
||||||
protected stat: Stat;
|
* Modifier used for held items, specifically vitamins like Carbos, Hp Up, etc., that
|
||||||
|
* increase the value of a given {@linkcode PermanentStat}.
|
||||||
|
* @extends LapsingPersistentModifier
|
||||||
|
* @see {@linkcode apply}
|
||||||
|
*/
|
||||||
|
export class BaseStatModifier extends PokemonHeldItemModifier {
|
||||||
|
protected stat: PermanentStat;
|
||||||
readonly isTransferrable: boolean = false;
|
readonly isTransferrable: boolean = false;
|
||||||
|
|
||||||
constructor(type: ModifierTypes.PokemonBaseStatBoosterModifierType, pokemonId: integer, stat: Stat, stackCount?: integer) {
|
constructor(type: ModifierType, pokemonId: integer, stat: PermanentStat, stackCount?: integer) {
|
||||||
super(type, pokemonId, stackCount);
|
super(type, pokemonId, stackCount);
|
||||||
this.stat = stat;
|
this.stat = stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
matchType(modifier: Modifier): boolean {
|
matchType(modifier: Modifier): boolean {
|
||||||
if (modifier instanceof PokemonBaseStatModifier) {
|
if (modifier instanceof BaseStatModifier) {
|
||||||
return (modifier as PokemonBaseStatModifier).stat === this.stat;
|
return (modifier as BaseStatModifier).stat === this.stat;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
clone(): PersistentModifier {
|
clone(): PersistentModifier {
|
||||||
return new PokemonBaseStatModifier(this.type as ModifierTypes.PokemonBaseStatBoosterModifierType, this.pokemonId, this.stat, this.stackCount);
|
return new BaseStatModifier(this.type, this.pokemonId, this.stat, this.stackCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
getArgs(): any[] {
|
getArgs(): any[] {
|
||||||
@ -733,12 +739,12 @@ export class PokemonBaseStatModifier extends PokemonHeldItemModifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shouldApply(args: any[]): boolean {
|
shouldApply(args: any[]): boolean {
|
||||||
return super.shouldApply(args) && args.length === 2 && args[1] instanceof Array;
|
return super.shouldApply(args) && args.length === 2 && Array.isArray(args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(args: any[]): boolean {
|
apply(args: any[]): boolean {
|
||||||
args[1][this.stat] = Math.min(Math.floor(args[1][this.stat] * (1 + this.getStackCount() * 0.1)), 999999);
|
const baseStats = args[1] as number[];
|
||||||
|
baseStats[this.stat] = Math.floor(baseStats[this.stat] * (1 + this.getStackCount() * 0.1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,9 +650,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
|||||||
this.lastLevel = pokemon.level;
|
this.lastLevel = pokemon.level;
|
||||||
}
|
}
|
||||||
|
|
||||||
const battleStats = pokemon.summonData
|
const battleStats = pokemon.getStatStages();
|
||||||
? pokemon.summonData.statStages // TODO: BattleStats
|
|
||||||
: this.battleStatOrder.map(() => 0);
|
|
||||||
const battleStatsStr = battleStats.join("");
|
const battleStatsStr = battleStats.join("");
|
||||||
|
|
||||||
if (this.lastBattleStats !== battleStatsStr) {
|
if (this.lastBattleStats !== battleStatsStr) {
|
||||||
|
@ -6,7 +6,7 @@ import { Command } from "./command-ui-handler";
|
|||||||
import MessageUiHandler from "./message-ui-handler";
|
import MessageUiHandler from "./message-ui-handler";
|
||||||
import { Mode } from "./ui";
|
import { Mode } from "./ui";
|
||||||
import * as Utils from "../utils";
|
import * as Utils from "../utils";
|
||||||
import { PokemonBaseStatModifier, PokemonFormChangeItemModifier, PokemonHeldItemModifier, SwitchEffectTransferModifier } from "../modifier/modifier";
|
import { BaseStatModifier, PokemonFormChangeItemModifier, PokemonHeldItemModifier, SwitchEffectTransferModifier } from "../modifier/modifier";
|
||||||
import { allMoves, ForceSwitchOutAttr } from "../data/move";
|
import { allMoves, ForceSwitchOutAttr } from "../data/move";
|
||||||
import { getGenderColor, getGenderSymbol } from "../data/gender";
|
import { getGenderColor, getGenderSymbol } from "../data/gender";
|
||||||
import { StatusEffect } from "../data/status-effect";
|
import { StatusEffect } from "../data/status-effect";
|
||||||
@ -996,8 +996,8 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER && this.transferQuantitiesMax[option] > 1) {
|
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER && this.transferQuantitiesMax[option] > 1) {
|
||||||
const itemModifier = itemModifiers[option];
|
const itemModifier = itemModifiers[option];
|
||||||
|
|
||||||
/** Not sure why getMaxHeldItemCount had an error, but it only checks the Pokemon parameter if the modifier is PokemonBaseStatModifier */
|
/** Not sure why getMaxHeldItemCount had an error, but it only checks the Pokemon parameter if the modifier is BaseStatModifier */
|
||||||
if (itemModifier === undefined || itemModifier instanceof PokemonBaseStatModifier) {
|
if (itemModifier === undefined || itemModifier instanceof BaseStatModifier) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user