mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-12 03:12:18 +02:00
adding some docs
This commit is contained in:
parent
f6e99f1f6c
commit
561d1da336
@ -57,7 +57,7 @@ export class Arena {
|
|||||||
this.scene.arenaBg.setTexture(`${biomeKey}_bg`);
|
this.scene.arenaBg.setTexture(`${biomeKey}_bg`);
|
||||||
this.scene.arenaBgTransition.setTexture(`${biomeKey}_bg`);
|
this.scene.arenaBgTransition.setTexture(`${biomeKey}_bg`);
|
||||||
|
|
||||||
// Redo this on initialise because during save/load the current wave isn't always
|
// Redo this on initialize because during save/load the current wave isn't always
|
||||||
// set correctly during construction
|
// set correctly during construction
|
||||||
this.updatePoolsForTimeOfDay();
|
this.updatePoolsForTimeOfDay();
|
||||||
}
|
}
|
||||||
@ -286,8 +286,8 @@ export class Arena {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets weather to the override specified in overrides.ts
|
* Sets weather to the override specified in overrides.ts
|
||||||
* @param weather new weather to set of type WeatherType
|
* @param weather {@linkcode WeatherType} new weather to set of type WeatherType
|
||||||
* @returns true to force trySetWeather to return true
|
* @returns boolean - true to force trySetWeather to return true
|
||||||
*/
|
*/
|
||||||
trySetWeatherOverride(weather: WeatherType): boolean {
|
trySetWeatherOverride(weather: WeatherType): boolean {
|
||||||
this.weather = new Weather(weather, 0);
|
this.weather = new Weather(weather, 0);
|
||||||
@ -298,8 +298,8 @@ export class Arena {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to set a new weather to the battle
|
* Attempts to set a new weather to the battle
|
||||||
* @param weather new weather to set of type WeatherType
|
* @param weather {@linkcode WeatherType} new weather to set of type WeatherType
|
||||||
* @param hasPokemonSource is the new weather from a pokemon
|
* @param hasPokemonSource boolean if the new weather is from a pokemon
|
||||||
* @returns true if new weather set, false if no weather provided or attempting to set the same weather as currently in use
|
* @returns true if new weather set, false if no weather provided or attempting to set the same weather as currently in use
|
||||||
*/
|
*/
|
||||||
trySetWeather(weather: WeatherType, hasPokemonSource: boolean): boolean {
|
trySetWeather(weather: WeatherType, hasPokemonSource: boolean): boolean {
|
||||||
@ -540,6 +540,12 @@ export class Arena {
|
|||||||
this.ignoreAbilities = ignoreAbilities;
|
this.ignoreAbilities = ignoreAbilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies each ArenaTag in this Arena, based on which side (self, enemy, or both) is based in as a parameter
|
||||||
|
* @param tagType {@linkcode ArenaTagType} {@linkcode ArenaTag} Either an ArenaTagType string, or an actual ArenaTag class to filter which ones to apply
|
||||||
|
* @param side {@linkcode ArenaTagSide} which side's arena tags to apply
|
||||||
|
* @param args array of parameters that the called upon tags may need
|
||||||
|
*/
|
||||||
applyTagsForSide(tagType: ArenaTagType | Constructor<ArenaTag>, side: ArenaTagSide, ...args: unknown[]): void {
|
applyTagsForSide(tagType: ArenaTagType | Constructor<ArenaTag>, side: ArenaTagSide, ...args: unknown[]): void {
|
||||||
let tags = typeof tagType === "string"
|
let tags = typeof tagType === "string"
|
||||||
? this.tags.filter(t => t.tagType === tagType)
|
? this.tags.filter(t => t.tagType === tagType)
|
||||||
@ -550,10 +556,27 @@ export class Arena {
|
|||||||
tags.forEach(t => t.apply(this, args));
|
tags.forEach(t => t.apply(this, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies the specified tag to both sides (ie: both user and trainer's tag that match the Tag specified)
|
||||||
|
* by calling applyTagsForSide() {@linkcode applyTagsForSide}
|
||||||
|
* @param tagType {@linkcode ArenaTagType} {@linkcode ArenaTag} Either an ArenaTagType string, or an actual ArenaTag class to filter which ones to apply
|
||||||
|
* @param args array of parameters that the called upon tags may need
|
||||||
|
*/
|
||||||
applyTags(tagType: ArenaTagType | Constructor<ArenaTag>, ...args: unknown[]): void {
|
applyTags(tagType: ArenaTagType | Constructor<ArenaTag>, ...args: unknown[]): void {
|
||||||
this.applyTagsForSide(tagType, ArenaTagSide.BOTH, ...args);
|
this.applyTagsForSide(tagType, ArenaTagSide.BOTH, ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new tag to the arena
|
||||||
|
* @param tagType {@linkcode ArenaTagType} the tag being added
|
||||||
|
* @param turnCount integer for how many turns the tag lasts
|
||||||
|
* @param sourceMove {@linkcode Moves} the move the tag came from (can also be undefined if not from a move)
|
||||||
|
* @param sourceId integer the specific pokemon in play the tag came from (see {@linkcode BattleScene.getPokemonById})
|
||||||
|
* @param side {@linkcode ArenaTagSide} which side(s) the tag applies
|
||||||
|
* @param quiet boolean if a message should be queued on screen to announce the tag being added
|
||||||
|
* @param targetIndex {@linkcode BattlerIndex} potential parameter of specific tag being created
|
||||||
|
* @returns boolean if there already exists a tag of this type in the Arena
|
||||||
|
*/
|
||||||
addTag(tagType: ArenaTagType, turnCount: integer, sourceMove: Moves | undefined, sourceId: integer, side: ArenaTagSide = ArenaTagSide.BOTH, quiet: boolean = false, targetIndex?: BattlerIndex): boolean {
|
addTag(tagType: ArenaTagType, turnCount: integer, sourceMove: Moves | undefined, sourceId: integer, side: ArenaTagSide = ArenaTagSide.BOTH, quiet: boolean = false, targetIndex?: BattlerIndex): boolean {
|
||||||
const existingTag = this.getTagOnSide(tagType, side);
|
const existingTag = this.getTagOnSide(tagType, side);
|
||||||
if (existingTag) {
|
if (existingTag) {
|
||||||
@ -567,6 +590,7 @@ export class Arena {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// creates a new tag object
|
||||||
const newTag = getArenaTag(tagType, turnCount || 0, sourceMove, sourceId, targetIndex, side);
|
const newTag = getArenaTag(tagType, turnCount || 0, sourceMove, sourceId, targetIndex, side);
|
||||||
if (newTag) {
|
if (newTag) {
|
||||||
this.tags.push(newTag);
|
this.tags.push(newTag);
|
||||||
@ -580,20 +604,43 @@ export class Arena {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to get a tag from the Arena via {@linkcode getTagOnSide} that applies to both sides
|
||||||
|
* @param tagType {@linkcode ArenaTagType} or {@linkcode ArenaTag} the tag to get
|
||||||
|
* @returns either the {@linkcode ArenaTag}, or undefined if it isn't there
|
||||||
|
*/
|
||||||
getTag(tagType: ArenaTagType | Constructor<ArenaTag>): ArenaTag | undefined {
|
getTag(tagType: ArenaTagType | Constructor<ArenaTag>): ArenaTag | undefined {
|
||||||
return this.getTagOnSide(tagType, ArenaTagSide.BOTH);
|
return this.getTagOnSide(tagType, ArenaTagSide.BOTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to get a tag from the Arena from a specific side (the tag passed in has to either apply to both sides, or the specific side only)
|
||||||
|
* eg: MIST only applies to the user's side, while MUD_SPORT applies to both user and enemy side
|
||||||
|
* @param tagType {@linkcode ArenaTagType} or {@linkArenaTag} the tag to get
|
||||||
|
* @param side {@linkcode ArenaTagSide} the side to look at
|
||||||
|
* @returns either the {@linkcode ArenaTag}, or undefined if it isn't there
|
||||||
|
*/
|
||||||
getTagOnSide(tagType: ArenaTagType | Constructor<ArenaTag>, side: ArenaTagSide): ArenaTag | undefined {
|
getTagOnSide(tagType: ArenaTagType | Constructor<ArenaTag>, side: ArenaTagSide): ArenaTag | undefined {
|
||||||
return typeof(tagType) === "string"
|
return typeof(tagType) === "string"
|
||||||
? this.tags.find(t => t.tagType === tagType && (side === ArenaTagSide.BOTH || t.side === ArenaTagSide.BOTH || t.side === side))
|
? this.tags.find(t => t.tagType === tagType && (side === ArenaTagSide.BOTH || t.side === ArenaTagSide.BOTH || t.side === side))
|
||||||
: this.tags.find(t => t instanceof tagType && (side === ArenaTagSide.BOTH || t.side === ArenaTagSide.BOTH || t.side === side));
|
: this.tags.find(t => t instanceof tagType && (side === ArenaTagSide.BOTH || t.side === ArenaTagSide.BOTH || t.side === side));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses{@linkcode findTagsOnSide} to filter (using the parameter function) for specific tags that apply to both sides
|
||||||
|
* @param tagPredicate a function mapping {@linkcode ArenaTag}'s to boolean
|
||||||
|
* @returns array of {@linkcode ArenaTag}s from which the Arena's tags return true and apply to both sides
|
||||||
|
*/
|
||||||
findTags(tagPredicate: (t: ArenaTag) => boolean): ArenaTag[] {
|
findTags(tagPredicate: (t: ArenaTag) => boolean): ArenaTag[] {
|
||||||
return this.findTagsOnSide(tagPredicate, ArenaTagSide.BOTH);
|
return this.findTagsOnSide(tagPredicate, ArenaTagSide.BOTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns specific tags from the arena that pass the tagPredicate function passed in as a parameter, and apply to the given side
|
||||||
|
* @param tagPredicate a function mapping {@linkcode ArenaTag}'s to boolean
|
||||||
|
* @param side {@linkcode ArenaTagSide} the side to look at
|
||||||
|
* @returns array of {@linkcode ArenaTag}s from which the Arena's tags return true and apply to the given side
|
||||||
|
*/
|
||||||
findTagsOnSide(tagPredicate: (t: ArenaTag) => boolean, side: ArenaTagSide): ArenaTag[] {
|
findTagsOnSide(tagPredicate: (t: ArenaTag) => boolean, side: ArenaTagSide): ArenaTag[] {
|
||||||
return this.tags.filter(t => tagPredicate(t) && (side === ArenaTagSide.BOTH || t.side === ArenaTagSide.BOTH || t.side === side));
|
return this.tags.filter(t => tagPredicate(t) && (side === ArenaTagSide.BOTH || t.side === ArenaTagSide.BOTH || t.side === side));
|
||||||
}
|
}
|
||||||
|
@ -4222,7 +4222,7 @@ export interface AttackMoveResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PokemonSummonData {
|
export class PokemonSummonData {
|
||||||
public battleStats: integer[] = [ 0, 0, 0, 0, 0, 0, 0 ];
|
public battleStats: integer[] = [ 0, 0, 0, 0, 0, 0, 0 ]; // [Atk, Def, SpAtk, SpDef, Spd, Acc]
|
||||||
public moveQueue: QueuedMove[] = [];
|
public moveQueue: QueuedMove[] = [];
|
||||||
public disabledMove: Moves = Moves.NONE;
|
public disabledMove: Moves = Moves.NONE;
|
||||||
public disabledTurns: integer = 0;
|
public disabledTurns: integer = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user