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:
parent
94247a7754
commit
daef33a886
|
@ -12,162 +12,173 @@
|
|||
|
||||
Select Case command.ToLower()
|
||||
Case "starttrainer"
|
||||
Dim t As New Trainer(argument)
|
||||
If t.IsBeaten() = False Then
|
||||
If ScriptV2.started = False Then
|
||||
CType(Core.CurrentScreen, OverworldScreen).TrainerEncountered = True
|
||||
If Core.Player.Pokemons.Count > 0 Then
|
||||
Dim t As New Trainer(argument)
|
||||
If t.IsBeaten() = False Then
|
||||
If ScriptV2.started = False Then
|
||||
CType(Core.CurrentScreen, OverworldScreen).TrainerEncountered = True
|
||||
|
||||
If t.GetInSightMusic() <> "" And t.GetInSightMusic() <> "nomusic" Then
|
||||
MusicManager.Play(t.GetInSightMusic(), True, 0.0F)
|
||||
End If
|
||||
If t.GetInSightMusic() <> "" And t.GetInSightMusic() <> "nomusic" Then
|
||||
MusicManager.Play(t.GetInSightMusic(), True, 0.0F)
|
||||
End If
|
||||
|
||||
If t.IntroMessage <> "" Then
|
||||
Screen.TextBox.reDelay = 0.0F
|
||||
Screen.TextBox.Show(t.IntroMessage, {})
|
||||
If t.IntroMessage <> "" Then
|
||||
Screen.TextBox.reDelay = 0.0F
|
||||
Screen.TextBox.Show(t.IntroMessage, {})
|
||||
End If
|
||||
ScriptV2.started = True
|
||||
End If
|
||||
ScriptV2.started = True
|
||||
If Screen.TextBox.Showing = False Then
|
||||
CType(Core.CurrentScreen, OverworldScreen).TrainerEncountered = False
|
||||
|
||||
Dim method As Integer = 0
|
||||
If Screen.Level.Surfing = True Then
|
||||
method = 2
|
||||
End If
|
||||
|
||||
Dim b As New BattleSystem.BattleScreen(New Trainer(argument), Core.CurrentScreen, method)
|
||||
Core.SetScreen(New BattleIntroScreen(Core.CurrentScreen, b, t, t.GetIniMusicName(), t.IntroType))
|
||||
End If
|
||||
Else
|
||||
Screen.TextBox.reDelay = 0.0F
|
||||
Screen.TextBox.Show(t.DefeatMessage, {})
|
||||
|
||||
IsReady = True
|
||||
End If
|
||||
|
||||
If Screen.TextBox.Showing = False Then
|
||||
CType(Core.CurrentScreen, OverworldScreen).TrainerEncountered = False
|
||||
|
||||
Dim method As Integer = 0
|
||||
If Screen.Level.Surfing = True Then
|
||||
method = 2
|
||||
End If
|
||||
|
||||
Dim b As New BattleSystem.BattleScreen(New Trainer(argument), Core.CurrentScreen, method)
|
||||
Core.SetScreen(New BattleIntroScreen(Core.CurrentScreen, b, t, t.GetIniMusicName(), t.IntroType))
|
||||
IsReady = True
|
||||
End If
|
||||
|
||||
CanContinue = False
|
||||
Else
|
||||
Screen.TextBox.reDelay = 0.0F
|
||||
Screen.TextBox.Show(t.DefeatMessage, {})
|
||||
|
||||
IsReady = True
|
||||
End If
|
||||
|
||||
If Screen.TextBox.Showing = False Then
|
||||
IsReady = True
|
||||
End If
|
||||
|
||||
CanContinue = False
|
||||
Case "trainer"
|
||||
Dim ID As String = argument
|
||||
If Core.Player.Pokemons.Count > 0 Then
|
||||
Dim ID As String = argument
|
||||
|
||||
If argument.CountSeperators(",") > 0 Then
|
||||
ID = argument.GetSplit(0)
|
||||
If argument.CountSeperators(",") > 0 Then
|
||||
ID = argument.GetSplit(0)
|
||||
|
||||
For Each v As String In argument.Split(CChar(","))
|
||||
Select Case v
|
||||
Case "generate_pokemon_tower"
|
||||
Dim level As Integer = 0
|
||||
For Each p As Pokemon In Core.Player.Pokemons
|
||||
If p.Level > level Then
|
||||
level = p.Level
|
||||
End If
|
||||
Next
|
||||
For Each v As String In argument.Split(CChar(","))
|
||||
Select Case v
|
||||
Case "generate_pokemon_tower"
|
||||
Dim level As Integer = 0
|
||||
For Each p As Pokemon In Core.Player.Pokemons
|
||||
If p.Level > level Then
|
||||
level = p.Level
|
||||
End If
|
||||
Next
|
||||
|
||||
While CStr(level)(CStr(level).Length - 1) <> "0"
|
||||
level += 1
|
||||
End While
|
||||
End Select
|
||||
Next
|
||||
While CStr(level)(CStr(level).Length - 1) <> "0"
|
||||
level += 1
|
||||
End While
|
||||
End Select
|
||||
Next
|
||||
End If
|
||||
|
||||
Dim t As New Trainer(ID)
|
||||
|
||||
Dim method As Integer = 0
|
||||
If Screen.Level.Surfing = True Then
|
||||
method = 2
|
||||
End If
|
||||
|
||||
Dim b As New BattleSystem.BattleScreen(t, Core.CurrentScreen, method)
|
||||
Core.SetScreen(New BattleIntroScreen(Core.CurrentScreen, b, t, t.GetIniMusicName(), t.IntroType))
|
||||
|
||||
IsReady = True
|
||||
|
||||
CanContinue = False
|
||||
Else
|
||||
IsReady = True
|
||||
End If
|
||||
|
||||
Dim t As New Trainer(ID)
|
||||
|
||||
Dim method As Integer = 0
|
||||
If Screen.Level.Surfing = True Then
|
||||
method = 2
|
||||
End If
|
||||
|
||||
Dim b As New BattleSystem.BattleScreen(t, Core.CurrentScreen, method)
|
||||
Core.SetScreen(New BattleIntroScreen(Core.CurrentScreen, b, t, t.GetIniMusicName(), t.IntroType))
|
||||
|
||||
IsReady = True
|
||||
|
||||
CanContinue = False
|
||||
Case "wild"
|
||||
' ID, Level, [shiny], [musicloop], [introtype]
|
||||
' int int -1 or bool string int
|
||||
|
||||
' optional:
|
||||
' {pokemondata}, [musicloop], [introtype]
|
||||
If Core.Player.Pokemons.Count > 0 Then
|
||||
Dim p As Pokemon = Nothing
|
||||
Dim musicLoop As String = ""
|
||||
Dim introType As Integer = Core.Random.Next(0, 10)
|
||||
|
||||
Dim p As Pokemon = Nothing
|
||||
Dim musicLoop As String = ""
|
||||
Dim introType As Integer = Core.Random.Next(0, 10)
|
||||
Dim method As Integer = 0
|
||||
If Screen.Level.Surfing = True Then
|
||||
method = 2
|
||||
End If
|
||||
|
||||
Dim method As Integer = 0
|
||||
If Screen.Level.Surfing = True Then
|
||||
method = 2
|
||||
End If
|
||||
If argument.StartsWith("{") = True And argument.Contains("}") = True Then
|
||||
If argument.EndsWith("}") = True Then
|
||||
p = Pokemon.GetPokemonByData(argument)
|
||||
Else
|
||||
Dim pokemonData As String = argument.Remove(argument.LastIndexOf("}") + 1)
|
||||
p = Pokemon.GetPokemonByData(pokemonData)
|
||||
|
||||
If argument.StartsWith("{") = True And argument.Contains("}") = True Then
|
||||
If argument.EndsWith("}") = True Then
|
||||
p = Pokemon.GetPokemonByData(argument)
|
||||
argument = argument.Remove(0, argument.LastIndexOf("}") + 1)
|
||||
|
||||
If argument.Length > 1 And argument.StartsWith(",") = True Then
|
||||
argument = argument.Remove(0, 1)
|
||||
Dim args() As String = argument.Split(CChar(","))
|
||||
|
||||
For i = 0 To args.Length - 1
|
||||
Select Case i
|
||||
Case 0
|
||||
musicLoop = args(i)
|
||||
Case 1
|
||||
introType = int(args(i))
|
||||
End Select
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Dim pokemonData As String = argument.Remove(argument.LastIndexOf("}") + 1)
|
||||
p = Pokemon.GetPokemonByData(pokemonData)
|
||||
If argument.Length > 0 Then
|
||||
Dim ID As Integer = int(argument.GetSplit(0).Split(CChar("_"))(0))
|
||||
Dim AD As String = ""
|
||||
If argument.GetSplit(0).Contains(CChar("_")) Then
|
||||
AD = argument.GetSplit(0).Split(CChar("_"))(1)
|
||||
End If
|
||||
Dim Level As Integer = int(argument.GetSplit(1))
|
||||
|
||||
If AD IsNot "" Then
|
||||
p = Pokemon.GetPokemonByID(ID, AD)
|
||||
p.Generate(Level, True, AD)
|
||||
Else
|
||||
p = Pokemon.GetPokemonByID(ID)
|
||||
p.Generate(Level, True)
|
||||
|
||||
End If
|
||||
|
||||
argument = argument.Remove(0, argument.LastIndexOf("}") + 1)
|
||||
|
||||
If argument.Length > 1 And argument.StartsWith(",") = True Then
|
||||
argument = argument.Remove(0, 1)
|
||||
Dim args() As String = argument.Split(CChar(","))
|
||||
|
||||
For i = 0 To args.Length - 1
|
||||
Select Case i
|
||||
Case 0
|
||||
Case 2
|
||||
If args(i) <> "-1" Then
|
||||
p.IsShiny = CBool(args(i))
|
||||
End If
|
||||
Case 3
|
||||
musicLoop = args(i)
|
||||
Case 1
|
||||
Case 4
|
||||
introType = int(args(i))
|
||||
End Select
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
Core.Player.PokedexData = Pokedex.ChangeEntry(Core.Player.PokedexData, p.Number, 1)
|
||||
Dim b As New BattleSystem.BattleScreen(p, Core.CurrentScreen, method)
|
||||
Core.SetScreen(New BattleIntroScreen(Core.CurrentScreen, b, introType, musicLoop))
|
||||
|
||||
IsReady = True
|
||||
|
||||
CanContinue = False
|
||||
Else
|
||||
If argument.Length > 0 Then
|
||||
Dim ID As Integer = int(argument.GetSplit(0).Split(CChar("_"))(0))
|
||||
Dim AD As String = ""
|
||||
If argument.GetSplit(0).Contains(CChar("_")) Then
|
||||
AD = argument.GetSplit(0).Split(CChar("_"))(1)
|
||||
End If
|
||||
Dim Level As Integer = int(argument.GetSplit(1))
|
||||
|
||||
If AD IsNot "" Then
|
||||
p = Pokemon.GetPokemonByID(ID, AD)
|
||||
p.Generate(Level, True, AD)
|
||||
Else
|
||||
p = Pokemon.GetPokemonByID(ID)
|
||||
p.Generate(Level, True)
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Dim args() As String = argument.Split(CChar(","))
|
||||
|
||||
For i = 0 To args.Length - 1
|
||||
Select Case i
|
||||
Case 2
|
||||
If args(i) <> "-1" Then
|
||||
p.IsShiny = CBool(args(i))
|
||||
End If
|
||||
Case 3
|
||||
musicLoop = args(i)
|
||||
Case 4
|
||||
introType = int(args(i))
|
||||
End Select
|
||||
Next
|
||||
End If
|
||||
IsReady = True
|
||||
End If
|
||||
|
||||
Core.Player.PokedexData = Pokedex.ChangeEntry(Core.Player.PokedexData, p.Number, 1)
|
||||
Dim b As New BattleSystem.BattleScreen(p, Core.CurrentScreen, method)
|
||||
Core.SetScreen(New BattleIntroScreen(Core.CurrentScreen, b, introType, musicLoop))
|
||||
|
||||
IsReady = True
|
||||
|
||||
CanContinue = False
|
||||
Case "setvar"
|
||||
Dim varname As String = argument.GetSplit(0)
|
||||
Dim varvalue As String = argument.GetSplit(1)
|
||||
|
|
|
@ -849,7 +849,9 @@ Public Class Level
|
|||
Me._backdropRenderer.Update()
|
||||
|
||||
Me.UpdatePlayerWarp()
|
||||
Me._pokemonEncounter.TriggerBattle()
|
||||
If Core.Player.Pokemons.Count > 0 Then
|
||||
Me._pokemonEncounter.TriggerBattle()
|
||||
End If
|
||||
|
||||
' Reload map from file (Debug or Sandbox Mode):
|
||||
If GameController.IS_DEBUG_ACTIVE = True Or Core.Player.SandBoxMode = True Then
|
||||
|
|
Loading…
Reference in New Issue