Skip to content

Commit aa2e0ca

Browse files
Chloroblast recoil refactor
1 parent 942cae7 commit aa2e0ca

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

config/formats.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ export const Formats: import('../sim/dex-formats').FormatList = [
14511451
move.critRatio = (move.critRatio || 1) + (forte.critRatio || 1) - 1;
14521452
const VALID_PROPERTIES = [
14531453
'alwaysHit', 'basePowerCallback', 'breaksProtect', 'drain', 'forceSTAB', 'forceSwitch', 'hasCrashDamage', 'hasSheerForce',
1454-
'ignoreAbility', 'ignoreAccuracy', 'ignoreDefensive', 'ignoreEvasion', 'ignoreImmunity', 'mindBlownRecoil', 'noDamageVariance',
1454+
'ignoreAbility', 'ignoreAccuracy', 'ignoreDefensive', 'ignoreEvasion', 'ignoreImmunity', 'mindBlownRecoil', 'chloroblastRecoil', 'noDamageVariance',
14551455
'ohko', 'overrideDefensivePokemon', 'overrideDefensiveStat', 'overrideOffensivePokemon', 'overrideOffensiveStat', 'pseudoWeather',
14561456
'recoil', 'selfdestruct', 'selfSwitch', 'sleepUsable', 'smartTarget', 'stealsBoosts', 'thawsTarget', 'volatileStatus', 'willCrit',
14571457
] as const;

data/mods/gen9ssb/scripts.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ export const Scripts: ModdedBattleScriptsData = {
15551555
this.battle.add('-hitcount', targets[0], hit - 1);
15561556
}
15571557

1558-
if ((move.recoil || move.id === 'chloroblast') && move.totalDamage) {
1558+
if ((move.recoil || move.chloroblastRecoil) && move.totalDamage) {
15591559
const hpBeforeRecoil = pokemon.hp;
15601560
this.battle.damage(this.calcRecoilDamage(move.totalDamage, move, pokemon), pokemon, pokemon, 'recoil');
15611561
if (pokemon.hp <= pokemon.maxhp / 2 && hpBeforeRecoil > pokemon.maxhp / 2) {

data/moves.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2511,7 +2511,7 @@ export const Moves: import('../sim/dex-moves').MoveDataTable = {
25112511
pp: 5,
25122512
priority: 0,
25132513
flags: {protect: 1, mirror: 1, metronome: 1},
2514-
// Recoil implemented in battle-actions.ts
2514+
chloroblastRecoil: [1, 2],
25152515
secondary: null,
25162516
target: "normal",
25172517
type: "Grass",

sim/battle-actions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ export class BattleActions {
992992
this.battle.add('-hitcount', targets[0], hit - 1);
993993
}
994994

995-
if ((move.recoil || move.id === 'chloroblast') && move.totalDamage) {
995+
if ((move.recoil || move.chloroblastRecoil) && move.totalDamage) {
996996
const hpBeforeRecoil = pokemon.hp;
997997
this.battle.damage(this.calcRecoilDamage(move.totalDamage, move, pokemon), pokemon, pokemon, 'recoil');
998998
if (pokemon.hp <= pokemon.maxhp / 2 && hpBeforeRecoil > pokemon.maxhp / 2) {
@@ -1403,7 +1403,7 @@ export class BattleActions {
14031403
}
14041404

14051405
calcRecoilDamage(damageDealt: number, move: Move, pokemon: Pokemon): number {
1406-
if (move.id === 'chloroblast') return Math.round(pokemon.maxhp / 2);
1406+
if (move.chloroblastRecoil) return Math.round(pokemon.maxhp * move.chloroblastRecoil[0] / move.chloroblastRecoil[1]);
14071407
return this.battle.clampIntRange(Math.round(damageDealt * move.recoil![0] / move.recoil![1]), 1);
14081408
}
14091409

sim/dex-moves.ts

+1
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ export interface MoveData extends EffectData, MoveEventMethods, HitEffect {
210210
recoil?: [number, number];
211211
drain?: [number, number];
212212
mindBlownRecoil?: boolean;
213+
chloroblastRecoil?: [number, number];
213214
stealsBoosts?: boolean;
214215
struggleRecoil?: boolean;
215216
secondary?: SecondaryEffect | null;

0 commit comments

Comments
 (0)