[Balance] Make megas/max player pokemon unable to tera (#5469)
Co-authored-by: damocleas <damocleas25@gmail.com>
This commit is contained in:
parent
5e469620ef
commit
cabcfcbd39
|
@ -1226,10 +1226,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
/**
|
||||
* Checks if the {@linkcode Pokemon} has is the specified {@linkcode Species} or is fused with it.
|
||||
* @param species the pokemon {@linkcode Species} to check
|
||||
* @param formKey If provided, requires the species to be in that form
|
||||
* @returns `true` if the pokemon is the species or is fused with it, `false` otherwise
|
||||
*/
|
||||
hasSpecies(species: Species): boolean {
|
||||
return this.species.speciesId === species || this.fusionSpecies?.speciesId === species;
|
||||
hasSpecies(species: Species, formKey?: string): boolean {
|
||||
if (Utils.isNullOrUndefined(formKey)) {
|
||||
return this.species.speciesId === species || this.fusionSpecies?.speciesId === species;
|
||||
}
|
||||
|
||||
return (this.species.speciesId === species && this.getFormKey() === formKey) || (this.fusionSpecies?.speciesId === species && this.getFusionFormKey() === formKey);
|
||||
}
|
||||
|
||||
abstract isBoss(): boolean;
|
||||
|
@ -3204,6 +3209,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
return maxForms.includes(this.getFormKey()) || (!!this.getFusionFormKey() && maxForms.includes(this.getFusionFormKey()!));
|
||||
}
|
||||
|
||||
isMega(): boolean {
|
||||
const megaForms = [ SpeciesFormKey.MEGA, SpeciesFormKey.MEGA_X, SpeciesFormKey.MEGA_Y, SpeciesFormKey.PRIMAL ] as string[];
|
||||
return megaForms.includes(this.getFormKey()) || (!!this.getFusionFormKey() && megaForms.includes(this.getFusionFormKey()!));
|
||||
}
|
||||
|
||||
canAddTag(tagType: BattlerTagType): boolean {
|
||||
if (this.getTag(tagType)) {
|
||||
return false;
|
||||
|
|
|
@ -10,6 +10,7 @@ import { globalScene } from "#app/global-scene";
|
|||
import { TerastallizeAccessModifier } from "#app/modifier/modifier";
|
||||
import { Type } from "#app/enums/type";
|
||||
import { getTypeRgb } from "#app/data/type";
|
||||
import { Species } from "#enums/species";
|
||||
|
||||
export enum Command {
|
||||
FIGHT = 0,
|
||||
|
@ -180,9 +181,11 @@ export default class CommandUiHandler extends UiHandler {
|
|||
|
||||
canTera(): boolean {
|
||||
const hasTeraMod = !!globalScene.getModifiers(TerastallizeAccessModifier).length;
|
||||
const activePokemon = globalScene.getField()[this.fieldIndex];
|
||||
const isBlockedForm = activePokemon.isMega() || activePokemon.isMax() || activePokemon.hasSpecies(Species.NECROZMA, "ultra");
|
||||
const currentTeras = globalScene.arena.playerTerasUsed;
|
||||
const plannedTera = globalScene.currentBattle.preTurnCommands[0]?.command === Command.TERA && this.fieldIndex > 0 ? 1 : 0;
|
||||
return hasTeraMod && (currentTeras + plannedTera) < 1;
|
||||
return hasTeraMod && !isBlockedForm && (currentTeras + plannedTera) < 1;
|
||||
}
|
||||
|
||||
toggleTeraButton() {
|
||||
|
|
Loading…
Reference in New Issue