{
    num: 288,
    accuracy: true,
    basePower: 0,
    category: "Status",
    isNonstandard: "Past",
    name: "Grudge",
    pp: 5,
    priority: 0,
    flags: { bypasssub: 1, metronome: 1 },
    volatileStatus: "grudge",
    condition: {
        onStart(pokemon) {
            this.add("-singlemove", pokemon, "Grudge");
        },
        onFaint(target, source, effect) {
            if (!source || source.fainted || !effect) return;
            if (effect.effectType === "Move" && !effect.flags["futuremove"] && source.lastMove) {
                let move = source.lastMove;
                if (move.isMax && move.baseMove) move = this.dex.moves.get(move.baseMove);

                for (const moveSlot of source.moveSlots) {
                    if (moveSlot.id === move.id) {
                        moveSlot.pp = 0;
                        this.add("-activate", source, "move: Grudge", move.name);
                    }
                }

                source.hp = Math.floor(source.hp / 2);
                this.add("-sethp", source, source.getHealth);
            }
        },
        onBeforeMovePriority: 100,
        onBeforeMove(pokemon) {
            this.debug("removing Grudge before attack");
            pokemon.removeVolatile("grudge");
        }
    },
    secondary: null,
    target: "self",
    type: "Ghost",
    zMove: { effect: "redirect" },
    contestType: "Tough"
}
