Add Documentation

This commit is contained in:
xsn34kzx 2025-03-26 02:27:12 -04:00
parent 38252cc8d8
commit 8731d271ca
2 changed files with 21 additions and 1 deletions

View File

@ -312,7 +312,7 @@ export class Arena {
/**
* Attempts to set a new weather to the battle
* @param weather {@linkcode WeatherType} new {@linkcode WeatherType} to set
* @param hasPokemonSource boolean if the new weather is from a pokemon
* @param user {@linkcode Pokemon} that caused the weather effect
* @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, user?: Pokemon): boolean {
@ -406,6 +406,13 @@ export class Arena {
return !(this.terrain?.terrainType === (terrain || undefined));
}
/**
* Attempts to set a new terrain effect to the battle
* @param terrain {@linkcode TerrainType} new {@linkcode TerrainType} to set
* @param ignoreAnim boolean if the terrain animation should be ignored
* @param user {@linkcode Pokemon} that caused the terrain effect
* @returns true if new terrain set, false if no terrain provided or attempting to set the same terrain as currently in use
*/
trySetTerrain(terrain: TerrainType, ignoreAnim = false, user?: Pokemon): boolean {
if (!this.canSetTerrain(terrain)) {
return false;

View File

@ -2014,7 +2014,20 @@ export class ResetNegativeStatStageModifier extends PokemonHeldItemModifier {
}
}
/**
* Modifier used for held items, namely Mystical Rock, that extend the
* duration of weather and terrain effects.
* @extends PokemonHeldItemModifier
* @see {@linkcode apply}
*/
export class FieldEffectModifier extends PokemonHeldItemModifier {
/**
* Provides two more turns per stack to any weather or terrain effect caused
* by the holder.
* @param pokemon {@linkcode Pokemon} that holds the held item
* @param fieldDuration {@linkcode NumberHolder} that stores the current field effect duration
* @returns `true` if the field effect extension was applied successfully
*/
override apply(_pokemon: Pokemon, fieldDuration: NumberHolder): boolean {
fieldDuration.value += 2 * this.stackCount;
return true;