[Refactor] Replace integer holder with number holder (#5350)

* Replace integer holder with number holder

* Remove duplicate NumberHolder

---------

Co-authored-by: Madmadness65 <59298170+Madmadness65@users.noreply.github.com>
This commit is contained in:
Sirz Benjie 2025-02-16 17:31:46 -06:00 committed by GitHub
parent 90d32b886c
commit 4361aa089b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 64 additions and 69 deletions

View File

@ -1212,7 +1212,7 @@ export default class BattleScene extends SceneBase {
}
getDoubleBattleChance(newWaveIndex: number, playerField: PlayerPokemon[]) {
const doubleChance = new Utils.IntegerHolder(newWaveIndex % 10 === 0 ? 32 : 8);
const doubleChance = new Utils.NumberHolder(newWaveIndex % 10 === 0 ? 32 : 8);
this.applyModifiers(DoubleBattleChanceBoosterModifier, true, doubleChance);
playerField.forEach(p => applyAbAttrs(DoubleBattleChanceAbAttr, p, null, false, doubleChance));
return Math.max(doubleChance.value, 1);
@ -2628,7 +2628,7 @@ export default class BattleScene extends SceneBase {
const args: unknown[] = [];
if (modifier instanceof PokemonHpRestoreModifier) {
if (!(modifier as PokemonHpRestoreModifier).fainted) {
const hpRestoreMultiplier = new Utils.IntegerHolder(1);
const hpRestoreMultiplier = new Utils.NumberHolder(1);
this.applyModifiers(HealingBoosterModifier, true, hpRestoreMultiplier);
args.push(hpRestoreMultiplier.value);
} else {

View File

@ -203,7 +203,7 @@ export default class Battle {
}
pickUpScatteredMoney(): void {
const moneyAmount = new Utils.IntegerHolder(globalScene.currentBattle.moneyScattered);
const moneyAmount = new Utils.NumberHolder(globalScene.currentBattle.moneyScattered);
globalScene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);
if (globalScene.arena.getTag(ArenaTagType.HAPPY_HOUR)) {

View File

@ -3115,7 +3115,7 @@ export class ChangeMovePriorityAbAttr extends AbAttr {
return false;
}
(args[1] as Utils.IntegerHolder).value += this.changeAmount;
(args[1] as Utils.NumberHolder).value += this.changeAmount;
return true;
}
}
@ -3957,7 +3957,7 @@ export class StatStageChangeMultiplierAbAttr extends AbAttr {
}
override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
(args[0] as Utils.IntegerHolder).value *= this.multiplier;
(args[0] as Utils.NumberHolder).value *= this.multiplier;
return true;
}
@ -4058,7 +4058,7 @@ export class HealFromBerryUseAbAttr extends AbAttr {
export class RunSuccessAbAttr extends AbAttr {
apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
(args[0] as Utils.IntegerHolder).value = 256;
(args[0] as Utils.NumberHolder).value = 256;
return true;
}
@ -4128,7 +4128,7 @@ export class ArenaTrapAbAttr extends CheckTrappedAbAttr {
export class MaxMultiHitAbAttr extends AbAttr {
apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
(args[0] as Utils.IntegerHolder).value = 0;
(args[0] as Utils.NumberHolder).value = 0;
return true;
}
@ -4259,7 +4259,7 @@ export class PostFaintHPDamageAbAttr extends PostFaintAbAttr {
export class RedirectMoveAbAttr extends AbAttr {
apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
if (this.canRedirect(args[0] as Moves)) {
const target = args[1] as Utils.IntegerHolder;
const target = args[1] as Utils.NumberHolder;
const newTarget = pokemon.getBattlerIndex();
if (target.value !== newTarget) {
target.value = newTarget;

View File

@ -349,23 +349,23 @@ export abstract class Challenge {
/**
* An apply function for AI_LEVEL challenges. Derived classes should alter this.
* @param level {@link Utils.IntegerHolder} The generated level.
* @param level {@link Utils.NumberHolder} The generated level.
* @param levelCap {@link Number} The current level cap.
* @param isTrainer {@link Boolean} Whether this is a trainer pokemon.
* @param isBoss {@link Boolean} Whether this is a non-trainer boss pokemon.
* @returns {@link boolean} Whether this function did anything.
*/
applyLevelChange(level: Utils.IntegerHolder, levelCap: number, isTrainer: boolean, isBoss: boolean): boolean {
applyLevelChange(level: Utils.NumberHolder, levelCap: number, isTrainer: boolean, isBoss: boolean): boolean {
return false;
}
/**
* An apply function for AI_MOVE_SLOTS challenges. Derived classes should alter this.
* @param pokemon {@link Pokemon} The pokemon that is being considered.
* @param moveSlots {@link Utils.IntegerHolder} The amount of move slots.
* @param moveSlots {@link Utils.NumberHolder} The amount of move slots.
* @returns {@link boolean} Whether this function did anything.
*/
applyMoveSlot(pokemon: Pokemon, moveSlots: Utils.IntegerHolder): boolean {
applyMoveSlot(pokemon: Pokemon, moveSlots: Utils.NumberHolder): boolean {
return false;
}
@ -393,10 +393,10 @@ export abstract class Challenge {
* @param pokemon {@link Pokemon} What pokemon would learn the move.
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param move {@link Moves} The move in question.
* @param level {@link Utils.IntegerHolder} The level threshold for access.
* @param level {@link Utils.NumberHolder} The level threshold for access.
* @returns {@link boolean} Whether this function did anything.
*/
applyMoveAccessLevel(pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, level: Utils.IntegerHolder): boolean {
applyMoveAccessLevel(pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, level: Utils.NumberHolder): boolean {
return false;
}
@ -405,10 +405,10 @@ export abstract class Challenge {
* @param pokemon {@link Pokemon} What pokemon would learn the move.
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param move {@link Moves} The move in question.
* @param weight {@link Utils.IntegerHolder} The base weight of the move
* @param weight {@link Utils.NumberHolder} The base weight of the move
* @returns {@link boolean} Whether this function did anything.
*/
applyMoveWeight(pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, level: Utils.IntegerHolder): boolean {
applyMoveWeight(pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, level: Utils.NumberHolder): boolean {
return false;
}
@ -913,22 +913,22 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
* Apply all challenges that modify what level AI are.
* @param gameMode {@link GameMode} The current gameMode
* @param challengeType {@link ChallengeType} ChallengeType.AI_LEVEL
* @param level {@link Utils.IntegerHolder} The generated level of the pokemon.
* @param level {@link Utils.NumberHolder} The generated level of the pokemon.
* @param levelCap {@link Number} The maximum level cap for the current wave.
* @param isTrainer {@link Boolean} Whether this is a trainer pokemon.
* @param isBoss {@link Boolean} Whether this is a non-trainer boss pokemon.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.AI_LEVEL, level: Utils.IntegerHolder, levelCap: number, isTrainer: boolean, isBoss: boolean): boolean;
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.AI_LEVEL, level: Utils.NumberHolder, levelCap: number, isTrainer: boolean, isBoss: boolean): boolean;
/**
* Apply all challenges that modify how many move slots the AI has.
* @param gameMode {@link GameMode} The current gameMode
* @param challengeType {@link ChallengeType} ChallengeType.AI_MOVE_SLOTS
* @param pokemon {@link Pokemon} The pokemon being considered.
* @param moveSlots {@link Utils.IntegerHolder} The amount of move slots.
* @param moveSlots {@link Utils.NumberHolder} The amount of move slots.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.AI_MOVE_SLOTS, pokemon: Pokemon, moveSlots: Utils.IntegerHolder): boolean;
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.AI_MOVE_SLOTS, pokemon: Pokemon, moveSlots: Utils.NumberHolder): boolean;
/**
* Apply all challenges that modify whether a pokemon has its passive.
* @param gameMode {@link GameMode} The current gameMode
@ -952,10 +952,10 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
* @param pokemon {@link Pokemon} What pokemon would learn the move.
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param move {@link Moves} The move in question.
* @param level {@link Utils.IntegerHolder} The level threshold for access.
* @param level {@link Utils.NumberHolder} The level threshold for access.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.MOVE_ACCESS, pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, level: Utils.IntegerHolder): boolean;
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.MOVE_ACCESS, pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, level: Utils.NumberHolder): boolean;
/**
* Apply all challenges that modify what weight a pokemon gives to move generation
* @param gameMode {@link GameMode} The current gameMode
@ -963,10 +963,10 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
* @param pokemon {@link Pokemon} What pokemon would learn the move.
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param move {@link Moves} The move in question.
* @param weight {@link Utils.IntegerHolder} The weight of the move.
* @param weight {@link Utils.NumberHolder} The weight of the move.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.MOVE_WEIGHT, pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, weight: Utils.IntegerHolder): boolean;
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.MOVE_WEIGHT, pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, weight: Utils.NumberHolder): boolean;
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.FLIP_STAT, pokemon: Pokemon, baseStats: number[]): boolean;

View File

@ -908,7 +908,7 @@ export class AttackMove extends Move {
attackScore = Math.pow(effectiveness - 1, 2) * effectiveness < 1 ? -2 : 2;
if (attackScore) {
if (this.category === MoveCategory.PHYSICAL) {
const atk = new Utils.IntegerHolder(user.getEffectiveStat(Stat.ATK, target));
const atk = new Utils.NumberHolder(user.getEffectiveStat(Stat.ATK, target));
applyMoveAttrs(VariableAtkAttr, user, target, move, atk);
if (atk.value > user.getEffectiveStat(Stat.SPATK, target)) {
const statRatio = user.getEffectiveStat(Stat.SPATK, target) / atk.value;
@ -919,7 +919,7 @@ export class AttackMove extends Move {
}
}
} else {
const spAtk = new Utils.IntegerHolder(user.getEffectiveStat(Stat.SPATK, target));
const spAtk = new Utils.NumberHolder(user.getEffectiveStat(Stat.SPATK, target));
applyMoveAttrs(VariableAtkAttr, user, target, move, spAtk);
if (spAtk.value > user.getEffectiveStat(Stat.ATK, target)) {
const statRatio = user.getEffectiveStat(Stat.ATK, target) / spAtk.value;
@ -1337,7 +1337,7 @@ export class IgnoreOpponentStatStagesAttr extends MoveAttr {
export class HighCritAttr extends MoveAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
(args[0] as Utils.IntegerHolder).value++;
(args[0] as Utils.NumberHolder).value++;
return true;
}
@ -1369,7 +1369,7 @@ export class FixedDamageAttr extends MoveAttr {
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
(args[0] as Utils.IntegerHolder).value = this.getDamage(user, target, move);
(args[0] as Utils.NumberHolder).value = this.getDamage(user, target, move);
return true;
}
@ -1385,7 +1385,7 @@ export class UserHpDamageAttr extends FixedDamageAttr {
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
(args[0] as Utils.IntegerHolder).value = user.hp;
(args[0] as Utils.NumberHolder).value = user.hp;
return true;
}
@ -1437,7 +1437,7 @@ export class MatchHpAttr extends FixedDamageAttr {
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
(args[0] as Utils.IntegerHolder).value = target.hp - user.hp;
(args[0] as Utils.NumberHolder).value = target.hp - user.hp;
return true;
}
@ -1467,7 +1467,7 @@ export class CounterDamageAttr extends FixedDamageAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const damage = user.turnData.attacksReceived.filter(ar => this.moveFilter(allMoves[ar.move])).reduce((total: number, ar: AttackMoveResult) => total + ar.damage, 0);
(args[0] as Utils.IntegerHolder).value = Utils.toDmgValue(damage * this.multiplier);
(args[0] as Utils.NumberHolder).value = Utils.toDmgValue(damage * this.multiplier);
return true;
}
@ -1499,7 +1499,7 @@ export class RandomLevelDamageAttr extends FixedDamageAttr {
export class ModifiedDamageAttr extends MoveAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const initialDamage = args[0] as Utils.IntegerHolder;
const initialDamage = args[0] as Utils.NumberHolder;
initialDamage.value = this.getModifiedDamage(user, target, move, initialDamage.value);
return true;
@ -2164,7 +2164,7 @@ export class IncrementMovePriorityAttr extends MoveAttr {
* @param user {@linkcode Pokemon} using this move
* @param target {@linkcode Pokemon} target of this move
* @param move {@linkcode Move} being used
* @param args [0] {@linkcode Utils.IntegerHolder} for move priority.
* @param args [0] {@linkcode Utils.NumberHolder} for move priority.
* @returns true if function succeeds
*/
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
@ -2172,7 +2172,7 @@ export class IncrementMovePriorityAttr extends MoveAttr {
return false;
}
(args[0] as Utils.IntegerHolder).value += this.increaseAmount;
(args[0] as Utils.NumberHolder).value += this.increaseAmount;
return true;
}
}
@ -2210,7 +2210,7 @@ export class MultiHitAttr extends MoveAttr {
* @param user {@linkcode Pokemon} that used the attack
* @param target {@linkcode Pokemon} targeted by the attack
* @param move {@linkcode Move} being used
* @param args [0] {@linkcode Utils.IntegerHolder} storing the hit count of the attack
* @param args [0] {@linkcode Utils.NumberHolder} storing the hit count of the attack
* @returns True
*/
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
@ -2277,7 +2277,7 @@ export class ChangeMultiHitTypeAttr extends MoveAttr {
export class WaterShurikenMultiHitTypeAttr extends ChangeMultiHitTypeAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (user.species.speciesId === Species.GRENINJA && user.hasAbility(Abilities.BATTLE_BOND) && user.formIndex === 2) {
(args[0] as Utils.IntegerHolder).value = MultiHitType._3;
(args[0] as Utils.NumberHolder).value = MultiHitType._3;
return true;
}
return false;
@ -4118,7 +4118,7 @@ export class PresentPowerAttr extends VariablePowerAttr {
export class WaterShurikenPowerAttr extends VariablePowerAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (user.species.speciesId === Species.GRENINJA && user.hasAbility(Abilities.BATTLE_BOND) && user.formIndex === 2) {
(args[0] as Utils.IntegerHolder).value = 20;
(args[0] as Utils.NumberHolder).value = 20;
return true;
}
return false;
@ -4140,7 +4140,7 @@ export class SpitUpPowerAttr extends VariablePowerAttr {
const stockpilingTag = user.getTag(StockpilingTag);
if (stockpilingTag && stockpilingTag.stockpiledCount > 0) {
const power = args[0] as Utils.IntegerHolder;
const power = args[0] as Utils.NumberHolder;
power.value = this.multiplier * stockpilingTag.stockpiledCount;
return true;
}
@ -4449,7 +4449,7 @@ export class VariableAtkAttr extends MoveAttr {
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
//const atk = args[0] as Utils.IntegerHolder;
//const atk = args[0] as Utils.NumberHolder;
return false;
}
}
@ -4459,7 +4459,7 @@ export class TargetAtkUserAtkAttr extends VariableAtkAttr {
super();
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
(args[0] as Utils.IntegerHolder).value = target.getEffectiveStat(Stat.ATK, target);
(args[0] as Utils.NumberHolder).value = target.getEffectiveStat(Stat.ATK, target);
return true;
}
}
@ -4470,7 +4470,7 @@ export class DefAtkAttr extends VariableAtkAttr {
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
(args[0] as Utils.IntegerHolder).value = user.getEffectiveStat(Stat.DEF, target);
(args[0] as Utils.NumberHolder).value = user.getEffectiveStat(Stat.DEF, target);
return true;
}
}
@ -4481,7 +4481,7 @@ export class VariableDefAttr extends MoveAttr {
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
//const def = args[0] as Utils.IntegerHolder;
//const def = args[0] as Utils.NumberHolder;
return false;
}
}
@ -4492,7 +4492,7 @@ export class DefDefAttr extends VariableDefAttr {
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
(args[0] as Utils.IntegerHolder).value = target.getEffectiveStat(Stat.DEF, user);
(args[0] as Utils.NumberHolder).value = target.getEffectiveStat(Stat.DEF, user);
return true;
}
}

View File

@ -10,7 +10,7 @@ import { HiddenAbilityRateBoosterModifier, IvScannerModifier } from "#app/modifi
import type { EnemyPokemon } from "#app/field/pokemon";
import { PokeballType } from "#enums/pokeball";
import { PlayerGender } from "#enums/player-gender";
import { IntegerHolder, randSeedInt } from "#app/utils";
import { NumberHolder, randSeedInt } from "#app/utils";
import type PokemonSpecies from "#app/data/pokemon-species";
import { getPokemonSpecies } from "#app/data/pokemon-species";
import { MoneyRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
@ -279,7 +279,7 @@ async function summonSafariPokemon() {
if (pokemon.species.abilityHidden) {
const hiddenIndex = pokemon.species.ability2 ? 2 : 1;
if (pokemon.abilityIndex < hiddenIndex) {
const hiddenAbilityChance = new IntegerHolder(256);
const hiddenAbilityChance = new NumberHolder(256);
globalScene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance);
const hasHiddenAbility = !randSeedInt(hiddenAbilityChance.value);

View File

@ -12,7 +12,7 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode
import type { PlayerPokemon } from "#app/field/pokemon";
import type Pokemon from "#app/field/pokemon";
import { PokemonMove } from "#app/field/pokemon";
import { IntegerHolder, isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils";
import { NumberHolder, isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils";
import type PokemonSpecies from "#app/data/pokemon-species";
import { allSpecies, getPokemonSpecies } from "#app/data/pokemon-species";
import type { PokemonHeldItemModifier } from "#app/modifier/modifier";
@ -452,7 +452,7 @@ async function postProcessTransformedPokemon(previousPokemon: PlayerPokemon, new
if (newPokemon.species.abilityHidden) {
const hiddenIndex = newPokemon.species.ability2 ? 2 : 1;
if (newPokemon.abilityIndex < hiddenIndex) {
const hiddenAbilityChance = new IntegerHolder(256);
const hiddenAbilityChance = new NumberHolder(256);
globalScene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance);
const hasHiddenAbility = !randSeedInt(hiddenAbilityChance.value);

View File

@ -204,7 +204,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
throw `Cannot create a player Pokemon for species '${species.getName(formIndex)}'`;
}
const hiddenAbilityChance = new Utils.IntegerHolder(BASE_HIDDEN_ABILITY_CHANCE);
const hiddenAbilityChance = new Utils.NumberHolder(BASE_HIDDEN_ABILITY_CHANCE);
if (!this.hasTrainer()) {
globalScene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance);
}
@ -960,7 +960,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* @returns the final critical-hit stage value
*/
getCritStage(source: Pokemon, move: Move): number {
const critStage = new Utils.IntegerHolder(0);
const critStage = new Utils.NumberHolder(0);
applyMoveAttrs(HighCritAttr, source, this, move, critStage);
globalScene.applyModifiers(CritBoosterModifier, source.isPlayer(), source, critStage);
globalScene.applyModifiers(TempCritBoosterModifier, source.isPlayer(), critStage);
@ -1074,7 +1074,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
const baseStats = this.calculateBaseStats();
// Using base stats, calculate and store stats one by one
for (const s of PERMANENT_STATS) {
const statHolder = new Utils.IntegerHolder(Math.floor(((2 * baseStats[s] + this.ivs[s]) * this.level) * 0.01));
const statHolder = new Utils.NumberHolder(Math.floor(((2 * baseStats[s] + this.ivs[s]) * this.level) * 0.01));
if (s === Stat.HP) {
statHolder.value = statHolder.value + this.level + 10;
globalScene.applyModifier(PokemonIncrementingStatModifier, this.isPlayer(), this, s, statHolder);
@ -2567,7 +2567,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* @return the stat stage multiplier to be used for effective stat calculation
*/
getStatStageMultiplier(stat: EffectiveStat, opponent?: Pokemon, move?: Move, ignoreOppAbility: boolean = false, isCritical: boolean = false, simulated: boolean = true, ignoreHeldItems: boolean = false): number {
const statStage = new Utils.IntegerHolder(this.getStatStage(stat));
const statStage = new Utils.NumberHolder(this.getStatStage(stat));
const ignoreStatStage = new Utils.BooleanHolder(false);
if (opponent) {
@ -2617,8 +2617,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return 1;
}
const userAccStage = new Utils.IntegerHolder(this.getStatStage(Stat.ACC));
const targetEvaStage = new Utils.IntegerHolder(target.getStatStage(Stat.EVA));
const userAccStage = new Utils.NumberHolder(this.getStatStage(Stat.ACC));
const targetEvaStage = new Utils.NumberHolder(target.getStatStage(Stat.EVA));
const ignoreAccStatStage = new Utils.BooleanHolder(false);
const ignoreEvaStatStage = new Utils.BooleanHolder(false);
@ -2797,7 +2797,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
/** Doubles damage if this Pokemon's last move was Glaive Rush */
const glaiveRushMultiplier = new Utils.IntegerHolder(1);
const glaiveRushMultiplier = new Utils.NumberHolder(1);
if (this.getTag(BattlerTagType.RECEIVE_DOUBLE_DAMAGE)) {
glaiveRushMultiplier.value = 2;
}

View File

@ -1186,11 +1186,11 @@ class FormChangeItemModifierTypeGenerator extends ModifierTypeGenerator {
if (p.species.speciesId === Species.NECROZMA) {
// technically we could use a simplified version and check for formChanges.length > 3, but in case any code changes later, this might break...
let foundULTRA_Z = false,
foundN_LUNA = false,
foundN_SOLAR = false;
formChangeItemTriggers.forEach((fc, _i) => {
console.log("Checking ", fc.item);
switch (fc.item) {
case FormChangeItem.ULTRANECROZIUM_Z:
foundULTRA_Z = true;
@ -1206,6 +1206,8 @@ class FormChangeItemModifierTypeGenerator extends ModifierTypeGenerator {
if (foundULTRA_Z && foundN_LUNA && foundN_SOLAR) {
// all three items are present -> user hasn't acquired any of the N_*ARIZERs -> block ULTRANECROZIUM_Z acquisition.
formChangeItemTriggers = formChangeItemTriggers.filter(fc => fc.item !== FormChangeItem.ULTRANECROZIUM_Z);
} else {
console.log("DID NOT FIND ");
}
}
return formChangeItemTriggers;

View File

@ -15,7 +15,7 @@ export class MoneyRewardPhase extends BattlePhase {
}
start() {
const moneyAmount = new Utils.IntegerHolder(globalScene.getWaveMoneyAmount(this.moneyMultiplier));
const moneyAmount = new Utils.NumberHolder(globalScene.getWaveMoneyAmount(this.moneyMultiplier));
globalScene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);

View File

@ -62,7 +62,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
this.message = null;
return super.end();
} else if (healOrDamage) {
const hpRestoreMultiplier = new Utils.IntegerHolder(1);
const hpRestoreMultiplier = new Utils.NumberHolder(1);
if (!this.revive) {
globalScene.applyModifiers(HealingBoosterModifier, this.player, hpRestoreMultiplier);
}

View File

@ -45,7 +45,7 @@ export class SelectModifierPhase extends BattlePhase {
if (!this.isCopy) {
regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount);
}
const modifierCount = new Utils.IntegerHolder(3);
const modifierCount = new Utils.NumberHolder(3);
if (this.isPlayer()) {
globalScene.applyModifiers(ExtraModifierModifier, true, modifierCount);
globalScene.applyModifiers(TempExtraModifierModifier, true, modifierCount);

View File

@ -1,6 +1,6 @@
import { TurnHeldItemTransferModifier } from "#app/modifier/modifier";
import { Achv, AchvTier, DamageAchv, HealAchv, LevelAchv, ModifierAchv, MoneyAchv, RibbonAchv, achvs } from "#app/system/achv";
import { IntegerHolder, NumberHolder } from "#app/utils";
import { NumberHolder } from "#app/utils";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
@ -174,7 +174,7 @@ describe("LevelAchv", () => {
it("should validate the achievement based on the level", () => {
const levelAchv = new LevelAchv("", "Test Level Achievement", 100, "level_icon", 10);
const integerHolder = new IntegerHolder(50);
const integerHolder = new NumberHolder(50);
expect(levelAchv.validate([ integerHolder ])).toBe(false);

View File

@ -14,7 +14,7 @@ import * as Utils from "./../utils";
import Overrides from "#app/overrides";
import i18next from "i18next";
import { ShopCursorTarget } from "#app/enums/shop-cursor-target";
import { IntegerHolder } from "./../utils";
import { NumberHolder } from "./../utils";
import Phaser from "phaser";
import type { PokeballType } from "#enums/pokeball";
@ -191,7 +191,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
const typeOptions = args[1] as ModifierTypeOption[];
const removeHealShop = globalScene.gameMode.hasNoShop;
const baseShopCost = new IntegerHolder(globalScene.getWaveMoneyAmount(1));
const baseShopCost = new NumberHolder(globalScene.getWaveMoneyAmount(1));
globalScene.applyModifier(HealShopCostModifier, true, baseShopCost);
const shopTypeOptions = !removeHealShop
? getPlayerShopModifierTypeOptionsForWave(globalScene.currentBattle.waveIndex, baseShopCost.value)

View File

@ -342,13 +342,6 @@ export class NumberHolder {
}
}
/** @deprecated Use {@linkcode NumberHolder} */
export class IntegerHolder extends NumberHolder {
constructor(value: number) {
super(value);
}
}
export class FixedInt {
public readonly value: number;