Implement Order Up (mostly untested)

This commit is contained in:
innerthunder 2024-10-15 22:20:07 -07:00
parent c04d81bd65
commit 83c3b9c4ee
14 changed files with 248 additions and 21 deletions

View File

@ -95,6 +95,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";
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
@ -1273,6 +1274,8 @@ export default class BattleScene extends SceneBase {
if (resetArenaState) { if (resetArenaState) {
this.arena.resetArenaEffects(); this.arena.resetArenaEffects();
playerField.forEach((pokemon) => pokemon.lapseTag(BattlerTagType.COMMANDER));
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));

View File

@ -29,6 +29,7 @@ import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
import { ShowAbilityPhase } from "#app/phases/show-ability-phase"; import { ShowAbilityPhase } from "#app/phases/show-ability-phase";
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase"; import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
import BattleScene from "#app/battle-scene"; import BattleScene from "#app/battle-scene";
import { PokemonAnimType } from "#enums/pokemon-anim-type";
export class Ability implements Localizable { export class Ability implements Localizable {
public id: Abilities; public id: Abilities;
@ -2537,6 +2538,36 @@ 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
*/
export class CommanderAbAttr extends AbAttr {
constructor() {
super(true);
}
override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: null, args: any[]): boolean {
if (pokemon.scene.currentBattle?.double && pokemon.getAlly().species.speciesId === Species.DONDOZO) {
if (pokemon.getAlly().getTag(BattlerTagType.COMMANDER)) {
return false;
}
if (!simulated) {
/** 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.COMMANDER, 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);
@ -5796,9 +5827,9 @@ 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(UncopiableAbilityAbAttr) .attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr) .attr(UnswappableAbilityAbAttr),
.unimplemented(),
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)

View File

@ -2060,6 +2060,35 @@ 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 CommanderTag extends BattlerTag {
private _tatsugiriFormKey: string;
constructor(sourceId: number) {
super(BattlerTagType.COMMANDER, 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 {
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).
@ -2898,6 +2927,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.COMMANDER:
return new CommanderTag(sourceId);
case BattlerTagType.STOCKPILING: case BattlerTagType.STOCKPILING:
return new StockpilingTag(sourceMove); return new StockpilingTag(sourceMove);
case BattlerTagType.OCTOLOCK: case BattlerTagType.OCTOLOCK:

View File

@ -5478,11 +5478,13 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
return false; return false;
} }
/** /** The {@linkcode Pokemon} to be switched out with this effect */
* Move the switch out logic inside the conditional block
* This ensures that the switch out only happens when the conditions are met
*/
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.COMMANDER);
if (switchOutTarget instanceof PlayerPokemon) { if (switchOutTarget instanceof PlayerPokemon) {
// Switch out logic for the player's Pokemon // Switch out logic for the player's Pokemon
if (switchOutTarget.scene.getParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) { if (switchOutTarget.scene.getParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) {
@ -5558,6 +5560,12 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
return false; return false;
} }
// Dondozo with an allied Tatsugiri in its mouth cannot be forced out
const commanderTag = switchOutTarget.getTag(BattlerTagType.COMMANDER);
if (commanderTag?.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;

View File

@ -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.COMMANDER));
playerField.forEach((_, p) => scene.unshiftPhase(new ReturnPhase(scene, p))); playerField.forEach((_, p) => scene.unshiftPhase(new ReturnPhase(scene, p)));
for (const pokemon of scene.getParty()) { for (const pokemon of scene.getParty()) {

View File

@ -87,5 +87,6 @@ export enum BattlerTagType {
IMPRISON = "IMPRISON", IMPRISON = "IMPRISON",
SYRUP_BOMB = "SYRUP_BOMB", SYRUP_BOMB = "SYRUP_BOMB",
ELECTRIFIED = "ELECTRIFIED", ELECTRIFIED = "ELECTRIFIED",
TELEKINESIS = "TELEKINESIS" TELEKINESIS = "TELEKINESIS",
COMMANDER = "COMMANDER"
} }

View File

@ -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
} }

View File

@ -1511,6 +1511,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* @returns * @returns
*/ */
isTrapped(trappedAbMessages: string[] = [], simulated: boolean = true): boolean { isTrapped(trappedAbMessages: string[] = [], simulated: boolean = true): boolean {
const commanderTag = this.getTag(BattlerTagType.COMMANDER);
if (commanderTag?.getSourcePokemon(this.scene)?.isActive(true)) {
return true;
}
if (this.isOfType(Type.GHOST)) { if (this.isOfType(Type.GHOST)) {
return false; return false;
} }
@ -2812,6 +2817,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(), isOneHitKo)); this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex(), isOneHitKo));
this.destroySubstitute(); this.destroySubstitute();
this.lapseTag(BattlerTagType.COMMANDER);
this.resetSummonData(); this.resetSummonData();
} }
@ -2864,6 +2870,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.COMMANDER);
this.resetSummonData(); this.resetSummonData();
} }

