fix(mod-api): harden deferred trainer preparation

This commit is contained in:
MaxTomahawk
2026-08-14 17:57:59 +02:00
parent a77210799f
commit 407f649e9d
8 changed files with 176 additions and 9 deletions
+1 -1
View File
@@ -738,7 +738,7 @@ function BattleState.newTrainer(game, oppClass, partyIndex, opts)
-- data/scripts/victories.lua on class#party, so keep it on the battle (#782).
self.partyIndex = partyIndex or 1
self.playerParty, self.playerPartyIndices = scopedPlayerParty(game,
opts and opts.playerPartyIndices)
type(opts) == "table" and opts.playerPartyIndices or nil)
self.trainer = game.data.trainers[oppClass]
assert(self.trainer, "unknown trainer class " .. tostring(oppClass))
-- pret GetTrainerName_: RIVAL1/2/3 copy wRivalName into wTrainerName