Implement Shed Skin (and Hydration!) (#84)

* Implement Shed Skin (and Hydration!)

Implemented Shed Skin, with a 1/3 chance to remove a non-volatile status condition if inflicted with it at the end of each turn. While doing this I noticed Hydration is the same effect but in Rain/Heavy Rain, so I implemented that too.

* Update to ability.ts based on changes.

Formatting errors should be largely fixed, and we've switched from Math.rand to Utils.

* Update src/data/ability.ts

---------

Co-authored-by: Samuel H <flashfireex@gmail.com>
pull/86/head
AppleOfTheDark 2024-04-11 05:16:09 +01:00 committed by GitHub
parent b2beb8e0c8
commit b9a068e3b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 3 deletions

View File

@ -7,7 +7,7 @@ import { getPokemonMessage } from "../messages";
import { Weather, WeatherType } from "./weather";
import { BattlerTag } from "./battler-tags";
import { BattlerTagType } from "./enums/battler-tag-type";
import { StatusEffect, getStatusEffectDescriptor } from "./status-effect";
import { StatusEffect, getStatusEffectDescriptor, getStatusEffectHealText } from "./status-effect";
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, RecoilAttr, StatusMoveTypeImmunityAttr, allMoves } from "./move";
import { ArenaTagType } from "./enums/arena-tag-type";
import { Stat } from "./pokemon-stat";
@ -1366,6 +1366,20 @@ export class PostTurnAbAttr extends AbAttr {
}
}
export class PostTurnResetStatusAbAttr extends PostTurnAbAttr {
applyPostTurn(pokemon: Pokemon, args: any[]): boolean {
if (pokemon.status) {
pokemon.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectHealText(pokemon.status?.effect)));
pokemon.resetStatus();
pokemon.updateInfo();
return true;
}
return false;
}
}
export class PostTurnStatChangeAbAttr extends PostTurnAbAttr {
private stats: BattleStat[];
private levels: integer;
@ -2376,7 +2390,8 @@ export function initAbilities() {
.attr(BlockItemTheftAbAttr)
.passive()
.ignorable(),
new Ability(Abilities.SHED_SKIN, "Shed Skin (N)", "The Pokémon may heal its own status conditions by shedding its skin.", 3),
new Ability(Abilities.SHED_SKIN, "Shed Skin", "The Pokémon may heal its own status conditions by shedding its skin.", 3)
.conditionalAttr(pokemon => !Utils.randSeedInt(3), PostTurnResetStatusAbAttr),
new Ability(Abilities.GUTS, "Guts", "It's so gutsy that having a status condition boosts the Pokémon's Attack stat.", 3)
.attr(BypassBurnDamageReductionAbAttr)
.conditionalAttr(pokemon => !!pokemon.status, BattleStatMultiplierAbAttr, BattleStat.ATK, 1.5),
@ -2451,7 +2466,9 @@ export function initAbilities() {
.attr(StabBoostAbAttr),
new Ability(Abilities.SKILL_LINK, "Skill Link", "Maximizes the number of times multistrike moves hit.", 4)
.attr(MaxMultiHitAbAttr),
new Ability(Abilities.HYDRATION, "Hydration (N)", "Heals status conditions if it's raining.", 4),
new Ability(Abilities.HYDRATION, "Hydration", "Heals status conditions if it's raining.", 4)
.attr(PostTurnResetStatusAbAttr)
.condition(getWeatherCondition(WeatherType.RAIN, WeatherType.HEAVY_RAIN)),
new Ability(Abilities.SOLAR_POWER, "Solar Power", "Boosts the Sp. Atk stat in harsh sunlight, but HP decreases every turn.", 4)
.attr(PostWeatherLapseDamageAbAttr, 2, WeatherType.SUNNY, WeatherType.HARSH_SUN)
.attr(BattleStatMultiplierAbAttr, BattleStat.SPATK, 1.5)