Remove InstantReviveModifier

This commit is contained in:
Wlowscha 2025-06-07 11:24:42 +02:00
parent 15e729e3e8
commit d39744041e
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -46,12 +46,7 @@ import {
} from "./modifier-type"; } from "./modifier-type";
import { Color, ShadowColor } from "#enums/color"; import { Color, ShadowColor } from "#enums/color";
import { FRIENDSHIP_GAIN_FROM_RARE_CANDY } from "#app/data/balance/starters"; import { FRIENDSHIP_GAIN_FROM_RARE_CANDY } from "#app/data/balance/starters";
import { import { applyPostItemLostAbAttrs, PostItemLostAbAttr } from "#app/data/abilities/ability";
applyAbAttrs,
applyPostItemLostAbAttrs,
CommanderAbAttr,
PostItemLostAbAttr,
} from "#app/data/abilities/ability";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
export type ModifierPredicate = (modifier: Modifier) => boolean; export type ModifierPredicate = (modifier: Modifier) => boolean;
@ -1831,52 +1826,6 @@ export class PreserveBerryModifier extends PersistentModifier {
} }
} }
export class PokemonInstantReviveModifier extends PokemonHeldItemModifier {
matchType(modifier: Modifier) {
return modifier instanceof PokemonInstantReviveModifier;
}
clone() {
return new PokemonInstantReviveModifier(this.type, this.pokemonId, this.stackCount);
}
/**
* Applies {@linkcode PokemonInstantReviveModifier}
* @param pokemon The {@linkcode Pokemon} that holds the item
* @returns always `true`
*/
override apply(pokemon: Pokemon): boolean {
// Restore the Pokemon to half HP
globalScene.unshiftPhase(
new PokemonHealPhase(
pokemon.getBattlerIndex(),
toDmgValue(pokemon.getMaxHp() / 2),
i18next.t("modifier:pokemonInstantReviveApply", {
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
typeName: this.type.name,
}),
false,
false,
true,
),
);
// Remove the Pokemon's FAINT status
pokemon.resetStatus(true, false, true, false);
// Reapply Commander on the Pokemon's side of the field, if applicable
const field = pokemon.isPlayer() ? globalScene.getPlayerField() : globalScene.getEnemyField();
for (const p of field) {
applyAbAttrs(CommanderAbAttr, p, null, false);
}
return true;
}
getMaxHeldItemCount(_pokemon: Pokemon): number {
return 1;
}
}
/** /**
* Modifier used for held items, namely White Herb, that restore adverse stat * Modifier used for held items, namely White Herb, that restore adverse stat
* stages in battle. * stages in battle.