mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 17:12:44 +02:00
Fixed issus es and stufff
This commit is contained in:
parent
be7ba4f5dd
commit
c7b7579f60
@ -311,7 +311,7 @@ export default class BattleScene extends SceneBase {
|
||||
/** Session save data that pertains to Mystery Encounters */
|
||||
public mysteryEncounterSaveData: MysteryEncounterSaveData = new MysteryEncounterSaveData();
|
||||
/** If the previous wave was a MysteryEncounter, tracks the object with this variable. Mostly used for visual object cleanup */
|
||||
public lastMysteryEncounter?: MysteryEncounter;
|
||||
public lastMysteryEncounter: MysteryEncounter | undefined = undefined;
|
||||
/** Combined Biome and Wave count text */
|
||||
private biomeWaveText: Phaser.GameObjects.Text;
|
||||
private moneyText: Phaser.GameObjects.Text;
|
||||
|
@ -90,9 +90,9 @@ export default class Battle {
|
||||
public playerFaintsHistory: FaintLogEntry[] = [];
|
||||
public enemyFaintsHistory: FaintLogEntry[] = [];
|
||||
|
||||
public mysteryEncounterType?: MysteryEncounterType;
|
||||
public mysteryEncounterType?: MysteryEncounterType | undefined;
|
||||
/** If the current battle is a Mystery Encounter, this will always be defined */
|
||||
public mysteryEncounter?: MysteryEncounter;
|
||||
public mysteryEncounter?: MysteryEncounter | undefined;
|
||||
|
||||
private rngCounter = 0;
|
||||
|
||||
|
@ -1557,14 +1557,11 @@ export class PostDefendPerishSongAbAttr extends PostDefendAbAttr {
|
||||
}
|
||||
|
||||
export class PostDefendWeatherChangeAbAttr extends PostDefendAbAttr {
|
||||
private weatherType: WeatherType;
|
||||
protected condition?: PokemonDefendCondition;
|
||||
|
||||
constructor(weatherType: WeatherType, condition?: PokemonDefendCondition) {
|
||||
constructor(
|
||||
private weatherType: WeatherType,
|
||||
protected condition?: PokemonDefendCondition,
|
||||
) {
|
||||
super();
|
||||
|
||||
this.weatherType = weatherType;
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
override canApplyPostDefend(
|
||||
@ -2555,13 +2552,10 @@ export class GorillaTacticsAbAttr extends ExecutedMoveAbAttr {
|
||||
}
|
||||
|
||||
export class PostAttackStealHeldItemAbAttr extends PostAttackAbAttr {
|
||||
private stealCondition: PokemonAttackCondition | null;
|
||||
private stolenItem?: PokemonHeldItemModifier;
|
||||
|
||||
constructor(stealCondition?: PokemonAttackCondition) {
|
||||
constructor(private stealCondition?: PokemonAttackCondition) {
|
||||
super();
|
||||
|
||||
this.stealCondition = stealCondition ?? null;
|
||||
}
|
||||
|
||||
override canApplyPostAttack(
|
||||
@ -2588,7 +2582,6 @@ export class PostAttackStealHeldItemAbAttr extends PostAttackAbAttr {
|
||||
}
|
||||
}
|
||||
}
|
||||
this.stolenItem = undefined;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2614,7 +2607,6 @@ export class PostAttackStealHeldItemAbAttr extends PostAttackAbAttr {
|
||||
}),
|
||||
);
|
||||
}
|
||||
this.stolenItem = undefined;
|
||||
}
|
||||
|
||||
getTargetHeldItems(target: Pokemon): PokemonHeldItemModifier[] {
|
||||
@ -2742,13 +2734,10 @@ export class PostAttackApplyBattlerTagAbAttr extends PostAttackAbAttr {
|
||||
}
|
||||
|
||||
export class PostDefendStealHeldItemAbAttr extends PostDefendAbAttr {
|
||||
private condition?: PokemonDefendCondition;
|
||||
private stolenItem?: PokemonHeldItemModifier;
|
||||
|
||||
constructor(condition?: PokemonDefendCondition) {
|
||||
constructor(private condition?: PokemonDefendCondition) {
|
||||
super();
|
||||
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
override canApplyPostDefend(
|
||||
@ -2794,7 +2783,6 @@ export class PostDefendStealHeldItemAbAttr extends PostDefendAbAttr {
|
||||
}),
|
||||
);
|
||||
}
|
||||
this.stolenItem = undefined;
|
||||
}
|
||||
|
||||
getTargetHeldItems(target: Pokemon): PokemonHeldItemModifier[] {
|
||||
@ -3172,18 +3160,16 @@ export class PostSummonRemoveArenaTagAbAttr extends PostSummonAbAttr {
|
||||
* Generic class to add an arena tag upon switching in
|
||||
*/
|
||||
export class PostSummonAddArenaTagAbAttr extends PostSummonAbAttr {
|
||||
private readonly tagType: ArenaTagType;
|
||||
private readonly turnCount: number;
|
||||
private readonly side?: ArenaTagSide;
|
||||
private readonly quiet?: boolean;
|
||||
private sourceId: number;
|
||||
|
||||
constructor(showAbility: boolean, tagType: ArenaTagType, turnCount: number, side?: ArenaTagSide, quiet?: boolean) {
|
||||
constructor(
|
||||
showAbility: boolean,
|
||||
private readonly tagType: ArenaTagType,
|
||||
private readonly turnCount: number,
|
||||
private readonly side?: ArenaTagSide,
|
||||
private readonly quiet?: boolean,
|
||||
) {
|
||||
super(showAbility);
|
||||
this.tagType = tagType;
|
||||
this.turnCount = turnCount;
|
||||
this.side = side;
|
||||
this.quiet = quiet;
|
||||
}
|
||||
|
||||
public override applyPostSummon(pokemon: Pokemon, _passive: boolean, simulated: boolean, _args: any[]): void {
|
||||
@ -4132,7 +4118,7 @@ export class ReflectStatStageChangeAbAttr extends PreStatStageChangeAbAttr {
|
||||
*/
|
||||
export class ProtectStatAbAttr extends PreStatStageChangeAbAttr {
|
||||
/** {@linkcode BattleStat} to protect or `undefined` if **all** {@linkcode BattleStat} are protected */
|
||||
private protectedStat?: BattleStat;
|
||||
private protectedStat: BattleStat | undefined = undefined;
|
||||
|
||||
constructor(protectedStat?: BattleStat) {
|
||||
super();
|
||||
@ -6232,7 +6218,6 @@ export class PostBattleLootAbAttr extends PostBattleAbAttr {
|
||||
}),
|
||||
);
|
||||
}
|
||||
this.randItem = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6789,7 +6774,6 @@ export class PostSummonStatStageChangeOnArenaAbAttr extends PostSummonStatStageC
|
||||
export class FormBlockDamageAbAttr extends ReceivedMoveDamageMultiplierAbAttr {
|
||||
private multiplier: number;
|
||||
private tagType: BattlerTagType;
|
||||
private recoilDamageFunc?: (pokemon: Pokemon) => number;
|
||||
private triggerMessageFunc: (pokemon: Pokemon, abilityName: string) => string;
|
||||
|
||||
constructor(
|
||||
@ -6797,13 +6781,12 @@ export class FormBlockDamageAbAttr extends ReceivedMoveDamageMultiplierAbAttr {
|
||||
multiplier: number,
|
||||
tagType: BattlerTagType,
|
||||
triggerMessageFunc: (pokemon: Pokemon, abilityName: string) => string,
|
||||
recoilDamageFunc?: (pokemon: Pokemon) => number,
|
||||
private recoilDamageFunc?: (pokemon: Pokemon) => number,
|
||||
) {
|
||||
super(condition, multiplier);
|
||||
|
||||
this.multiplier = multiplier;
|
||||
this.tagType = tagType;
|
||||
this.recoilDamageFunc = recoilDamageFunc;
|
||||
this.triggerMessageFunc = triggerMessageFunc;
|
||||
}
|
||||
|
||||
|
@ -143,15 +143,9 @@ export class FusionSpeciesFormEvolution extends SpeciesFormEvolution {
|
||||
}
|
||||
|
||||
export class SpeciesEvolutionCondition {
|
||||
public predicate: EvolutionConditionPredicate;
|
||||
public enforceFunc?: EvolutionConditionEnforceFunc;
|
||||
public description: string;
|
||||
public description = "";
|
||||
|
||||
constructor(predicate: EvolutionConditionPredicate, enforceFunc?: EvolutionConditionEnforceFunc) {
|
||||
this.predicate = predicate;
|
||||
this.enforceFunc = enforceFunc;
|
||||
this.description = "";
|
||||
}
|
||||
constructor(public predicate: EvolutionConditionPredicate, public enforceFunc?: EvolutionConditionEnforceFunc) {}
|
||||
}
|
||||
|
||||
class GenderEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
|
@ -45,7 +45,6 @@ export class BattlerTag {
|
||||
public lapseTypes: BattlerTagLapseType[];
|
||||
public turnCount: number;
|
||||
public sourceMove: MoveId;
|
||||
public sourceId?: number;
|
||||
public isBatonPassable: boolean;
|
||||
|
||||
constructor(
|
||||
@ -53,14 +52,13 @@ export class BattlerTag {
|
||||
lapseType: BattlerTagLapseType | BattlerTagLapseType[],
|
||||
turnCount: number,
|
||||
sourceMove?: MoveId,
|
||||
sourceId?: number,
|
||||
public sourceId?: number,
|
||||
isBatonPassable = false,
|
||||
) {
|
||||
this.tagType = tagType;
|
||||
this.lapseTypes = Array.isArray(lapseType) ? lapseType : [lapseType];
|
||||
this.turnCount = turnCount;
|
||||
this.sourceMove = sourceMove!; // TODO: is this bang correct?
|
||||
this.sourceId = sourceId;
|
||||
this.isBatonPassable = isBatonPassable;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ export class Egg {
|
||||
|
||||
private _overrideHiddenAbility: boolean;
|
||||
|
||||
private _eggDescriptor?: string;
|
||||
private _eggDescriptor: string | undefined;
|
||||
|
||||
////
|
||||
// #endregion
|
||||
|
@ -152,10 +152,10 @@ export default abstract class Move implements Localizable {
|
||||
|
||||
/**
|
||||
* Check if the move is of the given subclass without requiring `instanceof`.
|
||||
*
|
||||
*
|
||||
* ⚠️ Does _not_ work for {@linkcode ChargingAttackMove} and {@linkcode ChargingSelfStatusMove} subclasses. For those,
|
||||
* use {@linkcode isChargingMove} instead.
|
||||
*
|
||||
*
|
||||
* @param moveKind - The string name of the move to check against
|
||||
* @returns Whether this move is of the provided type.
|
||||
*/
|
||||
@ -662,7 +662,7 @@ export default abstract class Move implements Localizable {
|
||||
doesFlagEffectApply({ flag, user, target, isFollowUp = false }: {
|
||||
flag: MoveFlags;
|
||||
user: Pokemon;
|
||||
target?: Pokemon;
|
||||
target?: Pokemon | undefined;
|
||||
isFollowUp?: boolean;
|
||||
}): boolean {
|
||||
// special cases below, eg: if the move flag is MAKES_CONTACT, and the user pokemon has an ability that ignores contact (like "Long Reach"), then overrides and move does not make contact
|
||||
@ -1253,15 +1253,14 @@ interface MoveEffectAttrOptions {
|
||||
* @see {@linkcode apply}
|
||||
*/
|
||||
export class MoveEffectAttr extends MoveAttr {
|
||||
/**
|
||||
* A container for this attribute's optional parameters
|
||||
* @see {@linkcode MoveEffectAttrOptions} for supported params.
|
||||
*/
|
||||
protected options?: MoveEffectAttrOptions;
|
||||
|
||||
constructor(selfTarget?: boolean, options?: MoveEffectAttrOptions) {
|
||||
constructor(
|
||||
selfTarget?: boolean,
|
||||
/**
|
||||
* A container for this attribute's optional parameters
|
||||
* @see {@linkcode MoveEffectAttrOptions} for supported params.
|
||||
*/
|
||||
protected options?: MoveEffectAttrOptions) {
|
||||
super(selfTarget);
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1451,7 +1450,7 @@ export class PreMoveMessageAttr extends MoveAttr {
|
||||
* @extends MoveAttr
|
||||
*/
|
||||
export class PreUseInterruptAttr extends MoveAttr {
|
||||
protected message?: string | ((user: Pokemon, target: Pokemon, move: Move) => string);
|
||||
protected message: string | ((user: Pokemon, target: Pokemon, move: Move) => string);
|
||||
protected overridesFailedMessage: boolean;
|
||||
protected conditionFunc: MoveConditionFunc;
|
||||
|
||||
@ -1459,10 +1458,10 @@ export class PreUseInterruptAttr extends MoveAttr {
|
||||
* Create a new MoveInterruptedMessageAttr.
|
||||
* @param message The message to display when the move is interrupted, or a function that formats the message based on the user, target, and move.
|
||||
*/
|
||||
constructor(message?: string | ((user: Pokemon, target: Pokemon, move: Move) => string), conditionFunc?: MoveConditionFunc) {
|
||||
constructor(message: string | ((user: Pokemon, target: Pokemon, move: Move) => string), conditionFunc: MoveConditionFunc) {
|
||||
super();
|
||||
this.message = message;
|
||||
this.conditionFunc = conditionFunc ?? (() => true);
|
||||
this.conditionFunc = conditionFunc;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2207,15 +2206,16 @@ export class SandHealAttr extends WeatherHealAttr {
|
||||
* @extends HealAttr
|
||||
* @see {@linkcode apply}
|
||||
*/
|
||||
// TODO: Convert other healing attributes (WeatherHealAttr, etc) to base off of this class
|
||||
export class BoostHealAttr extends HealAttr {
|
||||
/** Healing received when {@linkcode condition} is false */
|
||||
private normalHealRatio: number;
|
||||
/** Healing received when {@linkcode condition} is true */
|
||||
private boostedHealRatio: number;
|
||||
/** The lambda expression to check against when boosting the healing value */
|
||||
private condition?: MoveConditionFunc;
|
||||
private condition: MoveConditionFunc;
|
||||
|
||||
constructor(normalHealRatio: number = 0.5, boostedHealRatio: number = 2 / 3, showAnim?: boolean, selfTarget?: boolean, condition?: MoveConditionFunc) {
|
||||
constructor(normalHealRatio: number, boostedHealRatio: number, condition: MoveConditionFunc, showAnim?: boolean, selfTarget?: boolean, ) {
|
||||
super(normalHealRatio, showAnim, selfTarget);
|
||||
this.normalHealRatio = normalHealRatio;
|
||||
this.boostedHealRatio = boostedHealRatio;
|
||||
@ -2229,8 +2229,8 @@ export class BoostHealAttr extends HealAttr {
|
||||
* @param args N/A
|
||||
* @returns true if the move was successful
|
||||
*/
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
const healRatio: number = (this.condition ? this.condition(user, target, move) : false) ? this.boostedHealRatio : this.normalHealRatio;
|
||||
override apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
const healRatio = this.condition(user, target, move) ? this.boostedHealRatio : this.normalHealRatio;
|
||||
this.addHealPhase(target, healRatio);
|
||||
return true;
|
||||
}
|
||||
@ -2516,7 +2516,7 @@ export class WaterShurikenMultiHitTypeAttr extends ChangeMultiHitTypeAttr {
|
||||
|
||||
export class StatusEffectAttr extends MoveEffectAttr {
|
||||
public effect: StatusEffect;
|
||||
public turnsRemaining?: number;
|
||||
public turnsRemaining?: number | undefined;
|
||||
public overrideStatus: boolean = false;
|
||||
|
||||
constructor(effect: StatusEffect, selfTarget?: boolean, turnsRemaining?: number, overrideStatus: boolean = false) {
|
||||
@ -3240,19 +3240,18 @@ interface StatStageChangeAttrOptions extends MoveEffectAttrOptions {
|
||||
* @see {@linkcode apply}
|
||||
*/
|
||||
export class StatStageChangeAttr extends MoveEffectAttr {
|
||||
public stats: BattleStat[];
|
||||
public stages: number;
|
||||
/**
|
||||
* Container for optional parameters to this attribute.
|
||||
* @see {@linkcode StatStageChangeAttrOptions} for available optional params
|
||||
*/
|
||||
protected override options?: StatStageChangeAttrOptions;
|
||||
|
||||
constructor(stats: BattleStat[], stages: number, selfTarget?: boolean, options?: StatStageChangeAttrOptions) {
|
||||
constructor(
|
||||
public stats: BattleStat[],
|
||||
public stages: number,
|
||||
selfTarget?: boolean,
|
||||
/**
|
||||
* Container for optional parameters to this attribute.
|
||||
* @see {@linkcode StatStageChangeAttrOptions} for available optional params
|
||||
*/
|
||||
protected override options?: StatStageChangeAttrOptions) {
|
||||
super(selfTarget, options);
|
||||
this.stats = stats;
|
||||
this.stages = stages;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3484,16 +3483,16 @@ export class SecretPowerAttr extends MoveEffectAttr {
|
||||
export class PostVictoryStatStageChangeAttr extends MoveAttr {
|
||||
private stats: BattleStat[];
|
||||
private stages: number;
|
||||
private condition?: MoveConditionFunc;
|
||||
private showMessage: boolean;
|
||||
|
||||
constructor(stats: BattleStat[], stages: number, selfTarget?: boolean, condition?: MoveConditionFunc, showMessage: boolean = true, firstHitOnly: boolean = false) {
|
||||
constructor(stats: BattleStat[], stages: number, selfTarget?: boolean, private condition?: MoveConditionFunc, showMessage: boolean = true, firstHitOnly: boolean = false) {
|
||||
super();
|
||||
this.stats = stats;
|
||||
this.stages = stages;
|
||||
this.condition = condition;
|
||||
this.showMessage = showMessage;
|
||||
}
|
||||
|
||||
applyPostVictory(user: Pokemon, target: Pokemon, move: Move): void {
|
||||
if (this.condition && !this.condition(user, target, move)) {
|
||||
return;
|
||||
@ -10484,7 +10483,7 @@ export function initMoves() {
|
||||
.attr(StatStageChangeAttr, [ Stat.SPD ], -1, true)
|
||||
.punchingMove(),
|
||||
new StatusMove(MoveId.FLORAL_HEALING, PokemonType.FAIRY, -1, 10, -1, 0, 7)
|
||||
.attr(BoostHealAttr, 0.5, 2 / 3, true, false, (user, target, move) => globalScene.arena.terrain?.terrainType === TerrainType.GRASSY)
|
||||
.attr(BoostHealAttr, 0.5, 2 / 3, (user, target, move) => globalScene.arena.terrain?.terrainType === TerrainType.GRASSY, true, false)
|
||||
.triageMove()
|
||||
.reflectable(),
|
||||
new AttackMove(MoveId.HIGH_HORSEPOWER, PokemonType.GROUND, MoveCategory.PHYSICAL, 95, 95, 10, -1, 0, 7),
|
||||
|
@ -23,18 +23,21 @@ export class PokemonMove {
|
||||
public ppUp: number;
|
||||
public virtual: boolean;
|
||||
|
||||
/**
|
||||
* If defined and nonzero, overrides the maximum PP of the move (e.g., due to move being copied by Transform).
|
||||
* This also nullifies all effects of `ppUp`.
|
||||
*/
|
||||
public maxPpOverride?: number;
|
||||
|
||||
constructor(moveId: MoveId, ppUsed = 0, ppUp = 0, virtual = false, maxPpOverride?: number) {
|
||||
constructor(
|
||||
moveId: MoveId,
|
||||
ppUsed = 0,
|
||||
ppUp = 0,
|
||||
virtual = false,
|
||||
/**
|
||||
* If defined and nonzero, overrides the maximum PP of the move (e.g., due to move being copied by Transform).
|
||||
* This also nullifies all effects of `ppUp`.
|
||||
*/
|
||||
public maxPpOverride = 0,
|
||||
) {
|
||||
this.moveId = moveId;
|
||||
this.ppUsed = ppUsed;
|
||||
this.ppUp = ppUp;
|
||||
this.virtual = virtual;
|
||||
this.maxPpOverride = maxPpOverride;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ export default class MysteryEncounterOption implements IMysteryEncounterOption {
|
||||
requirements: EncounterSceneRequirement[];
|
||||
primaryPokemonRequirements: EncounterPokemonRequirement[];
|
||||
secondaryPokemonRequirements: EncounterPokemonRequirement[];
|
||||
primaryPokemon?: PlayerPokemon;
|
||||
primaryPokemon?: PlayerPokemon | undefined;
|
||||
secondaryPokemon?: PlayerPokemon[];
|
||||
excludePrimaryFromSecondaryRequirements: boolean;
|
||||
|
||||
|
@ -53,9 +53,9 @@ export interface IMysteryEncounter {
|
||||
options: [MysteryEncounterOption, MysteryEncounterOption, ...MysteryEncounterOption[]];
|
||||
spriteConfigs: MysteryEncounterSpriteConfig[];
|
||||
encounterTier: MysteryEncounterTier;
|
||||
encounterAnimations?: EncounterAnim[];
|
||||
disallowedGameModes?: GameModes[];
|
||||
disallowedChallenges?: Challenges[];
|
||||
encounterAnimations?: EncounterAnim[] | undefined;
|
||||
disallowedGameModes?: GameModes[] | undefined;
|
||||
disallowedChallenges?: Challenges[] | undefined;
|
||||
hideBattleIntroMessage: boolean;
|
||||
autoHideIntroVisuals: boolean;
|
||||
enterIntroVisualsFromRight: boolean;
|
||||
@ -68,11 +68,11 @@ export interface IMysteryEncounter {
|
||||
skipToFightInput: boolean;
|
||||
preventGameStatsUpdates: boolean;
|
||||
|
||||
onInit?: () => boolean;
|
||||
onVisualsStart?: () => boolean;
|
||||
doEncounterExp?: () => boolean;
|
||||
doEncounterRewards?: () => boolean;
|
||||
doContinueEncounter?: () => Promise<void>;
|
||||
onInit?: (() => boolean) | undefined;
|
||||
onVisualsStart?: (() => boolean) | undefined;
|
||||
doEncounterExp?: (() => boolean) | undefined;
|
||||
doEncounterRewards?: (() => boolean) | undefined;
|
||||
doContinueEncounter?: (() => Promise<void>) | undefined;
|
||||
|
||||
requirements: EncounterSceneRequirement[];
|
||||
primaryPokemonRequirements: EncounterPokemonRequirement[];
|
||||
@ -105,15 +105,15 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
||||
* Custom battle animations that are configured for encounter effects and visuals
|
||||
* Specify here so that assets are loaded on initialization of encounter
|
||||
*/
|
||||
encounterAnimations?: EncounterAnim[];
|
||||
encounterAnimations?: EncounterAnim[] | undefined;
|
||||
/**
|
||||
* If specified, defines any game modes where the {@linkcode MysteryEncounter} should *NOT* spawn
|
||||
*/
|
||||
disallowedGameModes?: GameModes[];
|
||||
disallowedGameModes?: GameModes[] | undefined;
|
||||
/**
|
||||
* If specified, defines any challenges (from Challenge game mode) where the {@linkcode MysteryEncounter} should *NOT* spawn
|
||||
*/
|
||||
disallowedChallenges?: Challenges[];
|
||||
disallowedChallenges?: Challenges[] | undefined;
|
||||
/**
|
||||
* If true, hides "A Wild X Appeared" etc. messages
|
||||
* Default true
|
||||
@ -172,24 +172,24 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
||||
// #region Event callback functions
|
||||
|
||||
/** Event when Encounter is first loaded, use it for data conditioning */
|
||||
onInit?: () => boolean;
|
||||
onInit?: (() => boolean) | undefined;
|
||||
/** Event when battlefield visuals have finished sliding in and the encounter dialogue begins */
|
||||
onVisualsStart?: () => boolean;
|
||||
onVisualsStart?: (() => boolean) | undefined;
|
||||
/** Event triggered prior to {@linkcode CommandPhase}, during {@linkcode TurnInitPhase} */
|
||||
onTurnStart?: () => boolean;
|
||||
onTurnStart?: (() => boolean) | undefined;
|
||||
/** Event prior to any rewards logic in {@linkcode MysteryEncounterRewardsPhase} */
|
||||
onRewards?: () => Promise<void>;
|
||||
onRewards?: (() => Promise<void>) | undefined;
|
||||
/** Will provide the player party EXP before rewards are displayed for that wave */
|
||||
doEncounterExp?: () => boolean;
|
||||
doEncounterExp?: (() => boolean) | undefined;
|
||||
/** Will provide the player a rewards shop for that wave */
|
||||
doEncounterRewards?: () => boolean;
|
||||
doEncounterRewards?: (() => boolean) | undefined;
|
||||
/** Will execute callback during VictoryPhase of a continuousEncounter */
|
||||
doContinueEncounter?: () => Promise<void>;
|
||||
doContinueEncounter?: (() => Promise<void>) | undefined;
|
||||
/**
|
||||
* Can perform special logic when a ME battle is lost, before GameOver/battle retry prompt.
|
||||
* Should return `true` if it is treated as "real" Game Over, `false` if not.
|
||||
*/
|
||||
onGameOver?: () => boolean;
|
||||
onGameOver?: (() => boolean) | undefined;
|
||||
|
||||
/**
|
||||
* Requirements
|
||||
@ -204,8 +204,8 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
||||
*/
|
||||
secondaryPokemonRequirements: EncounterPokemonRequirement[];
|
||||
excludePrimaryFromSupportRequirements: boolean;
|
||||
primaryPokemon?: PlayerPokemon;
|
||||
secondaryPokemon?: PlayerPokemon[];
|
||||
primaryPokemon?: PlayerPokemon | undefined;
|
||||
secondaryPokemon?: PlayerPokemon[] | undefined;
|
||||
|
||||
// #region Post-construct / Auto-populated params
|
||||
localizationKey: string;
|
||||
@ -224,7 +224,7 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
||||
* Otherwise, will be undefined
|
||||
* You probably shouldn't do anything directly with this unless you have a very specific need
|
||||
*/
|
||||
introVisuals?: MysteryEncounterIntroVisuals;
|
||||
introVisuals?: MysteryEncounterIntroVisuals | undefined;
|
||||
|
||||
// #region Flags
|
||||
|
||||
@ -252,7 +252,7 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
||||
/**
|
||||
* Will be set by option select handlers automatically, and can be used to refer to which option was chosen by later phases
|
||||
*/
|
||||
selectedOption?: MysteryEncounterOption;
|
||||
selectedOption?: MysteryEncounterOption | undefined;
|
||||
/**
|
||||
* Will be set by option select handlers automatically, and can be used to refer to which option was chosen by later phases
|
||||
*/
|
||||
|
@ -7,9 +7,9 @@ export class Status {
|
||||
public effect: StatusEffect;
|
||||
/** Toxic damage is `1/16 max HP * toxicTurnCount` */
|
||||
public toxicTurnCount = 0;
|
||||
public sleepTurnsRemaining?: number;
|
||||
public sleepTurnsRemaining = 0;
|
||||
|
||||
constructor(effect: StatusEffect, toxicTurnCount = 0, sleepTurnsRemaining?: number) {
|
||||
constructor(effect: StatusEffect, toxicTurnCount = 0, sleepTurnsRemaining = 0) {
|
||||
this.effect = effect;
|
||||
this.toxicTurnCount = toxicTurnCount;
|
||||
this.sleepTurnsRemaining = sleepTurnsRemaining;
|
||||
|
@ -302,14 +302,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
public isTerastallized: boolean;
|
||||
public stellarTypesBoosted: PokemonType[];
|
||||
|
||||
public fusionSpecies: PokemonSpecies | null;
|
||||
public fusionSpecies?: PokemonSpecies | undefined = undefined;
|
||||
public fusionFormIndex: number;
|
||||
public fusionAbilityIndex: number;
|
||||
public fusionShiny: boolean;
|
||||
public fusionVariant: Variant;
|
||||
public fusionGender: Gender;
|
||||
public fusionLuck: number;
|
||||
public fusionCustomPokemonData: CustomPokemonData | null;
|
||||
public fusionCustomPokemonData?: CustomPokemonData | undefined = undefined;
|
||||
public fusionTeraType: PokemonType;
|
||||
|
||||
public customPokemonData: CustomPokemonData = new CustomPokemonData();
|
||||
@ -412,7 +412,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
? dataSource.fusionSpecies
|
||||
: dataSource.fusionSpecies
|
||||
? getPokemonSpecies(dataSource.fusionSpecies)
|
||||
: null;
|
||||
: undefined;
|
||||
this.fusionFormIndex = dataSource.fusionFormIndex;
|
||||
this.fusionAbilityIndex = dataSource.fusionAbilityIndex;
|
||||
this.fusionShiny = dataSource.fusionShiny;
|
||||
@ -682,7 +682,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
gender: pokemon.gender,
|
||||
pokeball: pokemon.pokeball,
|
||||
fusionFormIndex: pokemon.fusionFormIndex,
|
||||
fusionSpecies: pokemon.fusionSpecies || undefined,
|
||||
fusionSpecies: pokemon.fusionSpecies,
|
||||
fusionGender: pokemon.fusionGender,
|
||||
};
|
||||
|
||||
@ -2980,14 +2980,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
public clearFusionSpecies(): void {
|
||||
this.fusionSpecies = null;
|
||||
this.fusionFormIndex = 0;
|
||||
this.fusionAbilityIndex = 0;
|
||||
this.fusionShiny = false;
|
||||
this.fusionVariant = 0;
|
||||
this.fusionGender = 0;
|
||||
this.fusionLuck = 0;
|
||||
this.fusionCustomPokemonData = null;
|
||||
this.fusionCustomPokemonData = this.fusionSpecies = undefined;
|
||||
|
||||
this.generateName();
|
||||
this.calculateStats();
|
||||
@ -4746,7 +4745,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
globalScene.phaseManager.unshiftNew(
|
||||
"ObtainStatusEffectPhase",
|
||||
this.getBattlerIndex(),
|
||||
effect,
|
||||
effect ?? StatusEffect.NONE, // This is addressed in a separate PR; please don't sue
|
||||
turnsRemaining,
|
||||
sourceText,
|
||||
sourcePokemon,
|
||||
@ -6725,7 +6724,7 @@ interface IllusionData {
|
||||
/** The pokeball of the illusion */
|
||||
pokeball: PokeballType;
|
||||
/** The fusion species of the illusion if it's a fusion */
|
||||
fusionSpecies?: PokemonSpecies;
|
||||
fusionSpecies?: PokemonSpecies | undefined;
|
||||
/** The fusionFormIndex of the illusion */
|
||||
fusionFormIndex?: number;
|
||||
/** The fusionGender of the illusion if it's a fusion */
|
||||
|
@ -3309,7 +3309,7 @@ export interface CustomModifierSettings {
|
||||
guaranteedModifierTypeFuncs?: ModifierTypeFunc[];
|
||||
fillRemaining?: boolean;
|
||||
/** Set to negative value to disable rerolls completely in shop */
|
||||
rerollMultiplier?: number;
|
||||
rerollMultiplier?: number | undefined;
|
||||
allowLuckUpgrades?: boolean;
|
||||
}
|
||||
|
||||
|
@ -9,19 +9,17 @@ export class CommonAnimPhase extends PokemonPhase {
|
||||
// we need to allow phaseName to be a union of the two
|
||||
public readonly phaseName: "CommonAnimPhase" | "PokemonHealPhase" | "WeatherEffectPhase" = "CommonAnimPhase";
|
||||
private anim: CommonAnim | null;
|
||||
private targetIndex?: BattlerIndex;
|
||||
private playOnEmptyField: boolean;
|
||||
|
||||
constructor(
|
||||
battlerIndex?: BattlerIndex,
|
||||
targetIndex?: BattlerIndex,
|
||||
private targetIndex?: BattlerIndex,
|
||||
anim: CommonAnim | null = null,
|
||||
playOnEmptyField = false,
|
||||
) {
|
||||
super(battlerIndex);
|
||||
|
||||
this.anim = anim;
|
||||
this.targetIndex = targetIndex;
|
||||
this.playOnEmptyField = playOnEmptyField;
|
||||
}
|
||||
|
||||
|
@ -36,16 +36,17 @@ export class FaintPhase extends PokemonPhase {
|
||||
*/
|
||||
private preventInstantRevive: boolean;
|
||||
|
||||
/**
|
||||
* The source Pokemon that dealt fatal damage
|
||||
*/
|
||||
private source?: Pokemon;
|
||||
|
||||
constructor(battlerIndex: BattlerIndex, preventInstantRevive = false, source?: Pokemon) {
|
||||
constructor(
|
||||
battlerIndex: BattlerIndex,
|
||||
preventInstantRevive = false,
|
||||
/**
|
||||
* The source Pokemon that dealt fatal damage
|
||||
*/
|
||||
private source?: Pokemon,
|
||||
) {
|
||||
super(battlerIndex);
|
||||
|
||||
this.preventInstantRevive = preventInstantRevive;
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -4,17 +4,17 @@ import { Phase } from "#app/phase";
|
||||
export class MessagePhase extends Phase {
|
||||
public readonly phaseName = "MessagePhase";
|
||||
private text: string;
|
||||
private callbackDelay?: number | null;
|
||||
private prompt?: boolean | null;
|
||||
private promptDelay?: number | null;
|
||||
private speaker?: string;
|
||||
private callbackDelay: number | null = null;
|
||||
private prompt: boolean | null;
|
||||
private promptDelay: number | null;
|
||||
private speaker = "";
|
||||
|
||||
constructor(
|
||||
text: string,
|
||||
callbackDelay?: number | null,
|
||||
prompt?: boolean | null,
|
||||
promptDelay?: number | null,
|
||||
speaker?: string,
|
||||
callbackDelay: number | null = null,
|
||||
prompt: boolean | null = null,
|
||||
promptDelay: number | null = null,
|
||||
speaker = "",
|
||||
) {
|
||||
super();
|
||||
|
||||
|
@ -30,15 +30,13 @@ import { isNullOrUndefined, randSeedItem } from "#app/utils/common";
|
||||
export class MysteryEncounterPhase extends Phase {
|
||||
public readonly phaseName = "MysteryEncounterPhase";
|
||||
private readonly FIRST_DIALOGUE_PROMPT_DELAY = 300;
|
||||
optionSelectSettings?: OptionSelectSettings;
|
||||
|
||||
/**
|
||||
* Mostly useful for having repeated queries during a single encounter, where the queries and options may differ each time
|
||||
* @param optionSelectSettings allows overriding the typical options of an encounter with new ones
|
||||
*/
|
||||
constructor(optionSelectSettings?: OptionSelectSettings) {
|
||||
constructor(public optionSelectSettings?: OptionSelectSettings) {
|
||||
super();
|
||||
this.optionSelectSettings = optionSelectSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -574,7 +572,7 @@ export class MysteryEncounterRewardsPhase extends Phase {
|
||||
export class PostMysteryEncounterPhase extends Phase {
|
||||
public readonly phaseName = "PostMysteryEncounterPhase";
|
||||
private readonly FIRST_DIALOGUE_PROMPT_DELAY = 750;
|
||||
onPostOptionSelect?: OptionPhaseCallback;
|
||||
onPostOptionSelect?: OptionPhaseCallback | undefined;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -13,24 +13,15 @@ import { isNullOrUndefined } from "#app/utils/common";
|
||||
|
||||
export class ObtainStatusEffectPhase extends PokemonPhase {
|
||||
public readonly phaseName = "ObtainStatusEffectPhase";
|
||||
private statusEffect?: StatusEffect;
|
||||
private turnsRemaining?: number;
|
||||
private sourceText?: string | null;
|
||||
private sourcePokemon?: Pokemon | null;
|
||||
|
||||
constructor(
|
||||
battlerIndex: BattlerIndex,
|
||||
statusEffect?: StatusEffect,
|
||||
turnsRemaining?: number,
|
||||
sourceText?: string | null,
|
||||
sourcePokemon?: Pokemon | null,
|
||||
private statusEffect: StatusEffect,
|
||||
private turnsRemaining = 0,
|
||||
private sourceText: string | null = null,
|
||||
private sourcePokemon: Pokemon | null = null,
|
||||
) {
|
||||
super(battlerIndex);
|
||||
|
||||
this.statusEffect = statusEffect;
|
||||
this.turnsRemaining = turnsRemaining;
|
||||
this.sourceText = sourceText;
|
||||
this.sourcePokemon = sourcePokemon;
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -7,16 +7,13 @@ import { Phase } from "#app/phase";
|
||||
*/
|
||||
export class PartyExpPhase extends Phase {
|
||||
public readonly phaseName = "PartyExpPhase";
|
||||
expValue: number;
|
||||
useWaveIndexMultiplier?: boolean;
|
||||
pokemonParticipantIds?: Set<number>;
|
||||
|
||||
constructor(expValue: number, useWaveIndexMultiplier?: boolean, pokemonParticipantIds?: Set<number>) {
|
||||
constructor(
|
||||
public expValue: number,
|
||||
public useWaveIndexMultiplier?: boolean,
|
||||
public pokemonParticipantIds?: Set<number>,
|
||||
) {
|
||||
super();
|
||||
|
||||
this.expValue = expValue;
|
||||
this.useWaveIndexMultiplier = useWaveIndexMultiplier;
|
||||
this.pokemonParticipantIds = pokemonParticipantIds;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,12 +4,9 @@ import type { EndCardPhase } from "./end-card-phase";
|
||||
|
||||
export class PostGameOverPhase extends Phase {
|
||||
public readonly phaseName = "PostGameOverPhase";
|
||||
private endCardPhase?: EndCardPhase;
|
||||
|
||||
constructor(endCardPhase?: EndCardPhase) {
|
||||
constructor(private endCardPhase?: EndCardPhase) {
|
||||
super();
|
||||
|
||||
this.endCardPhase = endCardPhase;
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -5,12 +5,9 @@ import { fixedInt } from "#app/utils/common";
|
||||
|
||||
export class ReloadSessionPhase extends Phase {
|
||||
public readonly phaseName = "ReloadSessionPhase";
|
||||
private systemDataStr?: string;
|
||||
|
||||
constructor(systemDataStr?: string) {
|
||||
constructor(private systemDataStr?: string) {
|
||||
super();
|
||||
|
||||
this.systemDataStr = systemDataStr;
|
||||
}
|
||||
|
||||
start(): void {
|
||||
|
@ -35,25 +35,15 @@ export type ModifierSelectCallback = (rowCursor: number, cursor: number) => bool
|
||||
|
||||
export class SelectModifierPhase extends BattlePhase {
|
||||
public readonly phaseName = "SelectModifierPhase";
|
||||
private rerollCount: number;
|
||||
private modifierTiers?: ModifierTier[];
|
||||
private customModifierSettings?: CustomModifierSettings;
|
||||
private isCopy: boolean;
|
||||
|
||||
private typeOptions: ModifierTypeOption[];
|
||||
|
||||
constructor(
|
||||
rerollCount = 0,
|
||||
modifierTiers?: ModifierTier[],
|
||||
customModifierSettings?: CustomModifierSettings,
|
||||
isCopy = false,
|
||||
private rerollCount = 0,
|
||||
private modifierTiers?: ModifierTier[],
|
||||
private customModifierSettings?: CustomModifierSettings,
|
||||
private isCopy = false,
|
||||
) {
|
||||
super();
|
||||
|
||||
this.rerollCount = rerollCount;
|
||||
this.modifierTiers = modifierTiers;
|
||||
this.customModifierSettings = customModifierSettings;
|
||||
this.isCopy = isCopy;
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -32,8 +32,8 @@ export abstract class ApiBase {
|
||||
* @param bodyData The body-data to send.
|
||||
* @param dataType The data-type of the {@linkcode bodyData}.
|
||||
*/
|
||||
protected async doPost<D = undefined>(path: string, bodyData?: D, dataType: DataType = "json") {
|
||||
let body: string | undefined = undefined;
|
||||
protected async doPost<D = null>(path: string, bodyData?: D, dataType: DataType = "json") {
|
||||
let body: string | null = null;
|
||||
const headers: HeadersInit = {};
|
||||
|
||||
if (bodyData) {
|
||||
|
@ -112,7 +112,9 @@ export class PokerogueAdminApi extends ApiBase {
|
||||
* @param params The {@linkcode SearchAccountRequest} to send
|
||||
* @returns an array of {@linkcode SearchAccountResponse} and error. Both can be `undefined`
|
||||
*/
|
||||
public async searchAccount(params: SearchAccountRequest): Promise<[data?: SearchAccountResponse, error?: string]> {
|
||||
public async searchAccount(
|
||||
params: SearchAccountRequest,
|
||||
): Promise<[data?: SearchAccountResponse | undefined, error?: string | undefined]> {
|
||||
try {
|
||||
const urlSearchParams = this.toUrlSearchParams(params);
|
||||
const response = await this.doGet(`/admin/account/adminSearch?${urlSearchParams}`);
|
||||
|
@ -163,15 +163,15 @@ export interface StarterMoveData {
|
||||
}
|
||||
|
||||
export interface StarterAttributes {
|
||||
nature?: number;
|
||||
ability?: number;
|
||||
variant?: number;
|
||||
form?: number;
|
||||
female?: boolean;
|
||||
shiny?: boolean;
|
||||
favorite?: boolean;
|
||||
nickname?: string;
|
||||
tera?: PokemonType;
|
||||
nature?: number | undefined;
|
||||
ability?: number | undefined;
|
||||
variant?: number | undefined;
|
||||
form?: number | undefined;
|
||||
female?: boolean | undefined;
|
||||
shiny?: boolean | undefined;
|
||||
favorite?: boolean | undefined;
|
||||
nickname?: string | undefined;
|
||||
tera?: PokemonType | undefined;
|
||||
}
|
||||
|
||||
export interface DexAttrProps {
|
||||
|
@ -21,7 +21,7 @@ export class EnemyBattleInfo extends BattleInfo {
|
||||
protected effectivenessContainer: Phaser.GameObjects.Container;
|
||||
protected effectivenessWindow: Phaser.GameObjects.NineSlice;
|
||||
protected effectivenessText: Phaser.GameObjects.Text;
|
||||
protected currentEffectiveness?: string;
|
||||
protected currentEffectiveness?: string | undefined;
|
||||
// #endregion
|
||||
|
||||
override get statOrder(): Stat[] {
|
||||
|
@ -36,15 +36,11 @@ export enum SortCriteria {
|
||||
}
|
||||
|
||||
export class DropDownLabel {
|
||||
public state: DropDownState;
|
||||
public text: string;
|
||||
public sprite?: Phaser.GameObjects.Sprite;
|
||||
|
||||
constructor(label: string, sprite?: Phaser.GameObjects.Sprite, state: DropDownState = DropDownState.OFF) {
|
||||
this.text = label || "";
|
||||
this.sprite = sprite;
|
||||
this.state = state;
|
||||
}
|
||||
constructor(
|
||||
public text: string,
|
||||
public sprite?: Phaser.GameObjects.Sprite,
|
||||
public state: DropDownState = DropDownState.OFF,
|
||||
) {}
|
||||
}
|
||||
|
||||
export class DropDownOption extends Phaser.GameObjects.Container {
|
||||
|
@ -95,7 +95,7 @@ export abstract class FormModalUiHandler extends ModalUiHandler {
|
||||
const inputBg = addWindow(0, 0, 80, 16, false, false, 0, 0, WindowVariant.XTHIN);
|
||||
|
||||
const isPassword = config?.isPassword;
|
||||
const isReadOnly = config?.isReadOnly;
|
||||
const isReadOnly = config?.isReadOnly ?? false;
|
||||
const input = addTextInputObject(4, -2, 440, 116, TextStyle.TOOLTIP_CONTENT, {
|
||||
type: isPassword ? "password" : "text",
|
||||
maxLength: isPassword ? 64 : 20,
|
||||
|
@ -18,7 +18,7 @@ import { globalScene } from "#app/global-scene";
|
||||
|
||||
export default class MysteryEncounterUiHandler extends UiHandler {
|
||||
private cursorContainer: Phaser.GameObjects.Container;
|
||||
private cursorObj?: Phaser.GameObjects.Image;
|
||||
private cursorObj?: Phaser.GameObjects.Image | undefined;
|
||||
|
||||
private optionsContainer: Phaser.GameObjects.Container;
|
||||
// Length = max number of allowable options (4)
|
||||
@ -26,18 +26,18 @@ export default class MysteryEncounterUiHandler extends UiHandler {
|
||||
|
||||
private tooltipWindow: Phaser.GameObjects.NineSlice;
|
||||
private tooltipContainer: Phaser.GameObjects.Container;
|
||||
private tooltipScrollTween?: Phaser.Tweens.Tween;
|
||||
private tooltipScrollTween?: Phaser.Tweens.Tween | undefined;
|
||||
|
||||
private descriptionWindow: Phaser.GameObjects.NineSlice;
|
||||
private descriptionContainer: Phaser.GameObjects.Container;
|
||||
private descriptionScrollTween?: Phaser.Tweens.Tween;
|
||||
private descriptionScrollTween?: Phaser.Tweens.Tween | undefined;
|
||||
private rarityBall: Phaser.GameObjects.Sprite;
|
||||
|
||||
private dexProgressWindow: Phaser.GameObjects.NineSlice;
|
||||
private dexProgressContainer: Phaser.GameObjects.Container;
|
||||
private showDexProgress = false;
|
||||
|
||||
private overrideSettings?: OptionSelectSettings;
|
||||
private overrideSettings?: OptionSelectSettings | undefined;
|
||||
private encounterOptions: MysteryEncounterOption[] = [];
|
||||
private optionsMeetsReqs: boolean[];
|
||||
|
||||
|
@ -132,10 +132,10 @@ const valueReductionMax = 2;
|
||||
const speciesContainerX = 109;
|
||||
|
||||
interface SpeciesDetails {
|
||||
shiny?: boolean;
|
||||
formIndex?: number;
|
||||
female?: boolean;
|
||||
variant?: number;
|
||||
shiny?: boolean | undefined;
|
||||
formIndex?: number | undefined;
|
||||
female?: boolean | undefined;
|
||||
variant?: number | undefined;
|
||||
}
|
||||
|
||||
enum MenuOptions {
|
||||
|
@ -17,6 +17,7 @@ export class MockClock extends Clock {
|
||||
|
||||
addEvent(config: Phaser.Time.TimerEvent | Phaser.Types.Time.TimerEventConfig): Phaser.Time.TimerEvent {
|
||||
const cfg = { ...config, delay: this.overrideDelay ?? config.delay };
|
||||
return super.addEvent(cfg);
|
||||
// Type assertion needed to get around optional property shit
|
||||
return super.addEvent(cfg as Phaser.Time.TimerEvent | Phaser.Types.Time.TimerEventConfig);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ export interface PromptHandler {
|
||||
phaseTarget?: string;
|
||||
mode?: UiMode;
|
||||
callback?: () => void;
|
||||
expireFn?: () => void;
|
||||
expireFn?: (() => void) | undefined;
|
||||
awaitingActionInput?: boolean;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user