added night theme for wild battles

This commit is contained in:
Max Rigout 2025-02-18 16:55:56 -05:00
parent cee683452e
commit 7a920335d4
5 changed files with 85 additions and 15 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -19,6 +19,15 @@
Dim startTime As Date
Dim duration As TimeSpan
Public Enum BattleType As Integer
PVP = 0
TRAINER = 1
SAFARI = 2
BUG_CATCHING = 3
ROAMING = 4
WILD = 5
End Enum
Public MusicLoop As String = ""
Public Sub New(ByVal OldScreen As Screen, ByVal NewScreen As Screen, ByVal IntroType As Integer)
@ -33,6 +42,11 @@
End If
End If
If World.IsNight() Then
musicLoop = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild_night_intro"
'musicLoop = "kanto_wild_intro"
End If
If MusicManager.SongExists(musicLoop) = False Then
musicLoop = "johto_wild_intro"
End If
@ -51,6 +65,10 @@
End If
End If
If World.IsNight() Then
MusicLoop = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild_night_intro"
End If
If MusicManager.SongExists(MusicLoop) = False Then
MusicLoop = "johto_wild_intro"
End If
@ -550,29 +568,27 @@
MusicManager.Playlist.Clear()
MusicManager.outputDevice.Stop()
If BattleSystem.BattleScreen.CustomBattleMusic = "" OrElse MusicManager.SongExists(BattleSystem.BattleScreen.CustomBattleMusic) = False Then
Dim battleType = BattleIntroScreen.BattleType.WILD
If b.IsPVPBattle = True Then
MusicManager.Play(MusicLoop, False, 0.0F, True, "pvp")
battleType = BattleIntroScreen.BattleType.PVP
Else
If b.IsTrainerBattle = True Then
MusicManager.Play(MusicLoop, False, 0.0F, True, Trainer.GetBattleMusicName())
ElseIf Screen.Level.IsSafariZone = True Or Screen.Level.IsBugCatchingContest = True Then
If MusicManager.SongExists(Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild") = True Then
MusicManager.Play(MusicLoop, False, 0.0F, True, Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild")
Else
MusicManager.Play(MusicLoop, False, 0.0F, True, "johto_wild")
End If
battleType = BattleIntroScreen.BattleType.TRAINER
ElseIf Screen.Level.IsSafariZone = True Then
battleType = BattleIntroScreen.BattleType.SAFARI
ElseIf Screen.Level.IsBugCatchingContest = True Then
battleType = BattleIntroScreen.BattleType.BUG_CATCHING
Else
If BattleSystem.BattleScreen.RoamingBattle = True AndAlso BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop <> "" AndAlso MusicManager.SongExists(BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop) = True Then
MusicManager.Play(MusicLoop, True, 0.0F, True, BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop)
If BattleSystem.BattleScreen.RoamingBattle = True Then
battleType = BattleIntroScreen.BattleType.ROAMING
Else
If MusicManager.SongExists(Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild") = True Then
MusicManager.Play(MusicLoop, False, 0.0F, True, Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild")
Else
MusicManager.Play(MusicLoop, False, 0.0F, True, "johto_wild")
End If
battleType = BattleIntroScreen.BattleType.WILD
End If
End If
End If
Dim loopSong = GetLoopSong(battleType)
MusicManager.Play(MusicLoop, True, 0.0F, True, loopSong)
Else
MusicManager.Play(MusicLoop, True, 0.0F, True, BattleSystem.BattleScreen.CustomBattleMusic)
End If
@ -592,6 +608,55 @@
Me.startTime = Date.Now
End Sub
Private Function GetLoopSong(battleType As BattleIntroScreen.BattleType) As String
'pvp battle
'trainer battle
'safari zone
'bug catching contest
'roaming battle
'wild pokemon
Dim fallbackLoopSong = "johto_wild"
Dim loopSong = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild"
If battleType = BattleIntroScreen.BattleType.PVP Then
loopSong = "pvp"
ElseIf battleType = BattleIntroScreen.BattleType.TRAINER Then
fallbackLoopSong = Trainer.GetBattleMusicName()
loopSong = Trainer.GetBattleMusicName()
ElseIf battleType = BattleIntroScreen.BattleType.SAFARI Then
fallbackLoopSong = "johto_wild"
loopSong = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild"
If World.IsNight() Then
loopSong = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild_night"
fallbackLoopSong = "johto_wild_night"
End If
ElseIf battleType = BattleIntroScreen.BattleType.BUG_CATCHING Then
fallbackLoopSong = "johto_wild"
loopSong = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild"
If World.IsNight() Then
loopSong = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild_night"
fallbackLoopSong = "johto_wild_night"
End If
ElseIf battleType = BattleIntroScreen.BattleType.ROAMING Then
If BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop <> "" Then
loopSong = BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop
End If
ElseIf battleType = BattleIntroScreen.BattleType.WILD Then
fallbackLoopSong = "johto_wild"
loopSong = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild"
If World.IsNight() Then
loopSong = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild_night"
fallbackLoopSong = "johto_wild_night"
End If
Else
Console.WriteLine("Unknown Battle Type: " & battleType)
End If
If MusicManager.SongExists(loopSong) = True Then
Return loopSong
End If
Return fallbackLoopSong
End Function
Private Function SongOver() As Boolean
Return startTime + duration < Date.Now
End Function

@ -982,4 +982,9 @@ endsub:
End Set
End Property
Public Shared Function IsNight() As Boolean
Dim currentTime = GetTime()
Return currentTime.Equals(DayTimes.Night) Or currentTime.Equals(DayTimes.Morning)
End Function
End Class