mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-27 02:32:21 +02:00
Make tera retain until forced recall or faint, regain on biome change
This commit is contained in:
parent
d5ce9ae048
commit
b16754e631
@ -1372,6 +1372,7 @@ export default class BattleScene extends SceneBase {
|
||||
|
||||
for (const pokemon of this.getPlayerParty()) {
|
||||
pokemon.resetBattleData();
|
||||
pokemon.resetTera();
|
||||
applyPostBattleInitAbAttrs(PostBattleInitAbAttr, pokemon);
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ export class Arena {
|
||||
public bgm: string;
|
||||
public ignoreAbilities: boolean;
|
||||
public ignoringEffectSource: BattlerIndex | null;
|
||||
public playerTerasUsed: number;
|
||||
|
||||
private lastTimeOfDay: TimeOfDay;
|
||||
|
||||
@ -58,6 +59,7 @@ export class Arena {
|
||||
this.bgm = bgm;
|
||||
this.trainerPool = biomeTrainerPools[biome];
|
||||
this.updatePoolsForTimeOfDay();
|
||||
this.playerTerasUsed = 0;
|
||||
}
|
||||
|
||||
init() {
|
||||
|
@ -3796,12 +3796,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
|
||||
resetBattleData(): void {
|
||||
this.battleData = new PokemonBattleData();
|
||||
const wasTerastallized = this.isTerastallized;
|
||||
this.isTerastallized = false;
|
||||
if (wasTerastallized) {
|
||||
this.updateSpritePipelineData();
|
||||
globalScene.triggerPokemonFormChange(this, SpeciesFormChangeLapseTeraTrigger);
|
||||
}
|
||||
}
|
||||
|
||||
resetBattleSummonData(): void {
|
||||
@ -3814,6 +3808,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
}
|
||||
|
||||
resetTera(): void {
|
||||
const wasTerastallized = this.isTerastallized;
|
||||
this.isTerastallized = false;
|
||||
if (wasTerastallized) {
|
||||
this.updateSpritePipelineData();
|
||||
globalScene.triggerPokemonFormChange(this, SpeciesFormChangeLapseTeraTrigger);
|
||||
}
|
||||
}
|
||||
|
||||
resetTurnData(): void {
|
||||
this.turnData = new PokemonTurnData();
|
||||
}
|
||||
|
@ -109,6 +109,8 @@ export class FaintPhase extends PokemonPhase {
|
||||
globalScene.queueMessage(i18next.t("battle:fainted", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }), null, true);
|
||||
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeActiveTrigger, true);
|
||||
|
||||
pokemon.resetTera();
|
||||
|
||||
if (pokemon.turnData?.attacksReceived?.length) {
|
||||
const lastAttack = pokemon.turnData.attacksReceived[0];
|
||||
applyPostFaintAbAttrs(PostFaintAbAttr, pokemon, globalScene.getPokemonById(lastAttack.sourceId)!, new PokemonMove(lastAttack.move).getMove(), lastAttack.result); // TODO: is this bang correct?
|
||||
|
@ -36,5 +36,6 @@ export class PartyHealPhase extends BattlePhase {
|
||||
globalScene.ui.fadeIn(500).then(() => this.end());
|
||||
});
|
||||
});
|
||||
globalScene.arena.playerTerasUsed = 0;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,8 @@ import { globalScene } from "#app/global-scene";
|
||||
import { Type } from "#app/enums/type";
|
||||
import { achvs } from "#app/system/achv";
|
||||
import { SpeciesFormChangeTeraTrigger } from "#app/data/pokemon-forms";
|
||||
import { CommonAnim, CommonBattleAnim } from "#app/data/battle-anims";
|
||||
import { CommonAnim } from "#app/data/battle-anims";
|
||||
import { CommonAnimPhase } from "./common-anim-phase";
|
||||
|
||||
export class TeraPhase extends BattlePhase {
|
||||
public pokemon: Pokemon;
|
||||
@ -32,9 +33,8 @@ export class TeraPhase extends BattlePhase {
|
||||
// parent.add(teraburst);
|
||||
// this.pokemon.scene.time.delayedCall(Utils.fixedInt(Math.floor((1000 / 12) * 13)), () => teraburst.destroy());
|
||||
|
||||
new CommonBattleAnim(CommonAnim.TERASTALLIZE, this.pokemon).play();
|
||||
globalScene.queueMessage(getPokemonNameWithAffix(this.pokemon) + " terrastallized into a " + i18next.t(`pokemonInfo:Type.${Type[this.pokemon.teraType]}`) + " type!"); // TODO: Localize this
|
||||
// this.scene.unshiftPhase(new CommonAnimPhase(this.scene, this.pokemon.getBattlerIndex(), undefined, CommonAnim.???));
|
||||
globalScene.unshiftPhase(new CommonAnimPhase(this.pokemon.getBattlerIndex(), this.pokemon.getBattlerIndex(), CommonAnim.TERASTALLIZE, false));
|
||||
|
||||
this.end();
|
||||
}
|
||||
@ -44,6 +44,10 @@ export class TeraPhase extends BattlePhase {
|
||||
this.pokemon.isTerastallized = true;
|
||||
this.pokemon.updateSpritePipelineData();
|
||||
|
||||
if (this.pokemon.isPlayer()) {
|
||||
globalScene.arena.playerTerasUsed += 1;
|
||||
}
|
||||
|
||||
globalScene.triggerPokemonFormChange(this.pokemon, SpeciesFormChangeTeraTrigger);
|
||||
|
||||
if (this.pokemon.isPlayer()) {
|
||||
|
@ -10,12 +10,14 @@ export default class ArenaData {
|
||||
public weather: Weather | null;
|
||||
public terrain: Terrain | null;
|
||||
public tags: ArenaTag[];
|
||||
public playerTerasUsed: number;
|
||||
|
||||
constructor(source: Arena | any) {
|
||||
const sourceArena = source instanceof Arena ? source as Arena : null;
|
||||
this.biome = sourceArena ? sourceArena.biomeType : source.biome;
|
||||
this.weather = sourceArena ? sourceArena.weather : source.weather ? new Weather(source.weather.weatherType, source.weather.turnsLeft) : null;
|
||||
this.terrain = sourceArena ? sourceArena.terrain : source.terrain ? new Terrain(source.terrain.terrainType, source.terrain.turnsLeft) : null;
|
||||
this.playerTerasUsed = sourceArena ? sourceArena.playerTerasUsed : source.playerTerasUsed;
|
||||
this.tags = [];
|
||||
|
||||
if (source.tags) {
|
||||
|
@ -1082,6 +1082,8 @@ export class GameData {
|
||||
globalScene.arena.terrain = sessionData.arena.terrain;
|
||||
globalScene.arena.eventTarget.dispatchEvent(new TerrainChangedEvent(TerrainType.NONE, globalScene.arena.terrain?.terrainType!, globalScene.arena.terrain?.turnsLeft!)); // TODO: is this bang correct?
|
||||
|
||||
globalScene.arena.playerTerasUsed = sessionData.arena.playerTerasUsed;
|
||||
|
||||
globalScene.arena.tags = sessionData.arena.tags;
|
||||
if (globalScene.arena.tags) {
|
||||
for (const tag of globalScene.arena.tags) {
|
||||
|
@ -175,9 +175,9 @@ export default class CommandUiHandler extends UiHandler {
|
||||
|
||||
canTera(): boolean {
|
||||
const hasTeraMod = !!globalScene.getModifiers(TerastallizeAccessModifier).length;
|
||||
const currentTeras = globalScene.getPlayerParty().filter(p => p.isTerastallized).length;
|
||||
const plannedTera = globalScene.currentBattle.preTurnCommands[0]?.command === Command.TERA;
|
||||
return hasTeraMod && currentTeras < 1 && !plannedTera;
|
||||
const currentTeras = globalScene.arena.playerTerasUsed;
|
||||
const plannedTera = globalScene.currentBattle.preTurnCommands[0]?.command === Command.TERA ? 1 : 0;
|
||||
return hasTeraMod && (currentTeras + plannedTera) < 1;
|
||||
}
|
||||
|
||||
getCursor(): integer {
|
||||
|
Loading…
Reference in New Issue
Block a user