View File

@ -47,6 +47,11 @@ export class CommandPhase extends FieldPhase {
return this.end(); return this.end();
} }
// If the Pokemon has applied Commander's effects to its ally, skip this command
if (this.scene.currentBattle?.double && this.getPokemon().getAlly()?.getTag(BattlerTagType.COMMANDER)?.getSourcePokemon(this.scene) === this.getPokemon()) {
return this.end();
}
const playerPokemon = this.scene.getPlayerField()[this.fieldIndex]; const playerPokemon = this.scene.getPlayerField()[this.fieldIndex];
const moveQueue = playerPokemon.getMoveQueue(); const moveQueue = playerPokemon.getMoveQueue();
@ -81,7 +86,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:
@ -220,11 +225,8 @@ export class CommandPhase extends FieldPhase {
} else { } else {
const trapTag = playerPokemon.getTag(TrappedTag); const trapTag = playerPokemon.getTag(TrappedTag);
// trapTag should be defined at this point, but just in case...
if (!trapTag) { if (!trapTag) {
currentBattle.turnCommands[this.fieldIndex] = isSwitch i18next.t(`battle:noEscape${isSwitch ? "Switch" : "Flee"}`);
? { command: Command.POKEMON, cursor: cursor, args: args }
: { command: Command.RUN };
break; break;
} }
@ -250,11 +252,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() {

View File

@ -35,6 +35,7 @@ import { getEncounterText } from "#app/data/mystery-encounters/utils/encounter-d
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases"; import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
import { getGoldenBugNetSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils"; import { getGoldenBugNetSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
import { Biome } from "#enums/biome"; import { Biome } from "#enums/biome";
import { BattlerTagType } from "#enums/battler-tag-type";
export class EncounterPhase extends BattlePhase { export class EncounterPhase extends BattlePhase {
private loaded: boolean; private loaded: boolean;
@ -474,6 +475,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.COMMANDER));
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));

View File

@ -153,11 +153,14 @@ export class MoveEffectPhase extends PokemonPhase {
const isImmune = target.hasAbilityWithAttr(TypeImmunityAbAttr) && (target.getAbility()?.getAttrs(TypeImmunityAbAttr)?.[0]?.getImmuneType() === user.getMoveType(move)) const isImmune = target.hasAbilityWithAttr(TypeImmunityAbAttr) && (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.COMMANDER)?.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) {

View File

@ -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.COMMANDER));
scene.pushPhase(new ReturnPhase(scene, 1)); scene.pushPhase(new ReturnPhase(scene, 1));
} }
scene.pushPhase(new ToggleDoublePositionPhase(scene, false)); scene.pushPhase(new ToggleDoublePositionPhase(scene, false));

View File

@ -3,6 +3,7 @@ import { SubstituteTag } from "#app/data/battler-tags";
import { PokemonAnimType } from "#enums/pokemon-anim-type"; 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 { Species } from "#enums/species";
export class PokemonAnimPhase extends BattlePhase { export class PokemonAnimPhase extends BattlePhase {
@ -37,12 +38,18 @@ 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 (substitute === null) {
return this.end(); return this.end();
@ -106,7 +113,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 +142,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 +171,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 +240,120 @@ 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 getSourceSprite = () => {
const sprite = this.scene.addPokemonSprite(this.pokemon, this.pokemon.x + this.pokemon.getSprite().x, this.pokemon.y + this.pokemon.getSprite().y, 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,
ease: "Cubic.easeOut",
scale: 0.5,
x: (_target, _key, value: number) => value + (dondozoFpOffset[0] - sourceFpOffset[0]) / 2,
y: (this.pokemon.isPlayer() ? 100 : 65) + sourceFpOffset[1],
onComplete: () => {
this.scene.field.bringToTop(dondozo);
this.scene.tweens.add({
targets: sourceSprite,
duration: 375,
ease: "Cubic.easeIn",
scale: 0.01,
x: (_target, _key, value: number) => value + (dondozoFpOffset[0] - sourceFpOffset[0]) / 2,
y: dondozo.y + dondozo.height / 2,
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();
}
});
}
});
}
} }

View File

@ -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));
} }
} }