mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-19 06:42:20 +02:00
Merge branch 'beta' into pr-illusion
This commit is contained in:
commit
136d7b9d05
@ -96,6 +96,7 @@ import { ExpPhase } from "#app/phases/exp-phase";
|
|||||||
import { ShowPartyExpBarPhase } from "#app/phases/show-party-exp-bar-phase";
|
import { ShowPartyExpBarPhase } from "#app/phases/show-party-exp-bar-phase";
|
||||||
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
||||||
import { ExpGainsSpeed } from "#enums/exp-gains-speed";
|
import { ExpGainsSpeed } from "#enums/exp-gains-speed";
|
||||||
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#app/data/balance/starters";
|
import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#app/data/balance/starters";
|
||||||
|
|
||||||
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
|
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
|
||||||
@ -1278,6 +1279,8 @@ export default class BattleScene extends SceneBase {
|
|||||||
if (resetArenaState) {
|
if (resetArenaState) {
|
||||||
this.arena.resetArenaEffects();
|
this.arena.resetArenaEffects();
|
||||||
|
|
||||||
|
playerField.forEach((pokemon) => pokemon.lapseTag(BattlerTagType.COMMANDED));
|
||||||
|
|
||||||
playerField.forEach((pokemon, p) => {
|
playerField.forEach((pokemon, p) => {
|
||||||
if (pokemon.isOnField()) {
|
if (pokemon.isOnField()) {
|
||||||
this.pushPhase(new ReturnPhase(this, p));
|
this.pushPhase(new ReturnPhase(this, p));
|
||||||
|
@ -4,7 +4,7 @@ import { Constructor } from "#app/utils";
|
|||||||
import * as Utils from "../utils";
|
import * as Utils from "../utils";
|
||||||
import { getPokemonNameWithAffix } from "../messages";
|
import { getPokemonNameWithAffix } from "../messages";
|
||||||
import { Weather, WeatherType } from "./weather";
|
import { Weather, WeatherType } from "./weather";
|
||||||
import { BattlerTag, GroundedTag } from "./battler-tags";
|
import { BattlerTag, BattlerTagLapseType, GroundedTag } from "./battler-tags";
|
||||||
import { StatusEffect, getNonVolatileStatusEffects, getStatusEffectDescriptor, getStatusEffectHealText } from "./status-effect";
|
import { StatusEffect, getNonVolatileStatusEffects, getStatusEffectDescriptor, getStatusEffectHealText } from "./status-effect";
|
||||||
import { Gender } from "./gender";
|
import { Gender } from "./gender";
|
||||||
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, FlinchAttr, OneHitKOAttr, HitHealAttr, allMoves, StatusMove, SelfStatusMove, VariablePowerAttr, applyMoveAttrs, IncrementMovePriorityAttr, VariableMoveTypeAttr, RandomMovesetMoveAttr, RandomMoveAttr, NaturePowerAttr, CopyMoveAttr, MoveAttr, MultiHitAttr, SacrificialAttr, SacrificialAttrOnHit, NeutralDamageAgainstFlyingTypeMultiplierAttr, FixedDamageAttr } from "./move";
|
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, FlinchAttr, OneHitKOAttr, HitHealAttr, allMoves, StatusMove, SelfStatusMove, VariablePowerAttr, applyMoveAttrs, IncrementMovePriorityAttr, VariableMoveTypeAttr, RandomMovesetMoveAttr, RandomMoveAttr, NaturePowerAttr, CopyMoveAttr, MoveAttr, MultiHitAttr, SacrificialAttr, SacrificialAttrOnHit, NeutralDamageAgainstFlyingTypeMultiplierAttr, FixedDamageAttr } from "./move";
|
||||||
@ -35,6 +35,7 @@ import { SwitchSummonPhase } from "#app/phases/switch-summon-phase";
|
|||||||
import { BattleEndPhase } from "#app/phases/battle-end-phase";
|
import { BattleEndPhase } from "#app/phases/battle-end-phase";
|
||||||
import { NewBattlePhase } from "#app/phases/new-battle-phase";
|
import { NewBattlePhase } from "#app/phases/new-battle-phase";
|
||||||
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
||||||
|
import { PokemonAnimType } from "#enums/pokemon-anim-type";
|
||||||
|
|
||||||
export class Ability implements Localizable {
|
export class Ability implements Localizable {
|
||||||
public id: Abilities;
|
public id: Abilities;
|
||||||
@ -511,7 +512,11 @@ export class NonSuperEffectiveImmunityAbAttr extends TypeImmunityAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
applyPreDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
applyPreDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||||
if (move instanceof AttackMove && pokemon.getAttackTypeEffectiveness(attacker.getMoveType(move), attacker) < 2) {
|
const modifierValue = args.length > 0
|
||||||
|
? (args[0] as Utils.NumberHolder).value
|
||||||
|
: pokemon.getAttackTypeEffectiveness(attacker.getMoveType(move), attacker);
|
||||||
|
|
||||||
|
if (move instanceof AttackMove && modifierValue < 2) {
|
||||||
cancelled.value = true; // Suppresses "No Effect" message
|
cancelled.value = true; // Suppresses "No Effect" message
|
||||||
(args[0] as Utils.NumberHolder).value = 0;
|
(args[0] as Utils.NumberHolder).value = 0;
|
||||||
return true;
|
return true;
|
||||||
@ -2605,6 +2610,42 @@ export class PostSummonFormChangeByWeatherAbAttr extends PostSummonAbAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute implementing the effects of {@link https://bulbapedia.bulbagarden.net/wiki/Commander_(Ability) | Commander}.
|
||||||
|
* When the source of an ability with this attribute detects a Dondozo as their active ally, the source "jumps
|
||||||
|
* into the Dondozo's mouth," sharply boosting the Dondozo's stats, cancelling the source's moves, and
|
||||||
|
* causing attacks that target the source to always miss.
|
||||||
|
*/
|
||||||
|
export class CommanderAbAttr extends AbAttr {
|
||||||
|
constructor() {
|
||||||
|
super(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: null, args: any[]): boolean {
|
||||||
|
// TODO: Should this work with X + Dondozo fusions?
|
||||||
|
if (pokemon.scene.currentBattle?.double && pokemon.getAlly()?.species.speciesId === Species.DONDOZO) {
|
||||||
|
// If the ally Dondozo is fainted or was previously "commanded" by
|
||||||
|
// another Pokemon, this effect cannot apply.
|
||||||
|
if (pokemon.getAlly().isFainted() || pokemon.getAlly().getTag(BattlerTagType.COMMANDED)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!simulated) {
|
||||||
|
// Lapse the source's semi-invulnerable tags (to avoid visual inconsistencies)
|
||||||
|
pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT);
|
||||||
|
// Play an animation of the source jumping into the ally Dondozo's mouth
|
||||||
|
pokemon.scene.triggerPokemonBattleAnim(pokemon, PokemonAnimType.COMMANDER_APPLY);
|
||||||
|
// Apply boosts from this effect to the ally Dondozo
|
||||||
|
pokemon.getAlly().addTag(BattlerTagType.COMMANDED, 0, Moves.NONE, pokemon.id);
|
||||||
|
// Cancel the source Pokemon's next move (if a move is queued)
|
||||||
|
pokemon.scene.tryRemovePhase((phase) => phase instanceof MovePhase && phase.pokemon === pokemon);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class PreSwitchOutAbAttr extends AbAttr {
|
export class PreSwitchOutAbAttr extends AbAttr {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(true);
|
super(true);
|
||||||
@ -6219,7 +6260,8 @@ export function initAbilities() {
|
|||||||
.attr(NoFusionAbilityAbAttr)
|
.attr(NoFusionAbilityAbAttr)
|
||||||
.attr(UncopiableAbilityAbAttr)
|
.attr(UncopiableAbilityAbAttr)
|
||||||
.attr(UnswappableAbilityAbAttr)
|
.attr(UnswappableAbilityAbAttr)
|
||||||
.bypassFaint(),
|
.bypassFaint()
|
||||||
|
.edgeCase(), // Soft-locks the game if a form-changed Cramorant and its attacker both faint at the same time (ex. using Self-Destruct)
|
||||||
new Ability(Abilities.STALWART, 8)
|
new Ability(Abilities.STALWART, 8)
|
||||||
.attr(BlockRedirectAbAttr),
|
.attr(BlockRedirectAbAttr),
|
||||||
new Ability(Abilities.STEAM_ENGINE, 8)
|
new Ability(Abilities.STEAM_ENGINE, 8)
|
||||||
@ -6363,9 +6405,11 @@ export function initAbilities() {
|
|||||||
.attr(PreSwitchOutFormChangeAbAttr, (pokemon) => !pokemon.isFainted() ? 1 : pokemon.formIndex)
|
.attr(PreSwitchOutFormChangeAbAttr, (pokemon) => !pokemon.isFainted() ? 1 : pokemon.formIndex)
|
||||||
.bypassFaint(),
|
.bypassFaint(),
|
||||||
new Ability(Abilities.COMMANDER, 9)
|
new Ability(Abilities.COMMANDER, 9)
|
||||||
|
.attr(CommanderAbAttr)
|
||||||
|
.attr(DoubleBattleChanceAbAttr)
|
||||||
.attr(UncopiableAbilityAbAttr)
|
.attr(UncopiableAbilityAbAttr)
|
||||||
.attr(UnswappableAbilityAbAttr)
|
.attr(UnswappableAbilityAbAttr)
|
||||||
.unimplemented(),
|
.edgeCase(), // Encore, Frenzy, and other non-`TURN_END` tags don't lapse correctly on the commanding Pokemon.
|
||||||
new Ability(Abilities.ELECTROMORPHOSIS, 9)
|
new Ability(Abilities.ELECTROMORPHOSIS, 9)
|
||||||
.attr(PostDefendApplyBattlerTagAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattlerTagType.CHARGED),
|
.attr(PostDefendApplyBattlerTagAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattlerTagType.CHARGED),
|
||||||
new Ability(Abilities.PROTOSYNTHESIS, 9)
|
new Ability(Abilities.PROTOSYNTHESIS, 9)
|
||||||
|
@ -2091,6 +2091,37 @@ export class IceFaceBlockDamageTag extends FormBlockDamageTag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Battler tag indicating a Tatsugiri with {@link https://bulbapedia.bulbagarden.net/wiki/Commander_(Ability) | Commander}
|
||||||
|
* has entered the tagged Pokemon's mouth.
|
||||||
|
*/
|
||||||
|
export class CommandedTag extends BattlerTag {
|
||||||
|
private _tatsugiriFormKey: string;
|
||||||
|
|
||||||
|
constructor(sourceId: number) {
|
||||||
|
super(BattlerTagType.COMMANDED, BattlerTagLapseType.CUSTOM, 0, Moves.NONE, sourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public get tatsugiriFormKey(): string {
|
||||||
|
return this._tatsugiriFormKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Caches the Tatsugiri's form key and sharply boosts the tagged Pokemon's stats */
|
||||||
|
override onAdd(pokemon: Pokemon): void {
|
||||||
|
this._tatsugiriFormKey = this.getSourcePokemon(pokemon.scene)?.getFormKey() ?? "curly";
|
||||||
|
pokemon.scene.unshiftPhase(new StatStageChangePhase(
|
||||||
|
pokemon.scene, pokemon.getBattlerIndex(), true, [ Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.SPD ], 2
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Triggers an {@linkcode PokemonAnimType | animation} of the tagged Pokemon "spitting out" Tatsugiri */
|
||||||
|
override onRemove(pokemon: Pokemon): void {
|
||||||
|
if (this.getSourcePokemon(pokemon.scene)?.isActive(true)) {
|
||||||
|
pokemon.scene.triggerPokemonBattleAnim(pokemon, PokemonAnimType.COMMANDER_REMOVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Battler tag enabling the Stockpile mechanic. This tag handles:
|
* Battler tag enabling the Stockpile mechanic. This tag handles:
|
||||||
* - Stack tracking, including max limit enforcement (which is replicated in Stockpile for redundancy).
|
* - Stack tracking, including max limit enforcement (which is replicated in Stockpile for redundancy).
|
||||||
@ -2796,6 +2827,45 @@ export class PowerTrickTag extends BattlerTag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tag associated with the move Grudge.
|
||||||
|
* If this tag is active when the bearer faints from an opponent's move, the tag reduces that move's PP to 0.
|
||||||
|
* Otherwise, it lapses when the bearer makes another move.
|
||||||
|
*/
|
||||||
|
export class GrudgeTag extends BattlerTag {
|
||||||
|
constructor() {
|
||||||
|
super(BattlerTagType.GRUDGE, [ BattlerTagLapseType.CUSTOM, BattlerTagLapseType.PRE_MOVE ], 1, Moves.GRUDGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
onAdd(pokemon: Pokemon) {
|
||||||
|
super.onAdd(pokemon);
|
||||||
|
pokemon.scene.queueMessage(i18next.t("battlerTags:grudgeOnAdd", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activates Grudge's special effect on the attacking Pokemon and lapses the tag.
|
||||||
|
* @param pokemon
|
||||||
|
* @param lapseType
|
||||||
|
* @param sourcePokemon {@linkcode Pokemon} the source of the move that fainted the tag's bearer
|
||||||
|
* @returns `false` if Grudge activates its effect or lapses
|
||||||
|
*/
|
||||||
|
override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType, sourcePokemon?: Pokemon): boolean {
|
||||||
|
if (lapseType === BattlerTagLapseType.CUSTOM && sourcePokemon) {
|
||||||
|
if (sourcePokemon.isActive() && pokemon.isOpponent(sourcePokemon)) {
|
||||||
|
const lastMove = pokemon.turnData.attacksReceived[0];
|
||||||
|
const lastMoveData = sourcePokemon.getMoveset().find(m => m?.moveId === lastMove.move);
|
||||||
|
if (lastMoveData && lastMove.move !== Moves.STRUGGLE) {
|
||||||
|
lastMoveData.ppUsed = lastMoveData.getMovePp();
|
||||||
|
pokemon.scene.queueMessage(i18next.t("battlerTags:grudgeLapse", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), moveName: lastMoveData.getName() }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return super.lapse(pokemon, lapseType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a {@linkcode BattlerTag} based on the provided tag type, turn count, source move, and source ID.
|
* Retrieves a {@linkcode BattlerTag} based on the provided tag type, turn count, source move, and source ID.
|
||||||
* @param sourceId - The ID of the pokemon adding the tag
|
* @param sourceId - The ID of the pokemon adding the tag
|
||||||
@ -2932,6 +3002,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
|
|||||||
return new IceFaceBlockDamageTag(tagType);
|
return new IceFaceBlockDamageTag(tagType);
|
||||||
case BattlerTagType.DISGUISE:
|
case BattlerTagType.DISGUISE:
|
||||||
return new FormBlockDamageTag(tagType);
|
return new FormBlockDamageTag(tagType);
|
||||||
|
case BattlerTagType.COMMANDED:
|
||||||
|
return new CommandedTag(sourceId);
|
||||||
case BattlerTagType.STOCKPILING:
|
case BattlerTagType.STOCKPILING:
|
||||||
return new StockpilingTag(sourceMove);
|
return new StockpilingTag(sourceMove);
|
||||||
case BattlerTagType.OCTOLOCK:
|
case BattlerTagType.OCTOLOCK:
|
||||||
@ -2975,6 +3047,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
|
|||||||
return new TelekinesisTag(sourceMove);
|
return new TelekinesisTag(sourceMove);
|
||||||
case BattlerTagType.POWER_TRICK:
|
case BattlerTagType.POWER_TRICK:
|
||||||
return new PowerTrickTag(sourceMove, sourceId);
|
return new PowerTrickTag(sourceMove, sourceId);
|
||||||
|
case BattlerTagType.GRUDGE:
|
||||||
|
return new GrudgeTag();
|
||||||
case BattlerTagType.NONE:
|
case BattlerTagType.NONE:
|
||||||
default:
|
default:
|
||||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { ChargeAnim, initMoveAnim, loadMoveAnimAssets, MoveChargeAnim } from "./battle-anims";
|
import { ChargeAnim, initMoveAnim, loadMoveAnimAssets, MoveChargeAnim } from "./battle-anims";
|
||||||
import { EncoreTag, GulpMissileTag, HelpingHandTag, SemiInvulnerableTag, ShellTrapTag, StockpilingTag, SubstituteTag, TrappedTag, TypeBoostTag } from "./battler-tags";
|
import { CommandedTag, EncoreTag, GulpMissileTag, HelpingHandTag, SemiInvulnerableTag, ShellTrapTag, StockpilingTag, SubstituteTag, TrappedTag, TypeBoostTag } from "./battler-tags";
|
||||||
import { getPokemonNameWithAffix } from "../messages";
|
import { getPokemonNameWithAffix } from "../messages";
|
||||||
import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon";
|
import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon";
|
||||||
import { getNonVolatileStatusEffects, getStatusEffectHealText, isNonVolatileStatusEffect, StatusEffect } from "./status-effect";
|
import { getNonVolatileStatusEffects, getStatusEffectHealText, isNonVolatileStatusEffect, StatusEffect } from "./status-effect";
|
||||||
@ -714,6 +714,10 @@ export default class Move implements Localizable {
|
|||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
||||||
let score = 0;
|
let score = 0;
|
||||||
|
|
||||||
|
if (target.getAlly()?.getTag(BattlerTagType.COMMANDED)?.getSourcePokemon(target.scene) === target) {
|
||||||
|
return 20 * (target.isPlayer() === user.isPlayer() ? -1 : 1); // always -20 with how the AI handles this score
|
||||||
|
}
|
||||||
|
|
||||||
for (const attr of this.attrs) {
|
for (const attr of this.attrs) {
|
||||||
// conditionals to check if the move is self targeting (if so then you are applying the move to yourself, not the target)
|
// conditionals to check if the move is self targeting (if so then you are applying the move to yourself, not the target)
|
||||||
score += attr.getTargetBenefitScore(user, !attr.selfTarget ? target : user, move) * (target !== user && attr.selfTarget ? -1 : 1);
|
score += attr.getTargetBenefitScore(user, !attr.selfTarget ? target : user, move) * (target !== user && attr.selfTarget ? -1 : 1);
|
||||||
@ -3245,6 +3249,41 @@ export class CutHpStatStageBoostAttr extends StatStageChangeAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute implementing the stat boosting effect of {@link https://bulbapedia.bulbagarden.net/wiki/Order_Up_(move) | Order Up}.
|
||||||
|
* If the user has a Pokemon with {@link https://bulbapedia.bulbagarden.net/wiki/Commander_(Ability) | Commander} in their mouth,
|
||||||
|
* one of the user's stats are increased by 1 stage, depending on the "commanding" Pokemon's form. This effect does not respect
|
||||||
|
* effect chance, but Order Up itself may be boosted by Sheer Force.
|
||||||
|
*/
|
||||||
|
export class OrderUpStatBoostAttr extends MoveEffectAttr {
|
||||||
|
constructor() {
|
||||||
|
super(true, { trigger: MoveEffectTrigger.HIT });
|
||||||
|
}
|
||||||
|
|
||||||
|
override apply(user: Pokemon, target: Pokemon, move: Move, args?: any[]): boolean {
|
||||||
|
const commandedTag = user.getTag(CommandedTag);
|
||||||
|
if (!commandedTag) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let increasedStat: EffectiveStat = Stat.ATK;
|
||||||
|
switch (commandedTag.tatsugiriFormKey) {
|
||||||
|
case "curly":
|
||||||
|
increasedStat = Stat.ATK;
|
||||||
|
break;
|
||||||
|
case "droopy":
|
||||||
|
increasedStat = Stat.DEF;
|
||||||
|
break;
|
||||||
|
case "stretchy":
|
||||||
|
increasedStat = Stat.SPD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
user.scene.unshiftPhase(new StatStageChangePhase(user.scene, user.getBattlerIndex(), this.selfTarget, [ increasedStat ], 1));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class CopyStatsAttr extends MoveEffectAttr {
|
export class CopyStatsAttr extends MoveEffectAttr {
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
if (!super.apply(user, target, move, args)) {
|
if (!super.apply(user, target, move, args)) {
|
||||||
@ -5852,7 +5891,13 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The {@linkcode Pokemon} to be switched out with this effect */
|
||||||
const switchOutTarget = this.selfSwitch ? user : target;
|
const switchOutTarget = this.selfSwitch ? user : target;
|
||||||
|
|
||||||
|
// If the switch-out target is a Dondozo with a Tatsugiri in its mouth
|
||||||
|
// (e.g. when it uses Flip Turn), make it spit out the Tatsugiri before switching out.
|
||||||
|
switchOutTarget.lapseTag(BattlerTagType.COMMANDED);
|
||||||
|
|
||||||
if (switchOutTarget instanceof PlayerPokemon) {
|
if (switchOutTarget instanceof PlayerPokemon) {
|
||||||
/**
|
/**
|
||||||
* Check if Wimp Out/Emergency Exit activates due to being hit by U-turn or Volt Switch
|
* Check if Wimp Out/Emergency Exit activates due to being hit by U-turn or Volt Switch
|
||||||
@ -5955,6 +6000,12 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dondozo with an allied Tatsugiri in its mouth cannot be forced out
|
||||||
|
const commandedTag = switchOutTarget.getTag(BattlerTagType.COMMANDED);
|
||||||
|
if (commandedTag?.getSourcePokemon(switchOutTarget.scene)?.isActive(true)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!player && user.scene.currentBattle.isBattleMysteryEncounter() && !user.scene.currentBattle.mysteryEncounter?.fleeAllowed) {
|
if (!player && user.scene.currentBattle.isBattleMysteryEncounter() && !user.scene.currentBattle.mysteryEncounter?.fleeAllowed) {
|
||||||
// Don't allow wild opponents to be force switched during MEs with flee disabled
|
// Don't allow wild opponents to be force switched during MEs with flee disabled
|
||||||
return false;
|
return false;
|
||||||
@ -8440,7 +8491,7 @@ export function initMoves() {
|
|||||||
.attr(HealStatusEffectAttr, true, StatusEffect.PARALYSIS, StatusEffect.POISON, StatusEffect.TOXIC, StatusEffect.BURN)
|
.attr(HealStatusEffectAttr, true, StatusEffect.PARALYSIS, StatusEffect.POISON, StatusEffect.TOXIC, StatusEffect.BURN)
|
||||||
.condition((user, target, move) => !!user.status && (user.status.effect === StatusEffect.PARALYSIS || user.status.effect === StatusEffect.POISON || user.status.effect === StatusEffect.TOXIC || user.status.effect === StatusEffect.BURN)),
|
.condition((user, target, move) => !!user.status && (user.status.effect === StatusEffect.PARALYSIS || user.status.effect === StatusEffect.POISON || user.status.effect === StatusEffect.TOXIC || user.status.effect === StatusEffect.BURN)),
|
||||||
new SelfStatusMove(Moves.GRUDGE, Type.GHOST, -1, 5, -1, 0, 3)
|
new SelfStatusMove(Moves.GRUDGE, Type.GHOST, -1, 5, -1, 0, 3)
|
||||||
.unimplemented(),
|
.attr(AddBattlerTagAttr, BattlerTagType.GRUDGE, true, undefined, 1),
|
||||||
new SelfStatusMove(Moves.SNATCH, Type.DARK, -1, 10, -1, 4, 3)
|
new SelfStatusMove(Moves.SNATCH, Type.DARK, -1, 10, -1, 4, 3)
|
||||||
.unimplemented(),
|
.unimplemented(),
|
||||||
new AttackMove(Moves.SECRET_POWER, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 20, 30, 0, 3)
|
new AttackMove(Moves.SECRET_POWER, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 20, 30, 0, 3)
|
||||||
@ -10302,8 +10353,8 @@ export function initMoves() {
|
|||||||
new AttackMove(Moves.LUMINA_CRASH, Type.PSYCHIC, MoveCategory.SPECIAL, 80, 100, 10, 100, 0, 9)
|
new AttackMove(Moves.LUMINA_CRASH, Type.PSYCHIC, MoveCategory.SPECIAL, 80, 100, 10, 100, 0, 9)
|
||||||
.attr(StatStageChangeAttr, [ Stat.SPDEF ], -2),
|
.attr(StatStageChangeAttr, [ Stat.SPDEF ], -2),
|
||||||
new AttackMove(Moves.ORDER_UP, Type.DRAGON, MoveCategory.PHYSICAL, 80, 100, 10, 100, 0, 9)
|
new AttackMove(Moves.ORDER_UP, Type.DRAGON, MoveCategory.PHYSICAL, 80, 100, 10, 100, 0, 9)
|
||||||
.makesContact(false)
|
.attr(OrderUpStatBoostAttr)
|
||||||
.partial(), // No effect implemented (requires Commander)
|
.makesContact(false),
|
||||||
new AttackMove(Moves.JET_PUNCH, Type.WATER, MoveCategory.PHYSICAL, 60, 100, 15, -1, 1, 9)
|
new AttackMove(Moves.JET_PUNCH, Type.WATER, MoveCategory.PHYSICAL, 60, 100, 15, -1, 1, 9)
|
||||||
.punchingMove(),
|
.punchingMove(),
|
||||||
new StatusMove(Moves.SPICY_EXTRACT, Type.GRASS, -1, 15, -1, 0, 9)
|
new StatusMove(Moves.SPICY_EXTRACT, Type.GRASS, -1, 15, -1, 0, 9)
|
||||||
|
@ -367,10 +367,11 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
|||||||
})
|
})
|
||||||
.withOptionPhase(async (scene: BattleScene) => {
|
.withOptionPhase(async (scene: BattleScene) => {
|
||||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||||
const modifier = encounter.misc.chosenModifier;
|
const modifier = encounter.misc.chosenModifier as PokemonHeldItemModifier;
|
||||||
|
const party = scene.getPlayerParty();
|
||||||
|
|
||||||
// Check tier of the traded item, the received item will be one tier up
|
// Check tier of the traded item, the received item will be one tier up
|
||||||
const type = modifier.type.withTierFromPool();
|
const type = modifier.type.withTierFromPool(ModifierPoolType.PLAYER, party);
|
||||||
let tier = type.tier ?? ModifierTier.GREAT;
|
let tier = type.tier ?? ModifierTier.GREAT;
|
||||||
// Eggs and White Herb are not in the pool
|
// Eggs and White Herb are not in the pool
|
||||||
if (type.id === "WHITE_HERB") {
|
if (type.id === "WHITE_HERB") {
|
||||||
@ -385,11 +386,11 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
|||||||
tier++;
|
tier++;
|
||||||
}
|
}
|
||||||
|
|
||||||
regenerateModifierPoolThresholds(scene.getPlayerParty(), ModifierPoolType.PLAYER, 0);
|
regenerateModifierPoolThresholds(party, ModifierPoolType.PLAYER, 0);
|
||||||
let item: ModifierTypeOption | null = null;
|
let item: ModifierTypeOption | null = null;
|
||||||
// TMs excluded from possible rewards
|
// TMs excluded from possible rewards
|
||||||
while (!item || item.type.id.includes("TM_")) {
|
while (!item || item.type.id.includes("TM_")) {
|
||||||
item = getPlayerModifierTypeOptions(1, scene.getPlayerParty(), [], { guaranteedModifierTiers: [ tier ], allowLuckUpgrades: false })[0];
|
item = getPlayerModifierTypeOptions(1, party, [], { guaranteedModifierTiers: [ tier ], allowLuckUpgrades: false })[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
encounter.setDialogueToken("itemName", item.type.name);
|
encounter.setDialogueToken("itemName", item.type.name);
|
||||||
|
@ -23,6 +23,7 @@ import { ReturnPhase } from "#app/phases/return-phase";
|
|||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||||
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
|
|
||||||
/** the i18n namespace for the encounter */
|
/** the i18n namespace for the encounter */
|
||||||
const namespace = "mysteryEncounters/theWinstrateChallenge";
|
const namespace = "mysteryEncounters/theWinstrateChallenge";
|
||||||
@ -187,6 +188,7 @@ function endTrainerBattleAndShowDialogue(scene: BattleScene): Promise<void> {
|
|||||||
} else {
|
} else {
|
||||||
scene.arena.resetArenaEffects();
|
scene.arena.resetArenaEffects();
|
||||||
const playerField = scene.getPlayerField();
|
const playerField = scene.getPlayerField();
|
||||||
|
playerField.forEach((pokemon) => pokemon.lapseTag(BattlerTagType.COMMANDED));
|
||||||
playerField.forEach((_, p) => scene.unshiftPhase(new ReturnPhase(scene, p)));
|
playerField.forEach((_, p) => scene.unshiftPhase(new ReturnPhase(scene, p)));
|
||||||
|
|
||||||
for (const pokemon of scene.getPlayerParty()) {
|
for (const pokemon of scene.getPlayerParty()) {
|
||||||
|
@ -88,5 +88,7 @@ export enum BattlerTagType {
|
|||||||
IMPRISON = "IMPRISON",
|
IMPRISON = "IMPRISON",
|
||||||
SYRUP_BOMB = "SYRUP_BOMB",
|
SYRUP_BOMB = "SYRUP_BOMB",
|
||||||
ELECTRIFIED = "ELECTRIFIED",
|
ELECTRIFIED = "ELECTRIFIED",
|
||||||
TELEKINESIS = "TELEKINESIS"
|
TELEKINESIS = "TELEKINESIS",
|
||||||
|
COMMANDED = "COMMANDED",
|
||||||
|
GRUDGE = "GRUDGE"
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,15 @@ export enum PokemonAnimType {
|
|||||||
* Removes a Pokemon's Substitute doll from the field.
|
* Removes a Pokemon's Substitute doll from the field.
|
||||||
* The Pokemon then moves back to its original position.
|
* The Pokemon then moves back to its original position.
|
||||||
*/
|
*/
|
||||||
SUBSTITUTE_REMOVE
|
SUBSTITUTE_REMOVE,
|
||||||
|
/**
|
||||||
|
* Brings Tatsugiri and Dondozo to the center of the field, with
|
||||||
|
* Tatsugiri jumping into the Dondozo's mouth
|
||||||
|
*/
|
||||||
|
COMMANDER_APPLY,
|
||||||
|
/**
|
||||||
|
* Dondozo "spits out" Tatsugiri, moving Tatsugiri back to its original
|
||||||
|
* field position.
|
||||||
|
*/
|
||||||
|
COMMANDER_REMOVE
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import Move, { HighCritAttr, HitsTagAttr, applyMoveAttrs, FixedDamageAttr, Varia
|
|||||||
import { default as PokemonSpecies, PokemonSpeciesForm, getFusedSpeciesName, getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species";
|
import { default as PokemonSpecies, PokemonSpeciesForm, getFusedSpeciesName, getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species";
|
||||||
import { CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER, getStarterValueFriendshipCap, speciesStarterCosts } from "#app/data/balance/starters";
|
import { CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER, getStarterValueFriendshipCap, speciesStarterCosts } from "#app/data/balance/starters";
|
||||||
import { starterPassiveAbilities } from "#app/data/balance/passives";
|
import { starterPassiveAbilities } from "#app/data/balance/passives";
|
||||||
import { Constructor, isNullOrUndefined, randSeedInt } from "#app/utils";
|
import { Constructor, isNullOrUndefined, randSeedInt, type nil } from "#app/utils";
|
||||||
import * as Utils from "#app/utils";
|
import * as Utils from "#app/utils";
|
||||||
import { Type, TypeDamageMultiplier, getTypeDamageMultiplier, getTypeRgb } from "#app/data/type";
|
import { Type, TypeDamageMultiplier, getTypeDamageMultiplier, getTypeRgb } from "#app/data/type";
|
||||||
import { getLevelTotalExp } from "#app/data/exp";
|
import { getLevelTotalExp } from "#app/data/exp";
|
||||||
@ -1738,6 +1738,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @returns `true` if the pokemon is trapped
|
* @returns `true` if the pokemon is trapped
|
||||||
*/
|
*/
|
||||||
public isTrapped(trappedAbMessages: string[] = [], simulated: boolean = true): boolean {
|
public isTrapped(trappedAbMessages: string[] = [], simulated: boolean = true): boolean {
|
||||||
|
const commandedTag = this.getTag(BattlerTagType.COMMANDED);
|
||||||
|
if (commandedTag?.getSourcePokemon(this.scene)?.isActive(true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isOfType(Type.GHOST)) {
|
if (this.isOfType(Type.GHOST)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -3014,6 +3019,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
// In case of fatal damage, this tag would have gotten cleared before we could lapse it.
|
// In case of fatal damage, this tag would have gotten cleared before we could lapse it.
|
||||||
const destinyTag = this.getTag(BattlerTagType.DESTINY_BOND);
|
const destinyTag = this.getTag(BattlerTagType.DESTINY_BOND);
|
||||||
|
const grudgeTag = this.getTag(BattlerTagType.GRUDGE);
|
||||||
|
|
||||||
const isOneHitKo = result === HitResult.ONE_HIT_KO;
|
const isOneHitKo = result === HitResult.ONE_HIT_KO;
|
||||||
|
|
||||||
@ -3085,13 +3091,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
if (this.isFainted()) {
|
if (this.isFainted()) {
|
||||||
// set splice index here, so future scene queues happen before FaintedPhase
|
// set splice index here, so future scene queues happen before FaintedPhase
|
||||||
this.scene.setPhaseQueueSplice();
|
this.scene.setPhaseQueueSplice();
|
||||||
if (!isNullOrUndefined(destinyTag) && dmg) {
|
this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex(), isOneHitKo, destinyTag, grudgeTag, source));
|
||||||
// Destiny Bond will activate during FaintPhase
|
|
||||||
this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex(), isOneHitKo, destinyTag, source));
|
|
||||||
} else {
|
|
||||||
this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex(), isOneHitKo));
|
|
||||||
}
|
|
||||||
this.destroySubstitute();
|
this.destroySubstitute();
|
||||||
|
this.lapseTag(BattlerTagType.COMMANDED);
|
||||||
this.resetSummonData();
|
this.resetSummonData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3140,6 +3143,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.scene.setPhaseQueueSplice();
|
this.scene.setPhaseQueueSplice();
|
||||||
this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex(), preventEndure));
|
this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex(), preventEndure));
|
||||||
this.destroySubstitute();
|
this.destroySubstitute();
|
||||||
|
this.lapseTag(BattlerTagType.COMMANDED);
|
||||||
this.resetSummonData();
|
this.resetSummonData();
|
||||||
}
|
}
|
||||||
return damage;
|
return damage;
|
||||||
@ -3222,19 +3226,19 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @overload */
|
/** @overload */
|
||||||
getTag(tagType: BattlerTagType): BattlerTag | null;
|
getTag(tagType: BattlerTagType): BattlerTag | nil;
|
||||||
|
|
||||||
/** @overload */
|
/** @overload */
|
||||||
getTag<T extends BattlerTag>(tagType: Constructor<T>): T | null;
|
getTag<T extends BattlerTag>(tagType: Constructor<T>): T | nil;
|
||||||
|
|
||||||
getTag(tagType: BattlerTagType | Constructor<BattlerTag>): BattlerTag | null {
|
getTag(tagType: BattlerTagType | Constructor<BattlerTag>): BattlerTag | nil {
|
||||||
if (!this.summonData) {
|
if (!this.summonData) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (tagType instanceof Function
|
return (tagType instanceof Function
|
||||||
? this.summonData.tags.find(t => t instanceof tagType)
|
? this.summonData.tags.find(t => t instanceof tagType)
|
||||||
: this.summonData.tags.find(t => t.tagType === tagType)
|
: this.summonData.tags.find(t => t.tagType === tagType)
|
||||||
)!; // TODO: is this bang correct?
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
findTag(tagFilter: ((tag: BattlerTag) => boolean)) {
|
findTag(tagFilter: ((tag: BattlerTag) => boolean)) {
|
||||||
|
@ -31,6 +31,7 @@ import i18next from "i18next";
|
|||||||
import { type DoubleBattleChanceBoosterModifierType, type EvolutionItemModifierType, type FormChangeItemModifierType, type ModifierOverride, type ModifierType, type PokemonBaseStatTotalModifierType, type PokemonExpBoosterModifierType, type PokemonFriendshipBoosterModifierType, type PokemonMoveAccuracyBoosterModifierType, type PokemonMultiHitModifierType, type TerastallizeModifierType, type TmModifierType, getModifierType, ModifierPoolType, ModifierTypeGenerator, modifierTypes, PokemonHeldItemModifierType } from "./modifier-type";
|
import { type DoubleBattleChanceBoosterModifierType, type EvolutionItemModifierType, type FormChangeItemModifierType, type ModifierOverride, type ModifierType, type PokemonBaseStatTotalModifierType, type PokemonExpBoosterModifierType, type PokemonFriendshipBoosterModifierType, type PokemonMoveAccuracyBoosterModifierType, type PokemonMultiHitModifierType, type TerastallizeModifierType, type TmModifierType, getModifierType, ModifierPoolType, ModifierTypeGenerator, modifierTypes, PokemonHeldItemModifierType } from "./modifier-type";
|
||||||
import { Color, ShadowColor } from "#enums/color";
|
import { Color, ShadowColor } from "#enums/color";
|
||||||
import { FRIENDSHIP_GAIN_FROM_RARE_CANDY } from "#app/data/balance/starters";
|
import { FRIENDSHIP_GAIN_FROM_RARE_CANDY } from "#app/data/balance/starters";
|
||||||
|
import { applyAbAttrs, CommanderAbAttr } from "#app/data/ability";
|
||||||
|
|
||||||
export type ModifierPredicate = (modifier: Modifier) => boolean;
|
export type ModifierPredicate = (modifier: Modifier) => boolean;
|
||||||
|
|
||||||
@ -1937,10 +1938,16 @@ export class PokemonInstantReviveModifier extends PokemonHeldItemModifier {
|
|||||||
* @returns always `true`
|
* @returns always `true`
|
||||||
*/
|
*/
|
||||||
override apply(pokemon: Pokemon): boolean {
|
override apply(pokemon: Pokemon): boolean {
|
||||||
|
// Restore the Pokemon to half HP
|
||||||
pokemon.scene.unshiftPhase(new PokemonHealPhase(pokemon.scene, pokemon.getBattlerIndex(),
|
pokemon.scene.unshiftPhase(new PokemonHealPhase(pokemon.scene, pokemon.getBattlerIndex(),
|
||||||
toDmgValue(pokemon.getMaxHp() / 2), i18next.t("modifier:pokemonInstantReviveApply", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), typeName: this.type.name }), false, false, true));
|
toDmgValue(pokemon.getMaxHp() / 2), i18next.t("modifier:pokemonInstantReviveApply", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), typeName: this.type.name }), false, false, true));
|
||||||
|
|
||||||
|
// Remove the Pokemon's FAINT status
|
||||||
pokemon.resetStatus(true, false, true);
|
pokemon.resetStatus(true, false, true);
|
||||||
|
|
||||||
|
// Reapply Commander on the Pokemon's side of the field, if applicable
|
||||||
|
const field = pokemon.isPlayer() ? pokemon.scene.getPlayerField() : pokemon.scene.getEnemyField();
|
||||||
|
field.forEach((p) => applyAbAttrs(CommanderAbAttr, p, null, false));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,11 @@ export class CommandPhase extends FieldPhase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the Pokemon has applied Commander's effects to its ally, skip this command
|
||||||
|
if (this.scene.currentBattle?.double && this.getPokemon().getAlly()?.getTag(BattlerTagType.COMMANDED)?.getSourcePokemon(this.scene) === this.getPokemon()) {
|
||||||
|
this.scene.currentBattle.turnCommands[this.fieldIndex] = { command: Command.FIGHT, move: { move: Moves.NONE, targets: []}, skip: true };
|
||||||
|
}
|
||||||
|
|
||||||
if (this.scene.currentBattle.turnCommands[this.fieldIndex]?.skip) {
|
if (this.scene.currentBattle.turnCommands[this.fieldIndex]?.skip) {
|
||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
@ -92,7 +97,7 @@ export class CommandPhase extends FieldPhase {
|
|||||||
|
|
||||||
handleCommand(command: Command, cursor: integer, ...args: any[]): boolean {
|
handleCommand(command: Command, cursor: integer, ...args: any[]): boolean {
|
||||||
const playerPokemon = this.scene.getPlayerField()[this.fieldIndex];
|
const playerPokemon = this.scene.getPlayerField()[this.fieldIndex];
|
||||||
let success: boolean;
|
let success: boolean = false;
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case Command.FIGHT:
|
case Command.FIGHT:
|
||||||
@ -232,11 +237,8 @@ export class CommandPhase extends FieldPhase {
|
|||||||
const trapTag = playerPokemon.getTag(TrappedTag);
|
const trapTag = playerPokemon.getTag(TrappedTag);
|
||||||
const fairyLockTag = playerPokemon.scene.arena.getTagOnSide(ArenaTagType.FAIRY_LOCK, ArenaTagSide.PLAYER);
|
const fairyLockTag = playerPokemon.scene.arena.getTagOnSide(ArenaTagType.FAIRY_LOCK, ArenaTagSide.PLAYER);
|
||||||
|
|
||||||
// trapTag should be defined at this point, but just in case...
|
|
||||||
if (!trapTag && !fairyLockTag) {
|
if (!trapTag && !fairyLockTag) {
|
||||||
currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
i18next.t(`battle:noEscape${isSwitch ? "Switch" : "Flee"}`);
|
||||||
? { command: Command.POKEMON, cursor: cursor, args: args }
|
|
||||||
: { command: Command.RUN };
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!isSwitch) {
|
if (!isSwitch) {
|
||||||
@ -272,11 +274,11 @@ export class CommandPhase extends FieldPhase {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success!) { // TODO: is the bang correct?
|
if (success) {
|
||||||
this.end();
|
this.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
return success!; // TODO: is the bang correct?
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
|
@ -36,6 +36,7 @@ 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;
|
||||||
@ -483,6 +484,7 @@ 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));
|
||||||
|
@ -2,6 +2,8 @@ import BattleScene from "#app/battle-scene";
|
|||||||
import { BattlerIndex } from "#app/battle";
|
import { BattlerIndex } from "#app/battle";
|
||||||
import { Command } from "#app/ui/command-ui-handler";
|
import { Command } from "#app/ui/command-ui-handler";
|
||||||
import { FieldPhase } from "./field-phase";
|
import { FieldPhase } from "./field-phase";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Phase for determining an enemy AI's action for the next turn.
|
* Phase for determining an enemy AI's action for the next turn.
|
||||||
@ -34,6 +36,11 @@ export class EnemyCommandPhase extends FieldPhase {
|
|||||||
|
|
||||||
const trainer = battle.trainer;
|
const trainer = battle.trainer;
|
||||||
|
|
||||||
|
if (battle.double && enemyPokemon.hasAbility(Abilities.COMMANDER)
|
||||||
|
&& enemyPokemon.getAlly().getTag(BattlerTagType.COMMANDED)) {
|
||||||
|
this.skipTurn = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the enemy has a trainer, decide whether or not the enemy should switch
|
* If the enemy has a trainer, decide whether or not the enemy should switch
|
||||||
* to another member in its party.
|
* to another member in its party.
|
||||||
|
@ -39,8 +39,6 @@ export class EvolutionPhase extends Phase {
|
|||||||
this.pokemon = pokemon;
|
this.pokemon = pokemon;
|
||||||
this.evolution = evolution;
|
this.evolution = evolution;
|
||||||
this.lastLevel = lastLevel;
|
this.lastLevel = lastLevel;
|
||||||
this.evolutionBgm = this.scene.playSoundWithoutBgm("evolution");
|
|
||||||
this.preEvolvedPokemonName = getPokemonNameWithAffix(this.pokemon);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
validate(): boolean {
|
validate(): boolean {
|
||||||
@ -62,9 +60,9 @@ export class EvolutionPhase extends Phase {
|
|||||||
|
|
||||||
this.scene.fadeOutBgm(undefined, false);
|
this.scene.fadeOutBgm(undefined, false);
|
||||||
|
|
||||||
const evolutionHandler = this.scene.ui.getHandler() as EvolutionSceneHandler;
|
this.evolutionHandler = this.scene.ui.getHandler() as EvolutionSceneHandler;
|
||||||
|
|
||||||
this.evolutionContainer = evolutionHandler.evolutionContainer;
|
this.evolutionContainer = this.evolutionHandler.evolutionContainer;
|
||||||
|
|
||||||
this.evolutionBaseBg = this.scene.add.image(0, 0, "default_bg");
|
this.evolutionBaseBg = this.scene.add.image(0, 0, "default_bg");
|
||||||
this.evolutionBaseBg.setOrigin(0, 0);
|
this.evolutionBaseBg.setOrigin(0, 0);
|
||||||
@ -117,14 +115,12 @@ export class EvolutionPhase extends Phase {
|
|||||||
sprite.pipelineData[k] = this.pokemon.getSprite().pipelineData[k];
|
sprite.pipelineData[k] = this.pokemon.getSprite().pipelineData[k];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
this.preEvolvedPokemonName = getPokemonNameWithAffix(this.pokemon);
|
||||||
this.doEvolution();
|
this.doEvolution();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
doEvolution(): void {
|
doEvolution(): void {
|
||||||
this.evolutionHandler = this.scene.ui.getHandler() as EvolutionSceneHandler;
|
|
||||||
|
|
||||||
this.scene.ui.showText(i18next.t("menu:evolving", { pokemonName: this.preEvolvedPokemonName }), null, () => {
|
this.scene.ui.showText(i18next.t("menu:evolving", { pokemonName: this.preEvolvedPokemonName }), null, () => {
|
||||||
this.pokemon.cry();
|
this.pokemon.cry();
|
||||||
|
|
||||||
@ -145,6 +141,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.scene.time.delayedCall(1000, () => {
|
this.scene.time.delayedCall(1000, () => {
|
||||||
|
this.evolutionBgm = this.scene.playSoundWithoutBgm("evolution");
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this.evolutionBgOverlay,
|
targets: this.evolutionBgOverlay,
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { BattlerIndex, BattleType } from "#app/battle";
|
import { BattlerIndex, BattleType } from "#app/battle";
|
||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
import { applyPostFaintAbAttrs, applyPostKnockOutAbAttrs, applyPostVictoryAbAttrs, PostFaintAbAttr, PostKnockOutAbAttr, PostVictoryAbAttr } from "#app/data/ability";
|
import { applyPostFaintAbAttrs, applyPostKnockOutAbAttrs, applyPostVictoryAbAttrs, PostFaintAbAttr, PostKnockOutAbAttr, PostVictoryAbAttr } from "#app/data/ability";
|
||||||
import { BattlerTagLapseType, DestinyBondTag } from "#app/data/battler-tags";
|
import { BattlerTagLapseType, DestinyBondTag, GrudgeTag } from "#app/data/battler-tags";
|
||||||
import { battleSpecDialogue } from "#app/data/dialogue";
|
import { battleSpecDialogue } from "#app/data/dialogue";
|
||||||
import { allMoves, PostVictoryStatStageChangeAttr } from "#app/data/move";
|
import { allMoves, PostVictoryStatStageChangeAttr } from "#app/data/move";
|
||||||
import { SpeciesFormChangeActiveTrigger } from "#app/data/pokemon-forms";
|
import { SpeciesFormChangeActiveTrigger } from "#app/data/pokemon-forms";
|
||||||
@ -31,18 +31,24 @@ export class FaintPhase extends PokemonPhase {
|
|||||||
/**
|
/**
|
||||||
* Destiny Bond tag belonging to the currently fainting Pokemon, if applicable
|
* Destiny Bond tag belonging to the currently fainting Pokemon, if applicable
|
||||||
*/
|
*/
|
||||||
private destinyTag?: DestinyBondTag;
|
private destinyTag?: DestinyBondTag | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The source Pokemon that dealt fatal damage and should get KO'd by Destiny Bond, if applicable
|
* Grudge tag belonging to the currently fainting Pokemon, if applicable
|
||||||
|
*/
|
||||||
|
private grudgeTag?: GrudgeTag | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The source Pokemon that dealt fatal damage
|
||||||
*/
|
*/
|
||||||
private source?: Pokemon;
|
private source?: Pokemon;
|
||||||
|
|
||||||
constructor(scene: BattleScene, battlerIndex: BattlerIndex, preventEndure: boolean = false, destinyTag?: DestinyBondTag, source?: Pokemon) {
|
constructor(scene: BattleScene, battlerIndex: BattlerIndex, preventEndure: boolean = false, destinyTag?: DestinyBondTag | null, grudgeTag?: GrudgeTag | null, source?: Pokemon) {
|
||||||
super(scene, battlerIndex);
|
super(scene, battlerIndex);
|
||||||
|
|
||||||
this.preventEndure = preventEndure;
|
this.preventEndure = preventEndure;
|
||||||
this.destinyTag = destinyTag;
|
this.destinyTag = destinyTag;
|
||||||
|
this.grudgeTag = grudgeTag;
|
||||||
this.source = source;
|
this.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +59,10 @@ export class FaintPhase extends PokemonPhase {
|
|||||||
this.destinyTag.lapse(this.source, BattlerTagLapseType.CUSTOM);
|
this.destinyTag.lapse(this.source, BattlerTagLapseType.CUSTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isNullOrUndefined(this.grudgeTag) && !isNullOrUndefined(this.source)) {
|
||||||
|
this.grudgeTag.lapse(this.getPokemon(), BattlerTagLapseType.CUSTOM, this.source);
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.preventEndure) {
|
if (!this.preventEndure) {
|
||||||
const instantReviveModifier = this.scene.applyModifier(PokemonInstantReviveModifier, this.player, this.getPokemon()) as PokemonInstantReviveModifier;
|
const instantReviveModifier = this.scene.applyModifier(PokemonInstantReviveModifier, this.player, this.getPokemon()) as PokemonInstantReviveModifier;
|
||||||
|
|
||||||
|
@ -211,11 +211,14 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
&& (target.getAbility()?.getAttrs(TypeImmunityAbAttr)?.[0]?.getImmuneType() === user.getMoveType(move))
|
&& (target.getAbility()?.getAttrs(TypeImmunityAbAttr)?.[0]?.getImmuneType() === user.getMoveType(move))
|
||||||
&& !target.getTag(SemiInvulnerableTag);
|
&& !target.getTag(SemiInvulnerableTag);
|
||||||
|
|
||||||
|
/** Is the target hidden by the effects of its Commander ability? */
|
||||||
|
const isCommanding = this.scene.currentBattle.double && target.getAlly()?.getTag(BattlerTagType.COMMANDED)?.getSourcePokemon(this.scene) === target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the move missed a target, stop all future hits against that target
|
* If the move missed a target, stop all future hits against that target
|
||||||
* and move on to the next target (if there is one).
|
* and move on to the next target (if there is one).
|
||||||
*/
|
*/
|
||||||
if (!isImmune && !isProtected && !targetHitChecks[target.getBattlerIndex()]) {
|
if (isCommanding || (!isImmune && !isProtected && !targetHitChecks[target.getBattlerIndex()])) {
|
||||||
this.stopMultiHit(target);
|
this.stopMultiHit(target);
|
||||||
this.scene.queueMessage(i18next.t("battle:attackMissed", { pokemonNameWithAffix: getPokemonNameWithAffix(target) }));
|
this.scene.queueMessage(i18next.t("battle:attackMissed", { pokemonNameWithAffix: getPokemonNameWithAffix(target) }));
|
||||||
if (moveHistoryEntry.result === MoveResult.PENDING) {
|
if (moveHistoryEntry.result === MoveResult.PENDING) {
|
||||||
|
@ -417,6 +417,7 @@ export class MysteryEncounterBattlePhase extends Phase {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (availablePartyMembers.length > 1 && availablePartyMembers[1].isOnField()) {
|
if (availablePartyMembers.length > 1 && availablePartyMembers[1].isOnField()) {
|
||||||
|
scene.getPlayerField().forEach((pokemon) => pokemon.lapseTag(BattlerTagType.COMMANDED));
|
||||||
scene.pushPhase(new ReturnPhase(scene, 1));
|
scene.pushPhase(new ReturnPhase(scene, 1));
|
||||||
}
|
}
|
||||||
scene.pushPhase(new ToggleDoublePositionPhase(scene, false));
|
scene.pushPhase(new ToggleDoublePositionPhase(scene, false));
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
import { SubstituteTag } from "#app/data/battler-tags";
|
import { SubstituteTag } from "#app/data/battler-tags";
|
||||||
import { PokemonAnimType } from "#enums/pokemon-anim-type";
|
|
||||||
import Pokemon from "#app/field/pokemon";
|
import Pokemon from "#app/field/pokemon";
|
||||||
import { BattlePhase } from "#app/phases/battle-phase";
|
import { BattlePhase } from "#app/phases/battle-phase";
|
||||||
|
import { isNullOrUndefined } from "#app/utils";
|
||||||
|
import { PokemonAnimType } from "#enums/pokemon-anim-type";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
|
||||||
|
|
||||||
export class PokemonAnimPhase extends BattlePhase {
|
export class PokemonAnimPhase extends BattlePhase {
|
||||||
@ -37,14 +39,20 @@ export class PokemonAnimPhase extends BattlePhase {
|
|||||||
case PokemonAnimType.SUBSTITUTE_REMOVE:
|
case PokemonAnimType.SUBSTITUTE_REMOVE:
|
||||||
this.doSubstituteRemoveAnim();
|
this.doSubstituteRemoveAnim();
|
||||||
break;
|
break;
|
||||||
|
case PokemonAnimType.COMMANDER_APPLY:
|
||||||
|
this.doCommanderApplyAnim();
|
||||||
|
break;
|
||||||
|
case PokemonAnimType.COMMANDER_REMOVE:
|
||||||
|
this.doCommanderRemoveAnim();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
this.end();
|
this.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doSubstituteAddAnim(): void {
|
private doSubstituteAddAnim(): void {
|
||||||
const substitute = this.pokemon.getTag(SubstituteTag);
|
const substitute = this.pokemon.getTag(SubstituteTag);
|
||||||
if (substitute === null) {
|
if (isNullOrUndefined(substitute)) {
|
||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +114,7 @@ export class PokemonAnimPhase extends BattlePhase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
doSubstitutePreMoveAnim(): void {
|
private doSubstitutePreMoveAnim(): void {
|
||||||
if (this.fieldAssets.length !== 1) {
|
if (this.fieldAssets.length !== 1) {
|
||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
@ -135,7 +143,7 @@ export class PokemonAnimPhase extends BattlePhase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
doSubstitutePostMoveAnim(): void {
|
private doSubstitutePostMoveAnim(): void {
|
||||||
if (this.fieldAssets.length !== 1) {
|
if (this.fieldAssets.length !== 1) {
|
||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
@ -164,7 +172,7 @@ export class PokemonAnimPhase extends BattlePhase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
doSubstituteRemoveAnim(): void {
|
private doSubstituteRemoveAnim(): void {
|
||||||
if (this.fieldAssets.length !== 1) {
|
if (this.fieldAssets.length !== 1) {
|
||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
@ -233,4 +241,121 @@ export class PokemonAnimPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private doCommanderApplyAnim(): void {
|
||||||
|
if (!this.scene.currentBattle?.double) {
|
||||||
|
return this.end();
|
||||||
|
}
|
||||||
|
const dondozo = this.pokemon.getAlly();
|
||||||
|
|
||||||
|
if (dondozo?.species?.speciesId !== Species.DONDOZO) {
|
||||||
|
return this.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
const tatsugiriX = this.pokemon.x + this.pokemon.getSprite().x;
|
||||||
|
const tatsugiriY = this.pokemon.y + this.pokemon.getSprite().y;
|
||||||
|
|
||||||
|
const getSourceSprite = () => {
|
||||||
|
const sprite = this.scene.addPokemonSprite(this.pokemon, tatsugiriX, tatsugiriY, this.pokemon.getSprite().texture, this.pokemon.getSprite()!.frame.name, true);
|
||||||
|
[ "spriteColors", "fusionSpriteColors" ].map(k => sprite.pipelineData[k] = this.pokemon.getSprite().pipelineData[k]);
|
||||||
|
sprite.setPipelineData("spriteKey", this.pokemon.getBattleSpriteKey());
|
||||||
|
sprite.setPipelineData("shiny", this.pokemon.shiny);
|
||||||
|
sprite.setPipelineData("variant", this.pokemon.variant);
|
||||||
|
sprite.setPipelineData("ignoreFieldPos", true);
|
||||||
|
sprite.setOrigin(0.5, 1);
|
||||||
|
this.pokemon.getSprite().on("animationupdate", (_anim, frame) => sprite.setFrame(frame.textureFrame));
|
||||||
|
this.scene.field.add(sprite);
|
||||||
|
return sprite;
|
||||||
|
};
|
||||||
|
|
||||||
|
const sourceSprite = getSourceSprite();
|
||||||
|
|
||||||
|
this.pokemon.setVisible(false);
|
||||||
|
|
||||||
|
const sourceFpOffset = this.pokemon.getFieldPositionOffset();
|
||||||
|
const dondozoFpOffset = dondozo.getFieldPositionOffset();
|
||||||
|
|
||||||
|
this.scene.playSound("se/pb_throw");
|
||||||
|
|
||||||
|
this.scene.tweens.add({
|
||||||
|
targets: sourceSprite,
|
||||||
|
duration: 375,
|
||||||
|
scale: 0.5,
|
||||||
|
x: { value: tatsugiriX + (dondozoFpOffset[0] - sourceFpOffset[0]) / 2, ease: "Linear" },
|
||||||
|
y: { value: (this.pokemon.isPlayer() ? 100 : 65) + sourceFpOffset[1], ease: "Sine.easeOut" },
|
||||||
|
onComplete: () => {
|
||||||
|
this.scene.field.bringToTop(dondozo);
|
||||||
|
this.scene.tweens.add({
|
||||||
|
targets: sourceSprite,
|
||||||
|
duration: 375,
|
||||||
|
scale: 0.01,
|
||||||
|
x: { value: dondozo.x, ease: "Linear" },
|
||||||
|
y: { value: dondozo.y + dondozo.height / 2, ease: "Sine.easeIn" },
|
||||||
|
onComplete: () => {
|
||||||
|
sourceSprite.destroy();
|
||||||
|
this.scene.playSound("battle_anims/PRSFX- Liquidation1.wav");
|
||||||
|
this.scene.tweens.add({
|
||||||
|
targets: dondozo,
|
||||||
|
duration: 250,
|
||||||
|
ease: "Sine.easeInOut",
|
||||||
|
scale: 0.85,
|
||||||
|
yoyo: true,
|
||||||
|
onComplete: () => this.end()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private doCommanderRemoveAnim(): void {
|
||||||
|
// Note: unlike the other Commander animation, this is played through the
|
||||||
|
// Dondozo instead of the Tatsugiri.
|
||||||
|
const tatsugiri = this.pokemon.getAlly();
|
||||||
|
|
||||||
|
const tatsuSprite = this.scene.addPokemonSprite(
|
||||||
|
tatsugiri,
|
||||||
|
this.pokemon.x + this.pokemon.getSprite().x,
|
||||||
|
this.pokemon.y + this.pokemon.getSprite().y + this.pokemon.height / 2,
|
||||||
|
tatsugiri.getSprite().texture,
|
||||||
|
tatsugiri.getSprite()!.frame.name,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
[ "spriteColors", "fusionSpriteColors" ].map(k => tatsuSprite.pipelineData[k] = tatsugiri.getSprite().pipelineData[k]);
|
||||||
|
tatsuSprite.setPipelineData("spriteKey", tatsugiri.getBattleSpriteKey());
|
||||||
|
tatsuSprite.setPipelineData("shiny", tatsugiri.shiny);
|
||||||
|
tatsuSprite.setPipelineData("variant", tatsugiri.variant);
|
||||||
|
tatsuSprite.setPipelineData("ignoreFieldPos", true);
|
||||||
|
this.pokemon.getSprite().on("animationupdate", (_anim, frame) => tatsuSprite.setFrame(frame.textureFrame));
|
||||||
|
|
||||||
|
tatsuSprite.setOrigin(0.5, 1);
|
||||||
|
tatsuSprite.setScale(0.01);
|
||||||
|
|
||||||
|
this.scene.field.add(tatsuSprite);
|
||||||
|
this.scene.field.bringToTop(this.pokemon);
|
||||||
|
tatsuSprite.setVisible(true);
|
||||||
|
|
||||||
|
this.scene.tweens.add({
|
||||||
|
targets: this.pokemon,
|
||||||
|
duration: 250,
|
||||||
|
ease: "Sine.easeInOut",
|
||||||
|
scale: 1.15,
|
||||||
|
yoyo: true,
|
||||||
|
onComplete: () => {
|
||||||
|
this.scene.playSound("battle_anims/PRSFX- Liquidation4.wav");
|
||||||
|
this.scene.tweens.add({
|
||||||
|
targets: tatsuSprite,
|
||||||
|
duration: 500,
|
||||||
|
scale: 1,
|
||||||
|
x: { value: tatsugiri.x + tatsugiri.getSprite().x, ease: "Linear" },
|
||||||
|
y: { value: tatsugiri.y + tatsugiri.getSprite().y, ease: "Sine.easeIn" },
|
||||||
|
onComplete: () => {
|
||||||
|
tatsugiri.setVisible(true);
|
||||||
|
tatsuSprite.destroy();
|
||||||
|
this.end();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
import { BattlerIndex } from "#app/battle";
|
import { BattlerIndex } from "#app/battle";
|
||||||
import { applyPostSummonAbAttrs, PostSummonAbAttr } from "#app/data/ability";
|
import { applyAbAttrs, applyPostSummonAbAttrs, CommanderAbAttr, PostSummonAbAttr } from "#app/data/ability";
|
||||||
import { ArenaTrapTag } from "#app/data/arena-tag";
|
import { ArenaTrapTag } from "#app/data/arena-tag";
|
||||||
import { StatusEffect } from "#app/enums/status-effect";
|
import { StatusEffect } from "#app/enums/status-effect";
|
||||||
import { PokemonPhase } from "./pokemon-phase";
|
import { PokemonPhase } from "./pokemon-phase";
|
||||||
@ -28,5 +28,8 @@ export class PostSummonPhase extends PokemonPhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
applyPostSummonAbAttrs(PostSummonAbAttr, pokemon).then(() => this.end());
|
applyPostSummonAbAttrs(PostSummonAbAttr, pokemon).then(() => this.end());
|
||||||
|
|
||||||
|
const field = pokemon.isPlayer() ? this.scene.getPlayerField() : this.scene.getEnemyField();
|
||||||
|
field.forEach((p) => applyAbAttrs(CommanderAbAttr, p, null, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
224
src/test/abilities/commander.test.ts
Normal file
224
src/test/abilities/commander.test.ts
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
import { BattlerIndex } from "#app/battle";
|
||||||
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
|
import { PokemonAnimType } from "#enums/pokemon-anim-type";
|
||||||
|
import { EffectiveStat, Stat } from "#enums/stat";
|
||||||
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
|
import { WeatherType } from "#enums/weather-type";
|
||||||
|
import { MoveResult } from "#app/field/pokemon";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
|
describe("Abilities - Commander", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.startingLevel(100)
|
||||||
|
.enemyLevel(100)
|
||||||
|
.moveset([ Moves.LIQUIDATION, Moves.MEMENTO, Moves.SPLASH, Moves.FLIP_TURN ])
|
||||||
|
.ability(Abilities.COMMANDER)
|
||||||
|
.battleType("double")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(Species.SNORLAX)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.TACKLE);
|
||||||
|
|
||||||
|
vi.spyOn(game.scene, "triggerPokemonBattleAnim").mockReturnValue(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("causes the source to jump into Dondozo's mouth, granting a stat boost and hiding the source", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.TATSUGIRI, Species.DONDOZO ]);
|
||||||
|
|
||||||
|
const [ tatsugiri, dondozo ] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
const affectedStats: EffectiveStat[] = [ Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.SPD ];
|
||||||
|
|
||||||
|
expect(game.scene.triggerPokemonBattleAnim).toHaveBeenLastCalledWith(tatsugiri, PokemonAnimType.COMMANDER_APPLY);
|
||||||
|
expect(dondozo.getTag(BattlerTagType.COMMANDED)).toBeDefined();
|
||||||
|
affectedStats.forEach((stat) => expect(dondozo.getStatStage(stat)).toBe(2));
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
|
||||||
|
expect(game.scene.currentBattle.turnCommands[0]?.skip).toBeTruthy();
|
||||||
|
|
||||||
|
// Force both enemies to target the Tatsugiri
|
||||||
|
await game.forceEnemyMove(Moves.TACKLE, BattlerIndex.PLAYER);
|
||||||
|
await game.forceEnemyMove(Moves.TACKLE, BattlerIndex.PLAYER);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("BerryPhase", false);
|
||||||
|
game.scene.getEnemyField().forEach(enemy => expect(enemy.getLastXMoves(1)[0].result).toBe(MoveResult.MISS));
|
||||||
|
expect(tatsugiri.isFullHp()).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should activate when a Dondozo switches in and cancel the source's move", async () => {
|
||||||
|
game.override.enemyMoveset(Moves.SPLASH);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.TATSUGIRI, Species.MAGIKARP, Species.DONDOZO ]);
|
||||||
|
|
||||||
|
const tatsugiri = game.scene.getPlayerField()[0];
|
||||||
|
|
||||||
|
game.move.select(Moves.LIQUIDATION, 0, BattlerIndex.ENEMY);
|
||||||
|
game.doSwitchPokemon(2);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("MovePhase", false);
|
||||||
|
expect(game.scene.triggerPokemonBattleAnim).toHaveBeenCalledWith(tatsugiri, PokemonAnimType.COMMANDER_APPLY);
|
||||||
|
|
||||||
|
const dondozo = game.scene.getPlayerField()[1];
|
||||||
|
expect(dondozo.getTag(BattlerTagType.COMMANDED)).toBeDefined();
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("BerryPhase", false);
|
||||||
|
expect(tatsugiri.getMoveHistory()).toHaveLength(0);
|
||||||
|
expect(game.scene.getEnemyField()[0].isFullHp()).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("source should reenter the field when Dondozo faints", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.TATSUGIRI, Species.DONDOZO ]);
|
||||||
|
|
||||||
|
const [ tatsugiri, dondozo ] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
expect(game.scene.triggerPokemonBattleAnim).toHaveBeenLastCalledWith(tatsugiri, PokemonAnimType.COMMANDER_APPLY);
|
||||||
|
expect(dondozo.getTag(BattlerTagType.COMMANDED)).toBeDefined();
|
||||||
|
|
||||||
|
game.move.select(Moves.MEMENTO, 1, BattlerIndex.ENEMY);
|
||||||
|
|
||||||
|
expect(game.scene.currentBattle.turnCommands[0]?.skip).toBeTruthy();
|
||||||
|
|
||||||
|
await game.forceEnemyMove(Moves.TACKLE, BattlerIndex.PLAYER);
|
||||||
|
await game.forceEnemyMove(Moves.TACKLE, BattlerIndex.PLAYER);
|
||||||
|
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER ]);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("FaintPhase", false);
|
||||||
|
expect(dondozo.getTag(BattlerTagType.COMMANDED)).toBeUndefined();
|
||||||
|
expect(game.scene.triggerPokemonBattleAnim).toHaveBeenLastCalledWith(dondozo, PokemonAnimType.COMMANDER_REMOVE);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("BerryPhase", false);
|
||||||
|
expect(tatsugiri.isFullHp()).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("source should still take damage from Poison while hidden", async () => {
|
||||||
|
game.override
|
||||||
|
.statusEffect(StatusEffect.POISON)
|
||||||
|
.enemyMoveset(Moves.SPLASH);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.TATSUGIRI, Species.DONDOZO ]);
|
||||||
|
|
||||||
|
const [ tatsugiri, dondozo ] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
expect(game.scene.triggerPokemonBattleAnim).toHaveBeenLastCalledWith(tatsugiri, PokemonAnimType.COMMANDER_APPLY);
|
||||||
|
expect(dondozo.getTag(BattlerTagType.COMMANDED)).toBeDefined();
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
|
||||||
|
expect(game.scene.currentBattle.turnCommands[0]?.skip).toBeTruthy();
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
expect(tatsugiri.isFullHp()).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("source should still take damage from Salt Cure while hidden", async () => {
|
||||||
|
game.override.enemyMoveset(Moves.SPLASH);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.TATSUGIRI, Species.DONDOZO ]);
|
||||||
|
|
||||||
|
const [ tatsugiri, dondozo ] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
expect(game.scene.triggerPokemonBattleAnim).toHaveBeenLastCalledWith(tatsugiri, PokemonAnimType.COMMANDER_APPLY);
|
||||||
|
expect(dondozo.getTag(BattlerTagType.COMMANDED)).toBeDefined();
|
||||||
|
|
||||||
|
tatsugiri.addTag(BattlerTagType.SALT_CURED, 0, Moves.NONE, game.scene.getField()[BattlerIndex.ENEMY].id);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
|
||||||
|
expect(game.scene.currentBattle.turnCommands[0]?.skip).toBeTruthy();
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
expect(tatsugiri.isFullHp()).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("source should still take damage from Sandstorm while hidden", async () => {
|
||||||
|
game.override
|
||||||
|
.weather(WeatherType.SANDSTORM)
|
||||||
|
.enemyMoveset(Moves.SPLASH);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.TATSUGIRI, Species.DONDOZO ]);
|
||||||
|
|
||||||
|
const [ tatsugiri, dondozo ] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
expect(game.scene.triggerPokemonBattleAnim).toHaveBeenLastCalledWith(tatsugiri, PokemonAnimType.COMMANDER_APPLY);
|
||||||
|
expect(dondozo.getTag(BattlerTagType.COMMANDED)).toBeDefined();
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
|
||||||
|
expect(game.scene.currentBattle.turnCommands[0]?.skip).toBeTruthy();
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
expect(tatsugiri.isFullHp()).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should make Dondozo immune to being forced out", async () => {
|
||||||
|
game.override.enemyMoveset([ Moves.SPLASH, Moves.WHIRLWIND ]);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.TATSUGIRI, Species.DONDOZO ]);
|
||||||
|
|
||||||
|
const [ tatsugiri, dondozo ] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
expect(game.scene.triggerPokemonBattleAnim).toHaveBeenLastCalledWith(tatsugiri, PokemonAnimType.COMMANDER_APPLY);
|
||||||
|
expect(dondozo.getTag(BattlerTagType.COMMANDED)).toBeDefined();
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
|
||||||
|
expect(game.scene.currentBattle.turnCommands[0]?.skip).toBeTruthy();
|
||||||
|
|
||||||
|
await game.forceEnemyMove(Moves.WHIRLWIND, BattlerIndex.PLAYER_2);
|
||||||
|
await game.forceEnemyMove(Moves.SPLASH);
|
||||||
|
|
||||||
|
// Test may time out here if Whirlwind forced out a Pokemon
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
expect(dondozo.isActive(true)).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should interrupt the source's semi-invulnerability", async () => {
|
||||||
|
game.override
|
||||||
|
.moveset([ Moves.SPLASH, Moves.DIVE ])
|
||||||
|
.enemyMoveset(Moves.SPLASH);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.TATSUGIRI, Species.MAGIKARP, Species.DONDOZO ]);
|
||||||
|
|
||||||
|
const tatsugiri = game.scene.getPlayerField()[0];
|
||||||
|
|
||||||
|
game.move.select(Moves.DIVE, 0, BattlerIndex.ENEMY);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("CommandPhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(tatsugiri.getTag(BattlerTagType.UNDERWATER)).toBeDefined();
|
||||||
|
game.doSwitchPokemon(2);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("MovePhase", false);
|
||||||
|
const dondozo = game.scene.getPlayerField()[1];
|
||||||
|
expect(tatsugiri.getTag(BattlerTagType.UNDERWATER)).toBeUndefined();
|
||||||
|
expect(dondozo.getTag(BattlerTagType.COMMANDED)).toBeDefined();
|
||||||
|
|
||||||
|
await game.toNextTurn();
|
||||||
|
const enemy = game.scene.getEnemyField()[0];
|
||||||
|
expect(enemy.isFullHp()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -72,6 +72,31 @@ describe("Moves - Freeze-Dry", () => {
|
|||||||
expect(enemy.getMoveEffectiveness).toHaveReturnedWith(1);
|
expect(enemy.getMoveEffectiveness).toHaveReturnedWith(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Freeze drys forced super effectiveness should overwrite wonder guard
|
||||||
|
*/
|
||||||
|
it("should deal 2x dmg against soaked wonder guard target", async () => {
|
||||||
|
game.override
|
||||||
|
.enemySpecies(Species.SHEDINJA)
|
||||||
|
.enemyMoveset(Moves.SPLASH)
|
||||||
|
.starterSpecies(Species.MAGIKARP)
|
||||||
|
.moveset([ Moves.SOAK, Moves.FREEZE_DRY ]);
|
||||||
|
await game.classicMode.startBattle();
|
||||||
|
|
||||||
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
|
vi.spyOn(enemy, "getMoveEffectiveness");
|
||||||
|
|
||||||
|
game.move.select(Moves.SOAK);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
game.move.select(Moves.FREEZE_DRY);
|
||||||
|
await game.phaseInterceptor.to("MoveEffectPhase");
|
||||||
|
|
||||||
|
expect(enemy.getMoveEffectiveness).toHaveReturnedWith(2);
|
||||||
|
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
||||||
|
});
|
||||||
|
|
||||||
// enable if this is ever fixed (lol)
|
// enable if this is ever fixed (lol)
|
||||||
it.todo("should deal 2x damage to water types under Normalize", async () => {
|
it.todo("should deal 2x damage to water types under Normalize", async () => {
|
||||||
game.override.ability(Abilities.NORMALIZE);
|
game.override.ability(Abilities.NORMALIZE);
|
||||||
|
90
src/test/moves/grudge.test.ts
Normal file
90
src/test/moves/grudge.test.ts
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import { BattlerIndex } from "#app/battle";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
describe("Moves - Grudge", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.moveset([ Moves.EMBER, Moves.SPLASH ])
|
||||||
|
.ability(Abilities.BALL_FETCH)
|
||||||
|
.battleType("single")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(Species.SHEDINJA)
|
||||||
|
.enemyAbility(Abilities.WONDER_GUARD)
|
||||||
|
.enemyMoveset([ Moves.GRUDGE, Moves.SPLASH ]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should reduce the PP of the Pokemon's move to 0 when the user has fainted", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.FEEBAS ]);
|
||||||
|
|
||||||
|
const playerPokemon = game.scene.getPlayerPokemon();
|
||||||
|
game.move.select(Moves.EMBER);
|
||||||
|
await game.forceEnemyMove(Moves.GRUDGE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
|
||||||
|
const playerMove = playerPokemon?.getMoveset().find(m => m?.moveId === Moves.EMBER);
|
||||||
|
|
||||||
|
expect(playerMove?.getPpRatio()).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should remain in effect until the user's next move", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.FEEBAS ]);
|
||||||
|
|
||||||
|
const playerPokemon = game.scene.getPlayerPokemon();
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.forceEnemyMove(Moves.GRUDGE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
game.move.select(Moves.EMBER);
|
||||||
|
await game.forceEnemyMove(Moves.SPLASH);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
|
||||||
|
const playerMove = playerPokemon?.getMoveset().find(m => m?.moveId === Moves.EMBER);
|
||||||
|
|
||||||
|
expect(playerMove?.getPpRatio()).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not reduce the opponent's PP if the user dies to weather/indirect damage", async () => {
|
||||||
|
// Opponent will be reduced to 1 HP by False Swipe, then faint to Sandstorm
|
||||||
|
game.override
|
||||||
|
.moveset([ Moves.FALSE_SWIPE ])
|
||||||
|
.startingLevel(100)
|
||||||
|
.ability(Abilities.SAND_STREAM)
|
||||||
|
.enemySpecies(Species.RATTATA);
|
||||||
|
await game.classicMode.startBattle([ Species.GEODUDE ]);
|
||||||
|
|
||||||
|
const enemyPokemon = game.scene.getEnemyPokemon();
|
||||||
|
const playerPokemon = game.scene.getPlayerPokemon();
|
||||||
|
|
||||||
|
game.move.select(Moves.FALSE_SWIPE);
|
||||||
|
await game.forceEnemyMove(Moves.GRUDGE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
|
||||||
|
expect(enemyPokemon?.isFainted()).toBe(true);
|
||||||
|
|
||||||
|
const playerMove = playerPokemon?.getMoveset().find(m => m?.moveId === Moves.FALSE_SWIPE);
|
||||||
|
expect(playerMove?.getPpRatio()).toBeGreaterThan(0);
|
||||||
|
});
|
||||||
|
});
|
85
src/test/moves/order_up.test.ts
Normal file
85
src/test/moves/order_up.test.ts
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import { BattlerIndex } from "#app/battle";
|
||||||
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
|
import { PokemonAnimType } from "#enums/pokemon-anim-type";
|
||||||
|
import { EffectiveStat, Stat } from "#enums/stat";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
|
describe("Moves - Order Up", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.moveset(Moves.ORDER_UP)
|
||||||
|
.ability(Abilities.COMMANDER)
|
||||||
|
.battleType("double")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(Species.SNORLAX)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.SPLASH)
|
||||||
|
.startingLevel(100)
|
||||||
|
.enemyLevel(100);
|
||||||
|
|
||||||
|
vi.spyOn(game.scene, "triggerPokemonBattleAnim").mockReturnValue(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
{ formIndex: 0, formName: "Curly", stat: Stat.ATK, statName: "Attack" },
|
||||||
|
{ formIndex: 1, formName: "Droopy", stat: Stat.DEF, statName: "Defense" },
|
||||||
|
{ formIndex: 2, formName: "Stretchy", stat: Stat.SPD, statName: "Speed" }
|
||||||
|
])("should raise the user's $statName when the user is commanded by a $formName Tatsugiri", async ({ formIndex, stat }) => {
|
||||||
|
game.override.starterForms({ [Species.TATSUGIRI]: formIndex });
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.TATSUGIRI, Species.DONDOZO ]);
|
||||||
|
|
||||||
|
const [ tatsugiri, dondozo ] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
expect(game.scene.triggerPokemonBattleAnim).toHaveBeenLastCalledWith(tatsugiri, PokemonAnimType.COMMANDER_APPLY);
|
||||||
|
expect(dondozo.getTag(BattlerTagType.COMMANDED)).toBeDefined();
|
||||||
|
|
||||||
|
game.move.select(Moves.ORDER_UP, 1, BattlerIndex.ENEMY);
|
||||||
|
expect(game.scene.currentBattle.turnCommands[0]?.skip).toBeTruthy();
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("BerryPhase", false);
|
||||||
|
|
||||||
|
const affectedStats: EffectiveStat[] = [ Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.SPD ];
|
||||||
|
affectedStats.forEach(st => expect(dondozo.getStatStage(st)).toBe(st === stat ? 3 : 2));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should be boosted by Sheer Force while still applying a stat boost", async () => {
|
||||||
|
game.override
|
||||||
|
.passiveAbility(Abilities.SHEER_FORCE)
|
||||||
|
.starterForms({ [Species.TATSUGIRI]: 0 });
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.TATSUGIRI, Species.DONDOZO ]);
|
||||||
|
|
||||||
|
const [ tatsugiri, dondozo ] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
expect(game.scene.triggerPokemonBattleAnim).toHaveBeenLastCalledWith(tatsugiri, PokemonAnimType.COMMANDER_APPLY);
|
||||||
|
expect(dondozo.getTag(BattlerTagType.COMMANDED)).toBeDefined();
|
||||||
|
|
||||||
|
game.move.select(Moves.ORDER_UP, 1, BattlerIndex.ENEMY);
|
||||||
|
expect(game.scene.currentBattle.turnCommands[0]?.skip).toBeTruthy();
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("BerryPhase", false);
|
||||||
|
|
||||||
|
expect(dondozo.battleData.abilitiesApplied.includes(Abilities.SHEER_FORCE)).toBeTruthy();
|
||||||
|
expect(dondozo.getStatStage(Stat.ATK)).toBe(3);
|
||||||
|
});
|
||||||
|
});
|
60
src/test/phases/form-change-phase.test.ts
Normal file
60
src/test/phases/form-change-phase.test.ts
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
import { Type } from "#app/data/type";
|
||||||
|
import { generateModifierType } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
|
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||||
|
|
||||||
|
describe("Form Change Phase", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.moveset([ Moves.SPLASH ])
|
||||||
|
.ability(Abilities.BALL_FETCH)
|
||||||
|
.battleType("single")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(Species.MAGIKARP)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.SPLASH);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Zacian should successfully change into Crowned form", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.ZACIAN ]);
|
||||||
|
|
||||||
|
// Before the form change: Should be Hero form
|
||||||
|
const zacian = game.scene.getPlayerParty()[0];
|
||||||
|
expect(zacian.getFormKey()).toBe("hero-of-many-battles");
|
||||||
|
expect(zacian.getTypes()).toStrictEqual([ Type.FAIRY ]);
|
||||||
|
expect(zacian.calculateBaseStats()).toStrictEqual([ 92, 120, 115, 80, 115, 138 ]);
|
||||||
|
|
||||||
|
// Give Zacian a Rusted Sword
|
||||||
|
const rustedSwordType = generateModifierType(game.scene, modifierTypes.RARE_FORM_CHANGE_ITEM)!;
|
||||||
|
const rustedSword = rustedSwordType.newModifier(zacian);
|
||||||
|
await game.scene.addModifier(rustedSword);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
// After the form change: Should be Crowned form
|
||||||
|
expect(game.phaseInterceptor.log.includes("FormChangePhase")).toBe(true);
|
||||||
|
expect(zacian.getFormKey()).toBe("crowned");
|
||||||
|
expect(zacian.getTypes()).toStrictEqual([ Type.FAIRY, Type.STEEL ]);
|
||||||
|
expect(zacian.calculateBaseStats()).toStrictEqual([ 92, 150, 115, 80, 115, 148 ]);
|
||||||
|
});
|
||||||
|
});
|
@ -35,7 +35,7 @@ export class ClassicModeHelper extends GameManagerHelper {
|
|||||||
selectStarterPhase.initBattle(starters);
|
selectStarterPhase.initBattle(starters);
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.game.phaseInterceptor.run(EncounterPhase);
|
await this.game.phaseInterceptor.to(EncounterPhase);
|
||||||
if (overrides.OPP_HELD_ITEMS_OVERRIDE.length === 0 && this.game.override.removeEnemyStartingItems) {
|
if (overrides.OPP_HELD_ITEMS_OVERRIDE.length === 0 && this.game.override.removeEnemyStartingItems) {
|
||||||
this.game.removeEnemyHeldItems();
|
this.game.removeEnemyHeldItems();
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import { EndEvolutionPhase } from "#app/phases/end-evolution-phase";
|
|||||||
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
|
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
|
||||||
import { EvolutionPhase } from "#app/phases/evolution-phase";
|
import { EvolutionPhase } from "#app/phases/evolution-phase";
|
||||||
import { FaintPhase } from "#app/phases/faint-phase";
|
import { FaintPhase } from "#app/phases/faint-phase";
|
||||||
|
import { FormChangePhase } from "#app/phases/form-change-phase";
|
||||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
||||||
import { LevelCapPhase } from "#app/phases/level-cap-phase";
|
import { LevelCapPhase } from "#app/phases/level-cap-phase";
|
||||||
import { LoginPhase } from "#app/phases/login-phase";
|
import { LoginPhase } from "#app/phases/login-phase";
|
||||||
@ -67,7 +68,6 @@ type PhaseClass =
|
|||||||
| typeof LoginPhase
|
| typeof LoginPhase
|
||||||
| typeof TitlePhase
|
| typeof TitlePhase
|
||||||
| typeof SelectGenderPhase
|
| typeof SelectGenderPhase
|
||||||
| typeof EncounterPhase
|
|
||||||
| typeof NewBiomeEncounterPhase
|
| typeof NewBiomeEncounterPhase
|
||||||
| typeof SelectStarterPhase
|
| typeof SelectStarterPhase
|
||||||
| typeof PostSummonPhase
|
| typeof PostSummonPhase
|
||||||
@ -102,6 +102,7 @@ type PhaseClass =
|
|||||||
| typeof SwitchPhase
|
| typeof SwitchPhase
|
||||||
| typeof SwitchSummonPhase
|
| typeof SwitchSummonPhase
|
||||||
| typeof PartyHealPhase
|
| typeof PartyHealPhase
|
||||||
|
| typeof FormChangePhase
|
||||||
| typeof EvolutionPhase
|
| typeof EvolutionPhase
|
||||||
| typeof EndEvolutionPhase
|
| typeof EndEvolutionPhase
|
||||||
| typeof LevelCapPhase
|
| typeof LevelCapPhase
|
||||||
@ -114,13 +115,13 @@ type PhaseClass =
|
|||||||
| typeof PostMysteryEncounterPhase
|
| typeof PostMysteryEncounterPhase
|
||||||
| typeof ModifierRewardPhase
|
| typeof ModifierRewardPhase
|
||||||
| typeof PartyExpPhase
|
| typeof PartyExpPhase
|
||||||
| typeof ExpPhase;
|
| typeof ExpPhase
|
||||||
|
| typeof EncounterPhase;
|
||||||
|
|
||||||
type PhaseString =
|
type PhaseString =
|
||||||
| "LoginPhase"
|
| "LoginPhase"
|
||||||
| "TitlePhase"
|
| "TitlePhase"
|
||||||
| "SelectGenderPhase"
|
| "SelectGenderPhase"
|
||||||
| "EncounterPhase"
|
|
||||||
| "NewBiomeEncounterPhase"
|
| "NewBiomeEncounterPhase"
|
||||||
| "SelectStarterPhase"
|
| "SelectStarterPhase"
|
||||||
| "PostSummonPhase"
|
| "PostSummonPhase"
|
||||||
@ -155,6 +156,7 @@ type PhaseString =
|
|||||||
| "SwitchPhase"
|
| "SwitchPhase"
|
||||||
| "SwitchSummonPhase"
|
| "SwitchSummonPhase"
|
||||||
| "PartyHealPhase"
|
| "PartyHealPhase"
|
||||||
|
| "FormChangePhase"
|
||||||
| "EvolutionPhase"
|
| "EvolutionPhase"
|
||||||
| "EndEvolutionPhase"
|
| "EndEvolutionPhase"
|
||||||
| "LevelCapPhase"
|
| "LevelCapPhase"
|
||||||
@ -167,7 +169,8 @@ type PhaseString =
|
|||||||
| "PostMysteryEncounterPhase"
|
| "PostMysteryEncounterPhase"
|
||||||
| "ModifierRewardPhase"
|
| "ModifierRewardPhase"
|
||||||
| "PartyExpPhase"
|
| "PartyExpPhase"
|
||||||
| "ExpPhase";
|
| "ExpPhase"
|
||||||
|
| "EncounterPhase";
|
||||||
|
|
||||||
type PhaseInterceptorPhase = PhaseClass | PhaseString;
|
type PhaseInterceptorPhase = PhaseClass | PhaseString;
|
||||||
|
|
||||||
@ -187,12 +190,16 @@ export default class PhaseInterceptor {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List of phases with their corresponding start methods.
|
* List of phases with their corresponding start methods.
|
||||||
|
*
|
||||||
|
* CAUTION: If a phase and its subclasses (if any) both appear in this list,
|
||||||
|
* make sure that this list contains said phase AFTER all of its subclasses.
|
||||||
|
* This way, the phase's `prototype.start` is properly preserved during
|
||||||
|
* `initPhases()` so that its subclasses can use `super.start()` properly.
|
||||||
*/
|
*/
|
||||||
private PHASES = [
|
private PHASES = [
|
||||||
[ LoginPhase, this.startPhase ],
|
[ LoginPhase, this.startPhase ],
|
||||||
[ TitlePhase, this.startPhase ],
|
[ TitlePhase, this.startPhase ],
|
||||||
[ SelectGenderPhase, this.startPhase ],
|
[ SelectGenderPhase, this.startPhase ],
|
||||||
[ EncounterPhase, this.startPhase ],
|
|
||||||
[ NewBiomeEncounterPhase, this.startPhase ],
|
[ NewBiomeEncounterPhase, this.startPhase ],
|
||||||
[ SelectStarterPhase, this.startPhase ],
|
[ SelectStarterPhase, this.startPhase ],
|
||||||
[ PostSummonPhase, this.startPhase ],
|
[ PostSummonPhase, this.startPhase ],
|
||||||
@ -227,6 +234,7 @@ export default class PhaseInterceptor {
|
|||||||
[ SwitchPhase, this.startPhase ],
|
[ SwitchPhase, this.startPhase ],
|
||||||
[ SwitchSummonPhase, this.startPhase ],
|
[ SwitchSummonPhase, this.startPhase ],
|
||||||
[ PartyHealPhase, this.startPhase ],
|
[ PartyHealPhase, this.startPhase ],
|
||||||
|
[ FormChangePhase, this.startPhase ],
|
||||||
[ EvolutionPhase, this.startPhase ],
|
[ EvolutionPhase, this.startPhase ],
|
||||||
[ EndEvolutionPhase, this.startPhase ],
|
[ EndEvolutionPhase, this.startPhase ],
|
||||||
[ LevelCapPhase, this.startPhase ],
|
[ LevelCapPhase, this.startPhase ],
|
||||||
@ -240,6 +248,7 @@ export default class PhaseInterceptor {
|
|||||||
[ ModifierRewardPhase, this.startPhase ],
|
[ ModifierRewardPhase, this.startPhase ],
|
||||||
[ PartyExpPhase, this.startPhase ],
|
[ PartyExpPhase, this.startPhase ],
|
||||||
[ ExpPhase, this.startPhase ],
|
[ ExpPhase, this.startPhase ],
|
||||||
|
[ EncounterPhase, this.startPhase ],
|
||||||
];
|
];
|
||||||
|
|
||||||
private endBySetMode = [
|
private endBySetMode = [
|
||||||
|
Loading…
Reference in New Issue
Block a user