diff --git a/src/components/TrainerEncounter.tsx b/src/components/TrainerEncounter.tsx index 015ccd0..b5a0140 100644 --- a/src/components/TrainerEncounter.tsx +++ b/src/components/TrainerEncounter.tsx @@ -21,6 +21,7 @@ import Frame from "./Frame"; import useEvent from "../app/use-event"; import { Event } from "../app/emitter"; import getPokemonEncounter from "../app/pokemon-encounter-helper"; +import { showText } from "../state/uiSlice"; const StyledTrainerEncounter = styled.div` position: absolute; @@ -81,6 +82,11 @@ const TrainerEncounter = () => { trainer.pos.y === pos.y + facingPos.y ); if (!trainer) throw new Error("Trainer not found"); + const trainerId = `${mapId}-${trainer.pos.x}-${trainer.pos.y}`; + if (defeatedTrainers.includes(trainerId)) { + dispatch(showText(trainer.outtro)); + return; + } dispatch(encounterTrainer(trainer)); setTimeout(() => { setIntroIndex(0);