Entering battle without pokémon triggers blackout

This commit is contained in:
JappaWakka 2023-02-26 17:16:39 +01:00
parent 022597262c
commit 2f0cccb052
4 changed files with 65 additions and 53 deletions

View File

@ -77,10 +77,18 @@
Screen.Level.World.Initialize(Screen.Level.EnvironmentType, Screen.Level.WeatherType)
Dim positionString() As String = Core.Player.LastRestPlacePosition.Split(CChar(","))
If PreScreen.Identification = Identifications.BattleScreen Then
CType(BattleScreen.SavedOverworld.Camera, OverworldCamera).YawLocked = False
Else
CType(Screen.Camera, OverworldCamera).YawLocked = False
End If
Screen.Camera.Yaw = MathHelper.Pi
Screen.Camera.Position = New Vector3(CSng(positionString(0).Replace(".", GameController.DecSeparator)), CSng(positionString(1).Replace(".", GameController.DecSeparator)), CSng(positionString(2).Replace(".", GameController.DecSeparator)))
If PreScreen.Identification = Identifications.BattleScreen Then
CType(BattleScreen.SavedOverworld.OverworldScreen, OverworldScreen).ActionScript.Scripts.Clear()
Else
CType(PreScreen, OverworldScreen).ActionScript.Scripts.Clear()
End If
While Core.CurrentScreen.Identification <> Identifications.OverworldScreen
Core.SetScreen(Core.CurrentScreen.PreScreen)

View File

@ -52,7 +52,7 @@
CanContinue = False
Else
IsReady = True
Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New BlackOutScreen(Core.CurrentScreen), Color.Black, False))
End If
Case "trainer"
If Core.Player.Pokemons.Count > 0 Then
@ -92,7 +92,7 @@
CanContinue = False
Else
IsReady = True
Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New BlackOutScreen(Core.CurrentScreen), Color.Black, False))
End If
Case "wild"
' ID, Level, [shiny], [musicloop], [introtype]
@ -177,7 +177,7 @@
CanContinue = False
Else
IsReady = True
Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New BlackOutScreen(Core.CurrentScreen), Color.Black, False))
End If
Case "setvar"
Dim varname As String = argument.GetSplit(0)

View File

@ -849,9 +849,7 @@ Public Class Level
Me._backdropRenderer.Update()
Me.UpdatePlayerWarp()
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

View File

@ -116,6 +116,11 @@ Public Class PokemonEncounter
Public Sub TriggerBattle()
' If the encounter check is true:
If Me._levelReference.PokemonEncounterData.EncounteredPokemon = True And Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
If Core.Player.Pokemons.Count = 0 Then
Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New BlackOutScreen(Core.CurrentScreen), Color.Black, False))
Me._levelReference.PokemonEncounterData.EncounteredPokemon = False
Exit Sub
Else
' If the player met the set position:
If Screen.Camera.Position.X = Me._levelReference.PokemonEncounterData.Position.X And Screen.Camera.Position.Z = Me._levelReference.PokemonEncounterData.Position.Z Then
' Make the player stop and set encounter check to false:
@ -174,6 +179,7 @@ Public Class PokemonEncounter
End If
End If
End If
End If
End Sub
#End Region