mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-11 09:59:28 +02:00
Merge branch 'pagefaultgames:beta' into freeze-dry-implementation
This commit is contained in:
commit
ee03a28de7
@ -8,6 +8,7 @@ export class UpdateSessionSavedataRequest {
|
|||||||
/** This is **NOT** similar to {@linkcode ClearSessionSavedataRequest} */
|
/** This is **NOT** similar to {@linkcode ClearSessionSavedataRequest} */
|
||||||
export interface NewClearSessionSavedataRequest {
|
export interface NewClearSessionSavedataRequest {
|
||||||
slot: number;
|
slot: number;
|
||||||
|
isVictory: boolean;
|
||||||
clientSessionId: string;
|
clientSessionId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,7 +774,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns An array of {@linkcode PlayerPokemon} filtered from the player's party
|
* @returns An array of {@linkcode PlayerPokemon} filtered from the player's party
|
||||||
* that are {@linkcode PlayerPokemon.isAllowedInBattle | allowed in battle}.
|
* that are {@linkcode Pokemon.isAllowedInBattle | allowed in battle}.
|
||||||
*/
|
*/
|
||||||
public getPokemonAllowedInBattle(): PlayerPokemon[] {
|
public getPokemonAllowedInBattle(): PlayerPokemon[] {
|
||||||
return this.getPlayerParty().filter(p => p.isAllowedInBattle());
|
return this.getPlayerParty().filter(p => p.isAllowedInBattle());
|
||||||
@ -1243,23 +1243,27 @@ export default class BattleScene extends SceneBase {
|
|||||||
|
|
||||||
const lastBattle = this.currentBattle;
|
const lastBattle = this.currentBattle;
|
||||||
|
|
||||||
if (lastBattle?.double && !newDouble) {
|
|
||||||
this.tryRemovePhase(p => p instanceof SwitchPhase);
|
|
||||||
}
|
|
||||||
|
|
||||||
const maxExpLevel = this.getMaxExpLevel();
|
const maxExpLevel = this.getMaxExpLevel();
|
||||||
|
|
||||||
this.lastEnemyTrainer = lastBattle?.trainer ?? null;
|
this.lastEnemyTrainer = lastBattle?.trainer ?? null;
|
||||||
this.lastMysteryEncounter = lastBattle?.mysteryEncounter;
|
this.lastMysteryEncounter = lastBattle?.mysteryEncounter;
|
||||||
|
|
||||||
|
if (newBattleType === BattleType.MYSTERY_ENCOUNTER) {
|
||||||
|
// Disable double battle on mystery encounters (it may be re-enabled as part of encounter)
|
||||||
|
newDouble = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastBattle?.double && !newDouble) {
|
||||||
|
this.tryRemovePhase(p => p instanceof SwitchPhase);
|
||||||
|
this.getPlayerField().forEach(p => p.lapseTag(BattlerTagType.COMMANDED));
|
||||||
|
}
|
||||||
|
|
||||||
this.executeWithSeedOffset(() => {
|
this.executeWithSeedOffset(() => {
|
||||||
this.currentBattle = new Battle(this.gameMode, newWaveIndex, newBattleType, newTrainer, newDouble);
|
this.currentBattle = new Battle(this.gameMode, newWaveIndex, newBattleType, newTrainer, newDouble);
|
||||||
}, newWaveIndex << 3, this.waveSeed);
|
}, newWaveIndex << 3, this.waveSeed);
|
||||||
this.currentBattle.incrementTurn(this);
|
this.currentBattle.incrementTurn(this);
|
||||||
|
|
||||||
if (newBattleType === BattleType.MYSTERY_ENCOUNTER) {
|
if (newBattleType === BattleType.MYSTERY_ENCOUNTER) {
|
||||||
// Disable double battle on mystery encounters (it may be re-enabled as part of encounter)
|
|
||||||
this.currentBattle.double = false;
|
|
||||||
// Will generate the actual Mystery Encounter during NextEncounterPhase, to ensure it uses proper biome
|
// Will generate the actual Mystery Encounter during NextEncounterPhase, to ensure it uses proper biome
|
||||||
this.currentBattle.mysteryEncounterType = mysteryEncounterType;
|
this.currentBattle.mysteryEncounterType = mysteryEncounterType;
|
||||||
}
|
}
|
||||||
|
@ -2463,12 +2463,15 @@ export class PostSummonCopyAllyStatsAbAttr extends PostSummonAbAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by Imposter
|
||||||
|
*/
|
||||||
export class PostSummonTransformAbAttr extends PostSummonAbAttr {
|
export class PostSummonTransformAbAttr extends PostSummonAbAttr {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(true);
|
super(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async applyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): Promise<boolean> {
|
async applyPostSummon(pokemon: Pokemon, _passive: boolean, simulated: boolean, _args: any[]): Promise<boolean> {
|
||||||
const targets = pokemon.getOpponents();
|
const targets = pokemon.getOpponents();
|
||||||
if (simulated || !targets.length) {
|
if (simulated || !targets.length) {
|
||||||
return simulated;
|
return simulated;
|
||||||
@ -2477,17 +2480,31 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
|
|||||||
|
|
||||||
let target: Pokemon;
|
let target: Pokemon;
|
||||||
if (targets.length > 1) {
|
if (targets.length > 1) {
|
||||||
pokemon.scene.executeWithSeedOffset(() => target = Utils.randSeedItem(targets), pokemon.scene.currentBattle.waveIndex);
|
pokemon.scene.executeWithSeedOffset(() => {
|
||||||
|
// in a double battle, if one of the opposing pokemon is fused the other one will be chosen
|
||||||
|
// if both are fused, then Imposter will fail below
|
||||||
|
if (targets[0].fusionSpecies) {
|
||||||
|
target = targets[1];
|
||||||
|
return;
|
||||||
|
} else if (targets[1].fusionSpecies) {
|
||||||
|
target = targets[0];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
target = Utils.randSeedItem(targets);
|
||||||
|
}, pokemon.scene.currentBattle.waveIndex);
|
||||||
} else {
|
} else {
|
||||||
target = targets[0];
|
target = targets[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
target = target!;
|
target = target!;
|
||||||
|
|
||||||
|
// transforming from or into fusion pokemon causes various problems (including crashes and save corruption)
|
||||||
|
if (target.fusionSpecies || pokemon.fusionSpecies) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
pokemon.summonData.speciesForm = target.getSpeciesForm();
|
pokemon.summonData.speciesForm = target.getSpeciesForm();
|
||||||
pokemon.summonData.fusionSpeciesForm = target.getFusionSpeciesForm();
|
|
||||||
pokemon.summonData.ability = target.getAbility().id;
|
pokemon.summonData.ability = target.getAbility().id;
|
||||||
pokemon.summonData.gender = target.getGender();
|
pokemon.summonData.gender = target.getGender();
|
||||||
pokemon.summonData.fusionGender = target.getFusionGender();
|
|
||||||
|
|
||||||
// Copy all stats (except HP)
|
// Copy all stats (except HP)
|
||||||
for (const s of EFFECTIVE_STATS) {
|
for (const s of EFFECTIVE_STATS) {
|
||||||
|
@ -6388,10 +6388,17 @@ export class RandomMovesetMoveAttr extends OverrideMoveEffectAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class RandomMoveAttr extends OverrideMoveEffectAttr {
|
export class RandomMoveAttr extends OverrideMoveEffectAttr {
|
||||||
|
/**
|
||||||
|
* This function exists solely to allow tests to override the randomly selected move by mocking this function.
|
||||||
|
*/
|
||||||
|
public getMoveOverride(): Moves | null {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const moveIds = Utils.getEnumValues(Moves).filter(m => !allMoves[m].hasFlag(MoveFlags.IGNORE_VIRTUAL) && !allMoves[m].name.endsWith(" (N)"));
|
const moveIds = Utils.getEnumValues(Moves).filter(m => !allMoves[m].hasFlag(MoveFlags.IGNORE_VIRTUAL) && !allMoves[m].name.endsWith(" (N)"));
|
||||||
const moveId = moveIds[user.randSeedInt(moveIds.length)];
|
const moveId = this.getMoveOverride() ?? moveIds[user.randSeedInt(moveIds.length)];
|
||||||
|
|
||||||
const moveTargets = getMoveTargets(user, moveId);
|
const moveTargets = getMoveTargets(user, moveId);
|
||||||
if (!moveTargets.targets.length) {
|
if (!moveTargets.targets.length) {
|
||||||
@ -6774,7 +6781,7 @@ export class SketchAttr extends MoveEffectAttr {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetMove = target.getLastXMoves(target.battleSummonData.turnCount)
|
const targetMove = target.getLastXMoves(-1)
|
||||||
.find(m => m.move !== Moves.NONE && m.move !== Moves.STRUGGLE && !m.virtual);
|
.find(m => m.move !== Moves.NONE && m.move !== Moves.STRUGGLE && !m.virtual);
|
||||||
if (!targetMove) {
|
if (!targetMove) {
|
||||||
return false;
|
return false;
|
||||||
@ -7003,6 +7010,9 @@ export class SuppressAbilitiesIfActedAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by Transform
|
||||||
|
*/
|
||||||
export class TransformAttr extends MoveEffectAttr {
|
export class TransformAttr extends MoveEffectAttr {
|
||||||
async apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
|
async apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
|
||||||
if (!super.apply(user, target, move, args)) {
|
if (!super.apply(user, target, move, args)) {
|
||||||
@ -7011,10 +7021,8 @@ export class TransformAttr extends MoveEffectAttr {
|
|||||||
|
|
||||||
const promises: Promise<void>[] = [];
|
const promises: Promise<void>[] = [];
|
||||||
user.summonData.speciesForm = target.getSpeciesForm();
|
user.summonData.speciesForm = target.getSpeciesForm();
|
||||||
user.summonData.fusionSpeciesForm = target.getFusionSpeciesForm();
|
|
||||||
user.summonData.ability = target.getAbility().id;
|
user.summonData.ability = target.getAbility().id;
|
||||||
user.summonData.gender = target.getGender();
|
user.summonData.gender = target.getGender();
|
||||||
user.summonData.fusionGender = target.getFusionGender();
|
|
||||||
|
|
||||||
// Power Trick's effect will not preserved after using Transform
|
// Power Trick's effect will not preserved after using Transform
|
||||||
user.removeTag(BattlerTagType.POWER_TRICK);
|
user.removeTag(BattlerTagType.POWER_TRICK);
|
||||||
@ -8085,7 +8093,8 @@ export function initMoves() {
|
|||||||
.ignoresVirtual(),
|
.ignoresVirtual(),
|
||||||
new StatusMove(Moves.TRANSFORM, Type.NORMAL, -1, 10, -1, 0, 1)
|
new StatusMove(Moves.TRANSFORM, Type.NORMAL, -1, 10, -1, 0, 1)
|
||||||
.attr(TransformAttr)
|
.attr(TransformAttr)
|
||||||
.condition((user, target, move) => !target.getTag(BattlerTagType.SUBSTITUTE))
|
// transforming from or into fusion pokemon causes various problems (such as crashes)
|
||||||
|
.condition((user, target, move) => !target.getTag(BattlerTagType.SUBSTITUTE) && !user.fusionSpecies && !target.fusionSpecies)
|
||||||
.ignoresProtect(),
|
.ignoresProtect(),
|
||||||
new AttackMove(Moves.BUBBLE, Type.WATER, MoveCategory.SPECIAL, 40, 100, 30, 10, 0, 1)
|
new AttackMove(Moves.BUBBLE, Type.WATER, MoveCategory.SPECIAL, 40, 100, 30, 10, 0, 1)
|
||||||
.attr(StatStageChangeAttr, [ Stat.SPD ], -1)
|
.attr(StatStageChangeAttr, [ Stat.SPD ], -1)
|
||||||
|
@ -305,7 +305,7 @@ async function showWobbuffetHealthBar(scene: BattleScene) {
|
|||||||
scene.field.add(wobbuffet);
|
scene.field.add(wobbuffet);
|
||||||
|
|
||||||
const playerPokemon = scene.getPlayerPokemon() as Pokemon;
|
const playerPokemon = scene.getPlayerPokemon() as Pokemon;
|
||||||
if (playerPokemon?.visible) {
|
if (playerPokemon?.isOnField()) {
|
||||||
scene.field.moveBelow(wobbuffet, playerPokemon);
|
scene.field.moveBelow(wobbuffet, playerPokemon);
|
||||||
}
|
}
|
||||||
// Show health bar and trigger cry
|
// Show health bar and trigger cry
|
||||||
|
@ -312,6 +312,7 @@ export const WeirdDreamEncounter: MysteryEncounter =
|
|||||||
pokemon.levelExp = 0;
|
pokemon.levelExp = 0;
|
||||||
|
|
||||||
pokemon.calculateStats();
|
pokemon.calculateStats();
|
||||||
|
pokemon.getBattleInfo().setLevel(pokemon.level);
|
||||||
await pokemon.updateInfo();
|
await pokemon.updateInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,17 +888,24 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||||||
getCompatibleFusionSpeciesFilter(): PokemonSpeciesFilter {
|
getCompatibleFusionSpeciesFilter(): PokemonSpeciesFilter {
|
||||||
const hasEvolution = pokemonEvolutions.hasOwnProperty(this.speciesId);
|
const hasEvolution = pokemonEvolutions.hasOwnProperty(this.speciesId);
|
||||||
const hasPrevolution = pokemonPrevolutions.hasOwnProperty(this.speciesId);
|
const hasPrevolution = pokemonPrevolutions.hasOwnProperty(this.speciesId);
|
||||||
const pseudoLegendary = this.subLegendary;
|
const subLegendary = this.subLegendary;
|
||||||
const legendary = this.legendary;
|
const legendary = this.legendary;
|
||||||
const mythical = this.mythical;
|
const mythical = this.mythical;
|
||||||
return species => {
|
return species => {
|
||||||
return (pseudoLegendary || legendary || mythical ||
|
return (
|
||||||
(pokemonEvolutions.hasOwnProperty(species.speciesId) === hasEvolution
|
subLegendary
|
||||||
&& pokemonPrevolutions.hasOwnProperty(species.speciesId) === hasPrevolution))
|
|| legendary
|
||||||
&& species.subLegendary === pseudoLegendary
|
|| mythical
|
||||||
|
|| (
|
||||||
|
pokemonEvolutions.hasOwnProperty(species.speciesId) === hasEvolution
|
||||||
|
&& pokemonPrevolutions.hasOwnProperty(species.speciesId) === hasPrevolution
|
||||||
|
)
|
||||||
|
)
|
||||||
|
&& species.subLegendary === subLegendary
|
||||||
&& species.legendary === legendary
|
&& species.legendary === legendary
|
||||||
&& species.mythical === mythical
|
&& species.mythical === mythical
|
||||||
&& (this.isTrainerForbidden() || !species.isTrainerForbidden());
|
&& (this.isTrainerForbidden() || !species.isTrainerForbidden())
|
||||||
|
&& species.speciesId !== Species.DITTO;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import { reverseCompatibleTms, tmSpecies, tmPoolTiers } from "#app/data/balance/
|
|||||||
import { BattlerTag, BattlerTagLapseType, EncoreTag, GroundedTag, HighestStatBoostTag, SubstituteTag, TypeImmuneTag, getBattlerTag, SemiInvulnerableTag, TypeBoostTag, MoveRestrictionBattlerTag, ExposedTag, DragonCheerTag, CritBoostTag, TrappedTag, TarShotTag, AutotomizedTag, PowerTrickTag } from "../data/battler-tags";
|
import { BattlerTag, BattlerTagLapseType, EncoreTag, GroundedTag, HighestStatBoostTag, SubstituteTag, TypeImmuneTag, getBattlerTag, SemiInvulnerableTag, TypeBoostTag, MoveRestrictionBattlerTag, ExposedTag, DragonCheerTag, CritBoostTag, TrappedTag, TarShotTag, AutotomizedTag, PowerTrickTag } from "../data/battler-tags";
|
||||||
import { WeatherType } from "#enums/weather-type";
|
import { WeatherType } from "#enums/weather-type";
|
||||||
import { ArenaTagSide, NoCritTag, WeakenMoveScreenTag } from "#app/data/arena-tag";
|
import { ArenaTagSide, NoCritTag, WeakenMoveScreenTag } from "#app/data/arena-tag";
|
||||||
import { Ability, AbAttr, StatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, IgnoreOpponentStatStagesAbAttr, MoveImmunityAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyStatMultiplierAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, DamageBoostAbAttr, IgnoreTypeStatusEffectImmunityAbAttr, ConditionalCritAbAttr, applyFieldStatMultiplierAbAttrs, FieldMultiplyStatAbAttr, AddSecondStrikeAbAttr, UserFieldStatusEffectImmunityAbAttr, UserFieldBattlerTagImmunityAbAttr, BattlerTagImmunityAbAttr, MoveTypeChangeAbAttr, FullHpResistTypeAbAttr, applyCheckTrappedAbAttrs, CheckTrappedAbAttr, PostSetStatusAbAttr, applyPostSetStatusAbAttrs, InfiltratorAbAttr, AlliedFieldDamageReductionAbAttr, PostDamageAbAttr, applyPostDamageAbAttrs, PostDamageForceSwitchAbAttr } from "#app/data/ability";
|
import { Ability, AbAttr, StatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, IgnoreOpponentStatStagesAbAttr, MoveImmunityAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyStatMultiplierAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, DamageBoostAbAttr, IgnoreTypeStatusEffectImmunityAbAttr, ConditionalCritAbAttr, applyFieldStatMultiplierAbAttrs, FieldMultiplyStatAbAttr, AddSecondStrikeAbAttr, UserFieldStatusEffectImmunityAbAttr, UserFieldBattlerTagImmunityAbAttr, BattlerTagImmunityAbAttr, MoveTypeChangeAbAttr, FullHpResistTypeAbAttr, applyCheckTrappedAbAttrs, CheckTrappedAbAttr, PostSetStatusAbAttr, applyPostSetStatusAbAttrs, InfiltratorAbAttr, AlliedFieldDamageReductionAbAttr, PostDamageAbAttr, applyPostDamageAbAttrs, PostDamageForceSwitchAbAttr, CommanderAbAttr } from "#app/data/ability";
|
||||||
import PokemonData from "#app/system/pokemon-data";
|
import PokemonData from "#app/system/pokemon-data";
|
||||||
import { BattlerIndex } from "#app/battle";
|
import { BattlerIndex } from "#app/battle";
|
||||||
import { Mode } from "#app/ui/ui";
|
import { Mode } from "#app/ui/ui";
|
||||||
@ -2030,15 +2030,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
const hasHiddenAbility = !Utils.randSeedInt(hiddenAbilityChance.value);
|
const hasHiddenAbility = !Utils.randSeedInt(hiddenAbilityChance.value);
|
||||||
const randAbilityIndex = Utils.randSeedInt(2);
|
const randAbilityIndex = Utils.randSeedInt(2);
|
||||||
|
|
||||||
const filter = !forStarter ? this.species.getCompatibleFusionSpeciesFilter()
|
const filter = !forStarter ?
|
||||||
: species => {
|
this.species.getCompatibleFusionSpeciesFilter()
|
||||||
|
: (species: PokemonSpecies) => {
|
||||||
return pokemonEvolutions.hasOwnProperty(species.speciesId)
|
return pokemonEvolutions.hasOwnProperty(species.speciesId)
|
||||||
&& !pokemonPrevolutions.hasOwnProperty(species.speciesId)
|
&& !pokemonPrevolutions.hasOwnProperty(species.speciesId)
|
||||||
&& !species.pseudoLegendary
|
&& !species.subLegendary
|
||||||
&& !species.legendary
|
&& !species.legendary
|
||||||
&& !species.mythical
|
&& !species.mythical
|
||||||
&& !species.isTrainerForbidden()
|
&& !species.isTrainerForbidden()
|
||||||
&& species.speciesId !== this.species.speciesId;
|
&& species.speciesId !== this.species.speciesId
|
||||||
|
&& species.speciesId !== Species.DITTO;
|
||||||
};
|
};
|
||||||
|
|
||||||
let fusionOverride: PokemonSpecies | undefined = undefined;
|
let fusionOverride: PokemonSpecies | undefined = undefined;
|
||||||
@ -3081,7 +3083,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lapseTag(tagType: BattlerTagType): boolean {
|
lapseTag(tagType: BattlerTagType): boolean {
|
||||||
const tags = this.summonData.tags;
|
const tags = this.summonData?.tags;
|
||||||
|
if (isNullOrUndefined(tags)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const tag = tags.find(t => t.tagType === tagType);
|
const tag = tags.find(t => t.tagType === tagType);
|
||||||
if (tag && !(tag.lapse(this, BattlerTagLapseType.CUSTOM))) {
|
if (tag && !(tag.lapse(this, BattlerTagLapseType.CUSTOM))) {
|
||||||
tag.onRemove(this);
|
tag.onRemove(this);
|
||||||
@ -3223,9 +3228,21 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.getMoveHistory().push(turnMove);
|
this.getMoveHistory().push(turnMove);
|
||||||
}
|
}
|
||||||
|
|
||||||
getLastXMoves(turnCount: integer = 0): TurnMove[] {
|
/**
|
||||||
|
* Returns a list of the most recent move entries in this Pokemon's move history.
|
||||||
|
* The retrieved move entries are sorted in order from NEWEST to OLDEST.
|
||||||
|
* @param moveCount The number of move entries to retrieve.
|
||||||
|
* If negative, retrieve the Pokemon's entire move history (equivalent to reversing the output of {@linkcode getMoveHistory()}).
|
||||||
|
* Default is `1`.
|
||||||
|
* @returns A list of {@linkcode TurnMove}, as specified above.
|
||||||
|
*/
|
||||||
|
getLastXMoves(moveCount: number = 1): TurnMove[] {
|
||||||
const moveHistory = this.getMoveHistory();
|
const moveHistory = this.getMoveHistory();
|
||||||
return moveHistory.slice(turnCount >= 0 ? Math.max(moveHistory.length - (turnCount || 1), 0) : 0, moveHistory.length).reverse();
|
if (moveCount >= 0) {
|
||||||
|
return moveHistory.slice(Math.max(moveHistory.length - moveCount, 0)).reverse();
|
||||||
|
} else {
|
||||||
|
return moveHistory.slice(0).reverse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getMoveQueue(): QueuedMove[] {
|
getMoveQueue(): QueuedMove[] {
|
||||||
@ -3646,6 +3663,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.scene.triggerPokemonBattleAnim(this, PokemonAnimType.SUBSTITUTE_ADD);
|
this.scene.triggerPokemonBattleAnim(this, PokemonAnimType.SUBSTITUTE_ADD);
|
||||||
this.getTag(SubstituteTag)!.sourceInFocus = false;
|
this.getTag(SubstituteTag)!.sourceInFocus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this Pokemon has Commander and Dondozo as an active ally, hide this Pokemon's sprite.
|
||||||
|
if (this.hasAbilityWithAttr(CommanderAbAttr)
|
||||||
|
&& this.scene.currentBattle.double
|
||||||
|
&& this.getAlly()?.species.speciesId === Species.DONDOZO) {
|
||||||
|
this.setVisible(false);
|
||||||
|
}
|
||||||
this.summonDataPrimer = null;
|
this.summonDataPrimer = null;
|
||||||
}
|
}
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
@ -4029,8 +4053,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.resetTurnData();
|
this.resetTurnData();
|
||||||
if (clearEffects) {
|
if (clearEffects) {
|
||||||
this.destroySubstitute();
|
this.destroySubstitute();
|
||||||
this.resetSummonData();
|
this.resetSummonData(); // this also calls `resetBattleSummonData`
|
||||||
this.resetBattleData();
|
|
||||||
}
|
}
|
||||||
if (hideInfo) {
|
if (hideInfo) {
|
||||||
this.hideInfo();
|
this.hideInfo();
|
||||||
@ -5092,7 +5115,7 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new pokemon to the player's party (at `slotIndex` if set).
|
* Add a new pokemon to the player's party (at `slotIndex` if set).
|
||||||
* If the first slot is replaced, the new pokemon's visibility will be set to `false`.
|
* The new pokemon's visibility will be set to `false`.
|
||||||
* @param pokeballType the type of pokeball the pokemon was caught with
|
* @param pokeballType the type of pokeball the pokemon was caught with
|
||||||
* @param slotIndex an optional index to place the pokemon in the party
|
* @param slotIndex an optional index to place the pokemon in the party
|
||||||
* @returns the pokemon that was added or null if the pokemon could not be added
|
* @returns the pokemon that was added or null if the pokemon could not be added
|
||||||
@ -5110,14 +5133,14 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
const newPokemon = this.scene.addPlayerPokemon(this.species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this.variant, this.ivs, this.nature, this);
|
const newPokemon = this.scene.addPlayerPokemon(this.species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this.variant, this.ivs, this.nature, this);
|
||||||
|
|
||||||
if (Utils.isBetween(slotIndex, 0, PLAYER_PARTY_MAX_SIZE - 1)) {
|
if (Utils.isBetween(slotIndex, 0, PLAYER_PARTY_MAX_SIZE - 1)) {
|
||||||
if (slotIndex === 0) {
|
|
||||||
newPokemon.setVisible(false); // Hide if replaced with first pokemon
|
|
||||||
}
|
|
||||||
party.splice(slotIndex, 0, newPokemon);
|
party.splice(slotIndex, 0, newPokemon);
|
||||||
} else {
|
} else {
|
||||||
party.push(newPokemon);
|
party.push(newPokemon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hide the Pokemon since it is not on the field
|
||||||
|
newPokemon.setVisible(false);
|
||||||
|
|
||||||
ret = newPokemon;
|
ret = newPokemon;
|
||||||
this.scene.triggerPokemonFormChange(newPokemon, SpeciesFormChangeActiveTrigger, true);
|
this.scene.triggerPokemonFormChange(newPokemon, SpeciesFormChangeActiveTrigger, true);
|
||||||
}
|
}
|
||||||
|
@ -1702,10 +1702,7 @@ const modifierPool: ModifierPool = {
|
|||||||
new WeightedModifierType(modifierTypes.EVOLUTION_ITEM, (party: Pokemon[]) => {
|
new WeightedModifierType(modifierTypes.EVOLUTION_ITEM, (party: Pokemon[]) => {
|
||||||
return Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 15), 8);
|
return Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 15), 8);
|
||||||
}, 8),
|
}, 8),
|
||||||
new WeightedModifierType(modifierTypes.MAP,
|
new WeightedModifierType(modifierTypes.MAP, (party: Pokemon[]) => party[0].scene.gameMode.isClassic && party[0].scene.currentBattle.waveIndex < 180 ? 1 : 0, 1),
|
||||||
(party: Pokemon[]) => party[0].scene.gameMode.isClassic && party[0].scene.currentBattle.waveIndex < 180 ? party[0].scene.eventManager.isEventActive() ? 2 : 1 : 0,
|
|
||||||
(party: Pokemon[]) => party[0].scene.eventManager.isEventActive() ? 2 : 1),
|
|
||||||
new WeightedModifierType(modifierTypes.SOOTHE_BELL, (party: Pokemon[]) => party[0].scene.eventManager.isEventActive() ? 3 : 0),
|
|
||||||
new WeightedModifierType(modifierTypes.TM_GREAT, 3),
|
new WeightedModifierType(modifierTypes.TM_GREAT, 3),
|
||||||
new WeightedModifierType(modifierTypes.MEMORY_MUSHROOM, (party: Pokemon[]) => {
|
new WeightedModifierType(modifierTypes.MEMORY_MUSHROOM, (party: Pokemon[]) => {
|
||||||
if (!party.find(p => p.getLearnableLevelMoves().length)) {
|
if (!party.find(p => p.getLearnableLevelMoves().length)) {
|
||||||
@ -1773,7 +1770,7 @@ const modifierPool: ModifierPool = {
|
|||||||
new WeightedModifierType(modifierTypes.CANDY_JAR, skipInLastClassicWaveOrDefault(5)),
|
new WeightedModifierType(modifierTypes.CANDY_JAR, skipInLastClassicWaveOrDefault(5)),
|
||||||
new WeightedModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, 9),
|
new WeightedModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, 9),
|
||||||
new WeightedModifierType(modifierTypes.TM_ULTRA, 11),
|
new WeightedModifierType(modifierTypes.TM_ULTRA, 11),
|
||||||
new WeightedModifierType(modifierTypes.RARER_CANDY, (party: Pokemon[]) => party[0].scene.eventManager.isEventActive() ? 6 : 4),
|
new WeightedModifierType(modifierTypes.RARER_CANDY, 4),
|
||||||
new WeightedModifierType(modifierTypes.GOLDEN_PUNCH, skipInLastClassicWaveOrDefault(2)),
|
new WeightedModifierType(modifierTypes.GOLDEN_PUNCH, skipInLastClassicWaveOrDefault(2)),
|
||||||
new WeightedModifierType(modifierTypes.IV_SCANNER, skipInLastClassicWaveOrDefault(4)),
|
new WeightedModifierType(modifierTypes.IV_SCANNER, skipInLastClassicWaveOrDefault(4)),
|
||||||
new WeightedModifierType(modifierTypes.EXP_CHARM, skipInLastClassicWaveOrDefault(8)),
|
new WeightedModifierType(modifierTypes.EXP_CHARM, skipInLastClassicWaveOrDefault(8)),
|
||||||
@ -1797,7 +1794,7 @@ const modifierPool: ModifierPool = {
|
|||||||
new WeightedModifierType(modifierTypes.SOUL_DEW, 7),
|
new WeightedModifierType(modifierTypes.SOUL_DEW, 7),
|
||||||
//new WeightedModifierType(modifierTypes.OVAL_CHARM, 6),
|
//new WeightedModifierType(modifierTypes.OVAL_CHARM, 6),
|
||||||
new WeightedModifierType(modifierTypes.CATCHING_CHARM, (party: Pokemon[]) => !party[0].scene.gameMode.isFreshStartChallenge() && party[0].scene.gameData.getSpeciesCount(d => !!d.caughtAttr) > 100 ? 4 : 0, 4),
|
new WeightedModifierType(modifierTypes.CATCHING_CHARM, (party: Pokemon[]) => !party[0].scene.gameMode.isFreshStartChallenge() && party[0].scene.gameData.getSpeciesCount(d => !!d.caughtAttr) > 100 ? 4 : 0, 4),
|
||||||
new WeightedModifierType(modifierTypes.SOOTHE_BELL, (party: Pokemon[]) => party[0].scene.eventManager.isEventActive() ? 0 : 4),
|
new WeightedModifierType(modifierTypes.SOOTHE_BELL, 4),
|
||||||
new WeightedModifierType(modifierTypes.ABILITY_CHARM, skipInClassicAfterWave(189, 6)),
|
new WeightedModifierType(modifierTypes.ABILITY_CHARM, skipInClassicAfterWave(189, 6)),
|
||||||
new WeightedModifierType(modifierTypes.FOCUS_BAND, 5),
|
new WeightedModifierType(modifierTypes.FOCUS_BAND, 5),
|
||||||
new WeightedModifierType(modifierTypes.KINGS_ROCK, 3),
|
new WeightedModifierType(modifierTypes.KINGS_ROCK, 3),
|
||||||
|
@ -728,10 +728,10 @@ export abstract class PokemonHeldItemModifier extends PersistentModifier {
|
|||||||
//Applies to items with chance of activating secondary effects ie Kings Rock
|
//Applies to items with chance of activating secondary effects ie Kings Rock
|
||||||
getSecondaryChanceMultiplier(pokemon: Pokemon): number {
|
getSecondaryChanceMultiplier(pokemon: Pokemon): number {
|
||||||
// Temporary quickfix to stop game from freezing when the opponet uses u-turn while holding on to king's rock
|
// Temporary quickfix to stop game from freezing when the opponet uses u-turn while holding on to king's rock
|
||||||
if (!pokemon.getLastXMoves(0)[0]) {
|
if (!pokemon.getLastXMoves()[0]) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
const sheerForceAffected = allMoves[pokemon.getLastXMoves(0)[0].move].chance >= 0 && pokemon.hasAbility(Abilities.SHEER_FORCE);
|
const sheerForceAffected = allMoves[pokemon.getLastXMoves()[0].move].chance >= 0 && pokemon.hasAbility(Abilities.SHEER_FORCE);
|
||||||
|
|
||||||
if (sheerForceAffected) {
|
if (sheerForceAffected) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -26,25 +26,29 @@ export class CheckSwitchPhase extends BattlePhase {
|
|||||||
|
|
||||||
const pokemon = this.scene.getPlayerField()[this.fieldIndex];
|
const pokemon = this.scene.getPlayerField()[this.fieldIndex];
|
||||||
|
|
||||||
|
// End this phase early...
|
||||||
|
|
||||||
|
// ...if the user is playing in Set Mode
|
||||||
if (this.scene.battleStyle === BattleStyle.SET) {
|
if (this.scene.battleStyle === BattleStyle.SET) {
|
||||||
super.end();
|
return super.end();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ...if the checked Pokemon is somehow not on the field
|
||||||
if (this.scene.field.getAll().indexOf(pokemon) === -1) {
|
if (this.scene.field.getAll().indexOf(pokemon) === -1) {
|
||||||
this.scene.unshiftPhase(new SummonMissingPhase(this.scene, this.fieldIndex));
|
this.scene.unshiftPhase(new SummonMissingPhase(this.scene, this.fieldIndex));
|
||||||
super.end();
|
return super.end();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ...if there are no other allowed Pokemon in the player's party to switch with
|
||||||
if (!this.scene.getPlayerParty().slice(1).filter(p => p.isActive()).length) {
|
if (!this.scene.getPlayerParty().slice(1).filter(p => p.isActive()).length) {
|
||||||
super.end();
|
return super.end();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pokemon.getTag(BattlerTagType.FRENZY)) {
|
// ...or if any player Pokemon has an effect that prevents the checked Pokemon from switching
|
||||||
super.end();
|
if (pokemon.getTag(BattlerTagType.FRENZY)
|
||||||
return;
|
|| pokemon.isTrapped()
|
||||||
|
|| this.scene.getPlayerField().some(p => p.getTag(BattlerTagType.COMMANDED))) {
|
||||||
|
return super.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.scene.ui.showText(i18next.t("battle:switchQuestion", { pokemonName: this.useName ? getPokemonNameWithAffix(pokemon) : i18next.t("battle:pokemon") }), null, () => {
|
this.scene.ui.showText(i18next.t("battle:switchQuestion", { pokemonName: this.useName ? getPokemonNameWithAffix(pokemon) : i18next.t("battle:pokemon") }), null, () => {
|
||||||
|
@ -36,7 +36,6 @@ import { PlayerGender } from "#enums/player-gender";
|
|||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { WEIGHT_INCREMENT_ON_SPAWN_MISS } from "#app/data/mystery-encounters/mystery-encounters";
|
import { WEIGHT_INCREMENT_ON_SPAWN_MISS } from "#app/data/mystery-encounters/mystery-encounters";
|
||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
|
||||||
|
|
||||||
export class EncounterPhase extends BattlePhase {
|
export class EncounterPhase extends BattlePhase {
|
||||||
private loaded: boolean;
|
private loaded: boolean;
|
||||||
@ -203,7 +202,7 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
this.scene.field.add(enemyPokemon);
|
this.scene.field.add(enemyPokemon);
|
||||||
battle.seenEnemyPartyMemberIds.add(enemyPokemon.id);
|
battle.seenEnemyPartyMemberIds.add(enemyPokemon.id);
|
||||||
const playerPokemon = this.scene.getPlayerPokemon();
|
const playerPokemon = this.scene.getPlayerPokemon();
|
||||||
if (playerPokemon?.visible) {
|
if (playerPokemon?.isOnField()) {
|
||||||
this.scene.field.moveBelow(enemyPokemon as Pokemon, playerPokemon);
|
this.scene.field.moveBelow(enemyPokemon as Pokemon, playerPokemon);
|
||||||
}
|
}
|
||||||
enemyPokemon.tint(0, 0.5);
|
enemyPokemon.tint(0, 0.5);
|
||||||
@ -483,7 +482,6 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (availablePartyMembers.length > 1 && availablePartyMembers[1].isOnField()) {
|
if (availablePartyMembers.length > 1 && availablePartyMembers[1].isOnField()) {
|
||||||
this.scene.getPlayerField().forEach((pokemon) => pokemon.lapseTag(BattlerTagType.COMMANDED));
|
|
||||||
this.scene.pushPhase(new ReturnPhase(this.scene, 1));
|
this.scene.pushPhase(new ReturnPhase(this.scene, 1));
|
||||||
}
|
}
|
||||||
this.scene.pushPhase(new ToggleDoublePositionPhase(this.scene, false));
|
this.scene.pushPhase(new ToggleDoublePositionPhase(this.scene, false));
|
||||||
|
@ -26,13 +26,13 @@ import i18next from "i18next";
|
|||||||
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||||
|
|
||||||
export class GameOverPhase extends BattlePhase {
|
export class GameOverPhase extends BattlePhase {
|
||||||
private victory: boolean;
|
private isVictory: boolean;
|
||||||
private firstRibbons: PokemonSpecies[] = [];
|
private firstRibbons: PokemonSpecies[] = [];
|
||||||
|
|
||||||
constructor(scene: BattleScene, victory?: boolean) {
|
constructor(scene: BattleScene, isVictory: boolean = false) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.victory = !!victory;
|
this.isVictory = isVictory;
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
@ -40,22 +40,22 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
|
|
||||||
// Failsafe if players somehow skip floor 200 in classic mode
|
// Failsafe if players somehow skip floor 200 in classic mode
|
||||||
if (this.scene.gameMode.isClassic && this.scene.currentBattle.waveIndex > 200) {
|
if (this.scene.gameMode.isClassic && this.scene.currentBattle.waveIndex > 200) {
|
||||||
this.victory = true;
|
this.isVictory = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Mystery Encounter special Game Over cases
|
// Handle Mystery Encounter special Game Over cases
|
||||||
// Situations such as when player lost a battle, but it isn't treated as full Game Over
|
// Situations such as when player lost a battle, but it isn't treated as full Game Over
|
||||||
if (!this.victory && this.scene.currentBattle.mysteryEncounter?.onGameOver && !this.scene.currentBattle.mysteryEncounter.onGameOver(this.scene)) {
|
if (!this.isVictory && this.scene.currentBattle.mysteryEncounter?.onGameOver && !this.scene.currentBattle.mysteryEncounter.onGameOver(this.scene)) {
|
||||||
// Do not end the game
|
// Do not end the game
|
||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
// Otherwise, continue standard Game Over logic
|
// Otherwise, continue standard Game Over logic
|
||||||
|
|
||||||
if (this.victory && this.scene.gameMode.isEndless) {
|
if (this.isVictory && this.scene.gameMode.isEndless) {
|
||||||
const genderIndex = this.scene.gameData.gender ?? PlayerGender.UNSET;
|
const genderIndex = this.scene.gameData.gender ?? PlayerGender.UNSET;
|
||||||
const genderStr = PlayerGender[genderIndex].toLowerCase();
|
const genderStr = PlayerGender[genderIndex].toLowerCase();
|
||||||
this.scene.ui.showDialogue(i18next.t("miscDialogue:ending_endless", { context: genderStr }), i18next.t("miscDialogue:ending_name"), 0, () => this.handleGameOver());
|
this.scene.ui.showDialogue(i18next.t("miscDialogue:ending_endless", { context: genderStr }), i18next.t("miscDialogue:ending_name"), 0, () => this.handleGameOver());
|
||||||
} else if (this.victory || !this.scene.enableRetries) {
|
} else if (this.isVictory || !this.scene.enableRetries) {
|
||||||
this.handleGameOver();
|
this.handleGameOver();
|
||||||
} else {
|
} else {
|
||||||
this.scene.ui.showText(i18next.t("battle:retryBattle"), null, () => {
|
this.scene.ui.showText(i18next.t("battle:retryBattle"), null, () => {
|
||||||
@ -93,7 +93,7 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
this.scene.disableMenu = true;
|
this.scene.disableMenu = true;
|
||||||
this.scene.time.delayedCall(1000, () => {
|
this.scene.time.delayedCall(1000, () => {
|
||||||
let firstClear = false;
|
let firstClear = false;
|
||||||
if (this.victory && newClear) {
|
if (this.isVictory && newClear) {
|
||||||
if (this.scene.gameMode.isClassic) {
|
if (this.scene.gameMode.isClassic) {
|
||||||
firstClear = this.scene.validateAchv(achvs.CLASSIC_VICTORY);
|
firstClear = this.scene.validateAchv(achvs.CLASSIC_VICTORY);
|
||||||
this.scene.validateAchv(achvs.UNEVOLVED_CLASSIC_VICTORY);
|
this.scene.validateAchv(achvs.UNEVOLVED_CLASSIC_VICTORY);
|
||||||
@ -109,8 +109,8 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
this.scene.gameData.gameStats.dailyRunSessionsWon++;
|
this.scene.gameData.gameStats.dailyRunSessionsWon++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.scene.gameData.saveRunHistory(this.scene, this.scene.gameData.getSessionSaveData(this.scene), this.victory);
|
this.scene.gameData.saveRunHistory(this.scene, this.scene.gameData.getSessionSaveData(this.scene), this.isVictory);
|
||||||
const fadeDuration = this.victory ? 10000 : 5000;
|
const fadeDuration = this.isVictory ? 10000 : 5000;
|
||||||
this.scene.fadeOutBgm(fadeDuration, true);
|
this.scene.fadeOutBgm(fadeDuration, true);
|
||||||
const activeBattlers = this.scene.getField().filter(p => p?.isActive(true));
|
const activeBattlers = this.scene.getField().filter(p => p?.isActive(true));
|
||||||
activeBattlers.map(p => p.hideInfo());
|
activeBattlers.map(p => p.hideInfo());
|
||||||
@ -120,7 +120,7 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
this.scene.clearPhaseQueue();
|
this.scene.clearPhaseQueue();
|
||||||
this.scene.ui.clearText();
|
this.scene.ui.clearText();
|
||||||
|
|
||||||
if (this.victory && this.scene.gameMode.isChallenge) {
|
if (this.isVictory && this.scene.gameMode.isChallenge) {
|
||||||
this.scene.gameMode.challenges.forEach(c => this.scene.validateAchvs(ChallengeAchv, c));
|
this.scene.gameMode.challenges.forEach(c => this.scene.validateAchvs(ChallengeAchv, c));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
if (newClear) {
|
if (newClear) {
|
||||||
this.handleUnlocks();
|
this.handleUnlocks();
|
||||||
}
|
}
|
||||||
if (this.victory && newClear) {
|
if (this.isVictory && newClear) {
|
||||||
for (const species of this.firstRibbons) {
|
for (const species of this.firstRibbons) {
|
||||||
this.scene.unshiftPhase(new RibbonModifierRewardPhase(this.scene, modifierTypes.VOUCHER_PLUS, species));
|
this.scene.unshiftPhase(new RibbonModifierRewardPhase(this.scene, modifierTypes.VOUCHER_PLUS, species));
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
this.end();
|
this.end();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.victory && this.scene.gameMode.isClassic) {
|
if (this.isVictory && this.scene.gameMode.isClassic) {
|
||||||
const dialogueKey = "miscDialogue:ending";
|
const dialogueKey = "miscDialogue:ending";
|
||||||
|
|
||||||
if (!this.scene.ui.shouldSkipDialogue(dialogueKey)) {
|
if (!this.scene.ui.shouldSkipDialogue(dialogueKey)) {
|
||||||
@ -173,25 +173,21 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Added a local check to see if the game is running offline on victory
|
/* Added a local check to see if the game is running offline
|
||||||
If Online, execute apiFetch as intended
|
If Online, execute apiFetch as intended
|
||||||
If Offline, execute offlineNewClear(), a localStorage implementation of newClear daily run checks */
|
If Offline, execute offlineNewClear() only for victory, a localStorage implementation of newClear daily run checks */
|
||||||
if (this.victory) {
|
|
||||||
if (!Utils.isLocal || Utils.isLocalServerConnected) {
|
if (!Utils.isLocal || Utils.isLocalServerConnected) {
|
||||||
pokerogueApi.savedata.session.newclear({ slot: this.scene.sessionSlotId, clientSessionId })
|
pokerogueApi.savedata.session.newclear({ slot: this.scene.sessionSlotId, isVictory: this.isVictory, clientSessionId: clientSessionId })
|
||||||
.then((success) => doGameOver(!!success));
|
.then((success) => doGameOver(!!success));
|
||||||
} else {
|
} else if (this.isVictory) {
|
||||||
this.scene.gameData.offlineNewClear(this.scene).then(result => {
|
this.scene.gameData.offlineNewClear(this.scene).then(result => {
|
||||||
doGameOver(result);
|
doGameOver(result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
doGameOver(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleUnlocks(): void {
|
handleUnlocks(): void {
|
||||||
if (this.victory && this.scene.gameMode.isClassic) {
|
if (this.isVictory && this.scene.gameMode.isClassic) {
|
||||||
if (!this.scene.gameData.unlocks[Unlockables.ENDLESS_MODE]) {
|
if (!this.scene.gameData.unlocks[Unlockables.ENDLESS_MODE]) {
|
||||||
this.scene.unshiftPhase(new UnlockPhase(this.scene, Unlockables.ENDLESS_MODE));
|
this.scene.unshiftPhase(new UnlockPhase(this.scene, Unlockables.ENDLESS_MODE));
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||||||
this.scene.field.add(pokemon);
|
this.scene.field.add(pokemon);
|
||||||
if (!this.player) {
|
if (!this.player) {
|
||||||
const playerPokemon = this.scene.getPlayerPokemon() as Pokemon;
|
const playerPokemon = this.scene.getPlayerPokemon() as Pokemon;
|
||||||
if (playerPokemon?.visible) {
|
if (playerPokemon?.isOnField()) {
|
||||||
this.scene.field.moveBelow(pokemon, playerPokemon);
|
this.scene.field.moveBelow(pokemon, playerPokemon);
|
||||||
}
|
}
|
||||||
this.scene.currentBattle.seenEnemyPartyMemberIds.add(pokemon.id);
|
this.scene.currentBattle.seenEnemyPartyMemberIds.add(pokemon.id);
|
||||||
@ -193,7 +193,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||||||
this.scene.field.add(pokemon);
|
this.scene.field.add(pokemon);
|
||||||
if (!this.player) {
|
if (!this.player) {
|
||||||
const playerPokemon = this.scene.getPlayerPokemon() as Pokemon;
|
const playerPokemon = this.scene.getPlayerPokemon() as Pokemon;
|
||||||
if (playerPokemon?.visible) {
|
if (playerPokemon?.isOnField()) {
|
||||||
this.scene.field.moveBelow(pokemon, playerPokemon);
|
this.scene.field.moveBelow(pokemon, playerPokemon);
|
||||||
}
|
}
|
||||||
this.scene.currentBattle.seenEnemyPartyMemberIds.add(pokemon.id);
|
this.scene.currentBattle.seenEnemyPartyMemberIds.add(pokemon.id);
|
||||||
|
@ -138,7 +138,6 @@ export class SwitchSummonPhase extends SummonPhase {
|
|||||||
switchedInPokemon.setAlpha(0.5);
|
switchedInPokemon.setAlpha(0.5);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switchedInPokemon.resetBattleData();
|
|
||||||
switchedInPokemon.resetSummonData();
|
switchedInPokemon.resetSummonData();
|
||||||
}
|
}
|
||||||
this.summon();
|
this.summon();
|
||||||
|
@ -8,7 +8,8 @@ import { Moves } from "#enums/moves";
|
|||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import GameManager from "#test/utils/gameManager";
|
import GameManager from "#test/utils/gameManager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
import { allMoves, RandomMoveAttr } from "#app/data/move";
|
||||||
|
|
||||||
// See also: TypeImmunityAbAttr
|
// See also: TypeImmunityAbAttr
|
||||||
describe("Abilities - Sap Sipper", () => {
|
describe("Abilities - Sap Sipper", () => {
|
||||||
@ -27,20 +28,20 @@ describe("Abilities - Sap Sipper", () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
game.override.battleType("single");
|
game.override.battleType("single")
|
||||||
game.override.disableCrits();
|
.disableCrits()
|
||||||
|
.ability(Abilities.SAP_SIPPER)
|
||||||
|
.enemySpecies(Species.RATTATA)
|
||||||
|
.enemyAbility(Abilities.SAP_SIPPER)
|
||||||
|
.enemyMoveset(Moves.SPLASH);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("raises ATK stat stage by 1 and block effects when activated against a grass attack", async() => {
|
it("raises ATK stat stage by 1 and block effects when activated against a grass attack", async() => {
|
||||||
const moveToUse = Moves.LEAFAGE;
|
const moveToUse = Moves.LEAFAGE;
|
||||||
const enemyAbility = Abilities.SAP_SIPPER;
|
|
||||||
|
|
||||||
game.override.moveset([ moveToUse ]);
|
game.override.moveset(moveToUse);
|
||||||
game.override.enemyMoveset(Moves.SPLASH);
|
|
||||||
game.override.enemySpecies(Species.DUSKULL);
|
|
||||||
game.override.enemyAbility(enemyAbility);
|
|
||||||
|
|
||||||
await game.startBattle();
|
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||||
|
|
||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
const initialEnemyHp = enemyPokemon.hp;
|
const initialEnemyHp = enemyPokemon.hp;
|
||||||
@ -55,14 +56,10 @@ describe("Abilities - Sap Sipper", () => {
|
|||||||
|
|
||||||
it("raises ATK stat stage by 1 and block effects when activated against a grass status move", async() => {
|
it("raises ATK stat stage by 1 and block effects when activated against a grass status move", async() => {
|
||||||
const moveToUse = Moves.SPORE;
|
const moveToUse = Moves.SPORE;
|
||||||
const enemyAbility = Abilities.SAP_SIPPER;
|
|
||||||
|
|
||||||
game.override.moveset([ moveToUse ]);
|
game.override.moveset(moveToUse);
|
||||||
game.override.enemyMoveset(Moves.SPLASH);
|
|
||||||
game.override.enemySpecies(Species.RATTATA);
|
|
||||||
game.override.enemyAbility(enemyAbility);
|
|
||||||
|
|
||||||
await game.startBattle();
|
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||||
|
|
||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
@ -76,14 +73,10 @@ describe("Abilities - Sap Sipper", () => {
|
|||||||
|
|
||||||
it("do not activate against status moves that target the field", async () => {
|
it("do not activate against status moves that target the field", async () => {
|
||||||
const moveToUse = Moves.GRASSY_TERRAIN;
|
const moveToUse = Moves.GRASSY_TERRAIN;
|
||||||
const enemyAbility = Abilities.SAP_SIPPER;
|
|
||||||
|
|
||||||
game.override.moveset([ moveToUse ]);
|
game.override.moveset(moveToUse);
|
||||||
game.override.enemyMoveset(Moves.SPLASH);
|
|
||||||
game.override.enemySpecies(Species.RATTATA);
|
|
||||||
game.override.enemyAbility(enemyAbility);
|
|
||||||
|
|
||||||
await game.startBattle();
|
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||||
|
|
||||||
game.move.select(moveToUse);
|
game.move.select(moveToUse);
|
||||||
|
|
||||||
@ -96,14 +89,10 @@ describe("Abilities - Sap Sipper", () => {
|
|||||||
|
|
||||||
it("activate once against multi-hit grass attacks", async () => {
|
it("activate once against multi-hit grass attacks", async () => {
|
||||||
const moveToUse = Moves.BULLET_SEED;
|
const moveToUse = Moves.BULLET_SEED;
|
||||||
const enemyAbility = Abilities.SAP_SIPPER;
|
|
||||||
|
|
||||||
game.override.moveset([ moveToUse ]);
|
game.override.moveset(moveToUse);
|
||||||
game.override.enemyMoveset(Moves.SPLASH);
|
|
||||||
game.override.enemySpecies(Species.RATTATA);
|
|
||||||
game.override.enemyAbility(enemyAbility);
|
|
||||||
|
|
||||||
await game.startBattle();
|
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||||
|
|
||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
const initialEnemyHp = enemyPokemon.hp;
|
const initialEnemyHp = enemyPokemon.hp;
|
||||||
@ -118,15 +107,10 @@ describe("Abilities - Sap Sipper", () => {
|
|||||||
|
|
||||||
it("do not activate against status moves that target the user", async () => {
|
it("do not activate against status moves that target the user", async () => {
|
||||||
const moveToUse = Moves.SPIKY_SHIELD;
|
const moveToUse = Moves.SPIKY_SHIELD;
|
||||||
const ability = Abilities.SAP_SIPPER;
|
|
||||||
|
|
||||||
game.override.moveset([ moveToUse ]);
|
game.override.moveset(moveToUse);
|
||||||
game.override.ability(ability);
|
|
||||||
game.override.enemyMoveset(Moves.SPLASH);
|
|
||||||
game.override.enemySpecies(Species.RATTATA);
|
|
||||||
game.override.enemyAbility(Abilities.NONE);
|
|
||||||
|
|
||||||
await game.startBattle();
|
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||||
|
|
||||||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
@ -142,18 +126,15 @@ describe("Abilities - Sap Sipper", () => {
|
|||||||
expect(game.phaseInterceptor.log).not.toContain("ShowAbilityPhase");
|
expect(game.phaseInterceptor.log).not.toContain("ShowAbilityPhase");
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO Add METRONOME outcome override
|
it("activate once against multi-hit grass attacks (metronome)", async () => {
|
||||||
// To run this testcase, manually modify the METRONOME move to always give SAP_SIPPER, then uncomment
|
|
||||||
it.todo("activate once against multi-hit grass attacks (metronome)", async () => {
|
|
||||||
const moveToUse = Moves.METRONOME;
|
const moveToUse = Moves.METRONOME;
|
||||||
const enemyAbility = Abilities.SAP_SIPPER;
|
|
||||||
|
|
||||||
game.override.moveset([ moveToUse ]);
|
const randomMoveAttr = allMoves[Moves.METRONOME].findAttr(attr => attr instanceof RandomMoveAttr) as RandomMoveAttr;
|
||||||
game.override.enemyMoveset([ Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE ]);
|
vi.spyOn(randomMoveAttr, "getMoveOverride").mockReturnValue(Moves.BULLET_SEED);
|
||||||
game.override.enemySpecies(Species.RATTATA);
|
|
||||||
game.override.enemyAbility(enemyAbility);
|
|
||||||
|
|
||||||
await game.startBattle();
|
game.override.moveset(moveToUse);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||||
|
|
||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
const initialEnemyHp = enemyPokemon.hp;
|
const initialEnemyHp = enemyPokemon.hp;
|
||||||
@ -168,11 +149,8 @@ describe("Abilities - Sap Sipper", () => {
|
|||||||
|
|
||||||
it("still activates regardless of accuracy check", async () => {
|
it("still activates regardless of accuracy check", async () => {
|
||||||
game.override.moveset(Moves.LEAF_BLADE);
|
game.override.moveset(Moves.LEAF_BLADE);
|
||||||
game.override.enemyMoveset(Moves.SPLASH);
|
|
||||||
game.override.enemySpecies(Species.MAGIKARP);
|
|
||||||
game.override.enemyAbility(Abilities.SAP_SIPPER);
|
|
||||||
|
|
||||||
await game.classicMode.startBattle();
|
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||||
|
|
||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
@ -296,7 +296,9 @@ describe("Abilities - Wimp Out", () => {
|
|||||||
Species.TYRUNT
|
Species.TYRUNT
|
||||||
]);
|
]);
|
||||||
|
|
||||||
game.move.select(Moves.SPLASH);
|
game.scene.getPlayerPokemon()!.hp *= 0.51;
|
||||||
|
|
||||||
|
game.move.select(Moves.ENDURE);
|
||||||
await game.phaseInterceptor.to("TurnEndPhase");
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
confirmNoSwitch();
|
confirmNoSwitch();
|
||||||
|
@ -4,9 +4,10 @@ import { Species } from "#enums/species";
|
|||||||
import { MoveResult, PokemonMove } from "#app/field/pokemon";
|
import { MoveResult, PokemonMove } from "#app/field/pokemon";
|
||||||
import GameManager from "#test/utils/gameManager";
|
import GameManager from "#test/utils/gameManager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import { StatusEffect } from "#app/enums/status-effect";
|
import { StatusEffect } from "#app/enums/status-effect";
|
||||||
import { BattlerIndex } from "#app/battle";
|
import { BattlerIndex } from "#app/battle";
|
||||||
|
import { allMoves, RandomMoveAttr } from "#app/data/move";
|
||||||
|
|
||||||
describe("Moves - Sketch", () => {
|
describe("Moves - Sketch", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -76,4 +77,22 @@ describe("Moves - Sketch", () => {
|
|||||||
expect(playerPokemon.moveset[0]?.moveId).toBe(Moves.SPLASH);
|
expect(playerPokemon.moveset[0]?.moveId).toBe(Moves.SPLASH);
|
||||||
expect(playerPokemon.moveset[1]?.moveId).toBe(Moves.GROWL);
|
expect(playerPokemon.moveset[1]?.moveId).toBe(Moves.GROWL);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should sketch moves that call other moves", async () => {
|
||||||
|
const randomMoveAttr = allMoves[Moves.METRONOME].findAttr(attr => attr instanceof RandomMoveAttr) as RandomMoveAttr;
|
||||||
|
vi.spyOn(randomMoveAttr, "getMoveOverride").mockReturnValue(Moves.FALSE_SWIPE);
|
||||||
|
|
||||||
|
game.override.enemyMoveset([ Moves.METRONOME ]);
|
||||||
|
await game.classicMode.startBattle([ Species.REGIELEKI ]);
|
||||||
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||||
|
playerPokemon.moveset = [ new PokemonMove(Moves.SKETCH) ];
|
||||||
|
|
||||||
|
// Opponent uses Metronome -> False Swipe, then player uses Sketch, which should sketch Metronome
|
||||||
|
game.move.select(Moves.SKETCH);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
expect(playerPokemon.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
|
||||||
|
expect(playerPokemon.moveset[0]?.moveId).toBe(Moves.METRONOME);
|
||||||
|
expect(playerPokemon.hp).toBeLessThan(playerPokemon.getMaxHp()); // Make sure opponent actually used False Swipe
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -28,7 +28,8 @@ describe("Pokerogue Session Savedata API", () => {
|
|||||||
describe("Newclear", () => {
|
describe("Newclear", () => {
|
||||||
const params: NewClearSessionSavedataRequest = {
|
const params: NewClearSessionSavedataRequest = {
|
||||||
clientSessionId: "test-session-id",
|
clientSessionId: "test-session-id",
|
||||||
slot: 3,
|
isVictory: true,
|
||||||
|
slot: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
it("should return true on SUCCESS", async () => {
|
it("should return true on SUCCESS", async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user