Skip to content

Commit

Permalink
Support having no animation during forme changes
Browse files Browse the repository at this point in the history
  • Loading branch information
HisuianZoroark committed Feb 11, 2024
1 parent 6ed62aa commit 626b470
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
16 changes: 13 additions & 3 deletions play.pokemonshowdown.com/src/battle-animations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1489,8 +1489,8 @@ export class BattleScene implements BattleSceneStub {
updateStatbarIfExists(pokemon: Pokemon, updatePrevhp?: boolean, updateHp?: boolean) {
return pokemon.sprite.updateStatbarIfExists(pokemon, updatePrevhp, updateHp);
}
animTransform(pokemon: Pokemon, isCustomAnim?: boolean, isPermanent?: boolean) {
return pokemon.sprite.animTransform(pokemon, isCustomAnim, isPermanent);
animTransform(pokemon: Pokemon, isCustomAnim?: boolean, isPermanent?: boolean, noAnim?: boolean) {
return pokemon.sprite.animTransform(pokemon, isCustomAnim, isPermanent, noAnim);
}
clearEffects(pokemon: Pokemon) {
return pokemon.sprite.clearEffects();
Expand Down Expand Up @@ -2473,7 +2473,7 @@ export class PokemonSprite extends Sprite {
});
}
}
animTransform(pokemon: Pokemon, isCustomAnim?: boolean, isPermanent?: boolean) {
animTransform(pokemon: Pokemon, isCustomAnim?: boolean, isPermanent?: boolean, noAnim?: boolean) {
if (!this.scene.animating && !isPermanent) return;
let sp = Dex.getSpriteData(pokemon, this.isFrontSprite, {
gen: this.scene.gen,
Expand All @@ -2498,6 +2498,16 @@ export class PokemonSprite extends Sprite {
this.cryurl = sp.cryurl;

if (!this.scene.animating) return;

if (noAnim) {
if (isPermanent) {
this.resetStatbar(pokemon);
} else {
this.updateStatbar(pokemon);
}
return;
}

let speciesid = toID(pokemon.getSpeciesForme());
let doCry = false;
const scene = this.scene;
Expand Down
2 changes: 1 addition & 1 deletion play.pokemonshowdown.com/src/battle-scene-stub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class BattleSceneStub {
resetStatbar(pokemon: Pokemon, startHidden?: boolean) { }
updateStatbar(pokemon: Pokemon, updatePrevhp?: boolean, updateHp?: boolean) { }
updateStatbarIfExists(pokemon: Pokemon, updatePrevhp?: boolean, updateHp?: boolean) { }
animTransform(pokemon: Pokemon, isCustomAnim?: boolean, isPermanent?: boolean) { }
animTransform(pokemon: Pokemon, isCustomAnim?: boolean, isPermanent?: boolean, noAnim?: boolean) { }
clearEffects(pokemon: Pokemon) { }
removeTransform(pokemon: Pokemon) { }
animFaint(pokemon: Pokemon) { }
Expand Down
5 changes: 4 additions & 1 deletion play.pokemonshowdown.com/src/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2434,12 +2434,15 @@ export class Battle {
newSpeciesForme = args[2].substr(0, commaIndex);
}
let species = this.dex.species.get(newSpeciesForme);
let teraHangry = false;
if (nextArgs) {
if (nextArgs[0] === '-mega') {
species = this.dex.species.get(this.dex.items.get(nextArgs[3]).megaStone);
} else if (nextArgs[0] === '-primal' && nextArgs.length > 2) {
if (nextArgs[2] === 'Red Orb') species = this.dex.species.get('Groudon-Primal');
if (nextArgs[2] === 'Blue Orb') species = this.dex.species.get('Kyogre-Primal');
} else if (nextArgs[0] === '-terastallize' && species.id === 'morpekohangry') {
teraHangry = true;
}
}

Expand All @@ -2450,7 +2453,7 @@ export class Battle {
poke.searchid = args[1].substr(0, 2) + args[1].substr(3) + '|' + args[2];

let isCustomAnim = species.id !== 'palafinhero';
this.scene.animTransform(poke, isCustomAnim, true);
this.scene.animTransform(poke, isCustomAnim, true, teraHangry);
this.log(args, kwArgs);
break;
}
Expand Down

0 comments on commit 626b470

Please sign in to comment.