Prevent wild & trainer battles without pokémon

when the player has no Pokémon in their team, wild and trainer battle commands don't do anything
This commit is contained in:
JappaWakka 2023-02-26 15:26:07 +01:00
parent 94247a7754
commit daef33a886
2 changed files with 132 additions and 119 deletions

View File

@ -12,6 +12,7 @@
Select Case command.ToLower() Select Case command.ToLower()
Case "starttrainer" Case "starttrainer"
If Core.Player.Pokemons.Count > 0 Then
Dim t As New Trainer(argument) Dim t As New Trainer(argument)
If t.IsBeaten() = False Then If t.IsBeaten() = False Then
If ScriptV2.started = False Then If ScriptV2.started = False Then
@ -50,7 +51,11 @@
End If End If
CanContinue = False CanContinue = False
Else
IsReady = True
End If
Case "trainer" Case "trainer"
If Core.Player.Pokemons.Count > 0 Then
Dim ID As String = argument Dim ID As String = argument
If argument.CountSeperators(",") > 0 Then If argument.CountSeperators(",") > 0 Then
@ -86,13 +91,16 @@
IsReady = True IsReady = True
CanContinue = False CanContinue = False
Else
IsReady = True
End If
Case "wild" Case "wild"
' ID, Level, [shiny], [musicloop], [introtype] ' ID, Level, [shiny], [musicloop], [introtype]
' int int -1 or bool string int ' int int -1 or bool string int
' optional: ' optional:
' {pokemondata}, [musicloop], [introtype] ' {pokemondata}, [musicloop], [introtype]
If Core.Player.Pokemons.Count > 0 Then
Dim p As Pokemon = Nothing Dim p As Pokemon = Nothing
Dim musicLoop As String = "" Dim musicLoop As String = ""
Dim introType As Integer = Core.Random.Next(0, 10) Dim introType As Integer = Core.Random.Next(0, 10)
@ -168,6 +176,9 @@
IsReady = True IsReady = True
CanContinue = False CanContinue = False
Else
IsReady = True
End If
Case "setvar" Case "setvar"
Dim varname As String = argument.GetSplit(0) Dim varname As String = argument.GetSplit(0)
Dim varvalue As String = argument.GetSplit(1) Dim varvalue As String = argument.GetSplit(1)

View File

@ -849,7 +849,9 @@ Public Class Level
Me._backdropRenderer.Update() Me._backdropRenderer.Update()
Me.UpdatePlayerWarp() Me.UpdatePlayerWarp()
If Core.Player.Pokemons.Count > 0 Then
Me._pokemonEncounter.TriggerBattle() Me._pokemonEncounter.TriggerBattle()
End If
' Reload map from file (Debug or Sandbox Mode): ' Reload map from file (Debug or Sandbox Mode):
If GameController.IS_DEBUG_ACTIVE = True Or Core.Player.SandBoxMode = True Then If GameController.IS_DEBUG_ACTIVE = True Or Core.Player.SandBoxMode = True Then