Battle Updates

* Shift Battlestyle Implemented
* Bugs related to switching Pokémon with Battle Animations off fixed
This commit is contained in:
Jasper "JappaWakka" Speelman 2022-04-14 20:14:35 +02:00
parent e7d20185f3
commit d934a947aa
3 changed files with 83 additions and 42 deletions

View File

@ -5341,11 +5341,11 @@
End If
End If
ChangeCameraAngle(0, True, BattleScreen)
Dim cq1 As ScreenFadeQueryObject = New ScreenFadeQueryObject(ScreenFadeQueryObject.FadeTypes.Vertical, Color.Black, True, 16)
Dim cq2 As ScreenFadeQueryObject = New ScreenFadeQueryObject(ScreenFadeQueryObject.FadeTypes.Vertical, Color.Black, False, 16)
cq2.PassThis = True
BattleScreen.BattleQuery.AddRange({cq1, cq2})
@ -7415,13 +7415,16 @@
Loop While SmokeSpawned <= 38
End If
' Pokemon appears
BallThrow.AnimationFade(Nothing, False, 1, True, 1, 3, 0)
BallThrow.AnimationPlaySound(CStr(BattleScreen.OwnPokemon.Number), 4, 0,, True)
If Core.Player.ShowBattleAnimations <> 0 Then
' Pokemon appears
BallThrow.AnimationFade(Nothing, False, 1, True, 1, 3, 0)
BallThrow.AnimationPlaySound(CStr(BattleScreen.OwnPokemon.Number), 4, 0,, True)
' Pokémon falls down
BallThrow.AnimationMove(Nothing, False, 0, 0, 0, 0.05F, False, False, 5, 0,,, 3)
Else
' Pokemon appears
BallThrow.AnimationFade(Nothing, False, 1, True, 1, 0, 0)
BallThrow.AnimationPlaySound(CStr(BattleScreen.OwnPokemon.Number), 0, 0,, True)
End If
BattleScreen.AddToQuery(InsertIndex, BallThrow)
@ -7804,7 +7807,11 @@
End If
Dim oppModel As String = BattleScreen.GetModelName(False)
'Switch BattleStyle
If Core.Player.BattleStyle <> 1 Then
BattleScreen.BattleQuery.Add(New SwitchPokemonQueryObject(BattleScreen, BattleScreen.OppPokemon))
ChangeCameraAngle(1, False, BattleScreen)
End If
If oppModel = "" Then
BattleScreen.BattleQuery.Add(New ToggleEntityQueryObject(True, ToggleEntityQueryObject.BattleEntities.OppPokemon, PokemonForms.GetOverworldSpriteName(BattleScreen.OppPokemon), -1, -1, 0, 1))
Else
@ -7839,14 +7846,19 @@
Threading.Interlocked.Increment(SmokeSpawned)
Loop While SmokeSpawned <= 38
End If
' Pokemon appears
BallThrow.AnimationFade(Nothing, False, 1, True, 1, 3, 0)
BallThrow.AnimationPlaySound(CStr(BattleScreen.OppPokemon.Number), 4, 0,, True)
If Core.Player.ShowBattleAnimations <> 0 Then
' Pokemon appears
BallThrow.AnimationFade(Nothing, False, 1, True, 1, 3, 0)
BallThrow.AnimationPlaySound(CStr(BattleScreen.OppPokemon.Number), 4, 0,, True)
' Pokémon falls down
BallThrow.AnimationMove(Nothing, False, 0, 0, 0, 0.05F, False, False, 5, 0)
BattleScreen.BattleQuery.Add(BallThrow)
Else
' Pokemon appears
BallThrow.AnimationFade(Nothing, False, 1, True, 1, 0, 0)
BallThrow.AnimationPlaySound(CStr(BattleScreen.OppPokemon.Number), 0, 0,, True)
End If
BattleScreen.BattleQuery.Add(BallThrow)
End If
With BattleScreen

View File

@ -442,8 +442,11 @@
' Pokemon appears
BallThrowOpp.AnimationFade(Nothing, False, 1, True, 1, 3, 0)
BallThrowOpp.AnimationPlaySound(CStr(Me.OppPokemon.Number), 4, 0,, True)
Else
BallThrowOpp.AnimationPlaySound(CStr(Me.OppPokemon.Number), 0, 0,, True)
End If
BallThrowOpp.AnimationPlaySound(CStr(Me.OppPokemon.Number), 4, 0,, True)
' Pokémon falls down
If Core.Player.ShowBattleAnimations <> 0 Then
@ -873,7 +876,7 @@
If ForegroundEntities.Count > 0 Then
ForegroundEntities = (From f In ForegroundEntities Order By f.CameraDistance Descending).ToList()
End If
Level.Draw()
Level.Draw()
World.DrawWeather(Screen.Level.World.CurrentMapWeather)

View File

@ -10,7 +10,6 @@
Dim _text As String = ""
Dim _textColor As Color = Color.White
Dim _TextReady As Boolean = False
Dim _textIndex As Integer = 0
Dim _textDelay As Single = 0.015F
@ -31,6 +30,7 @@
Me._text = Me._text.Replace("~", " ")
Me._text = Me._text.Replace("<player.name>", Core.Player.Name)
Me._text = Me._text.Replace("<playername>", Core.Player.Name)
Me._text = Me._text.Replace("<rival.name>", Core.Player.RivalName)
Me._text = Me._text.Replace("<rivalname>", Core.Player.RivalName)
Me._text = Me._text.Replace("[POKE]", "Poké")
End Sub
@ -45,10 +45,6 @@
If Controls.Accept(True, True) = True And Me._textIndex > 2 Then
Me._textIndex = Me._text.Length
End If
Else
If Controls.Accept(True, True) = True Then
Me._TextReady = True
End If
End If
End Sub
@ -80,7 +76,17 @@
Dim _chooseIndex As Integer = 0
Private Sub UpdateChoose()
If Controls.Accept(True, True, True) = True Then
If _chooseIndex = 0 Then
Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf ChoosePokemon, Localization.GetString("battle_main_choose_pokemon"), False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf ChoosePokemonHandler
SoundManager.PlaySound("select")
Core.SetScreen(selScreen)
Else
SoundManager.PlaySound("select")
_ready = True
End If
End If
End Sub
Private Sub DrawChoose()
@ -99,25 +105,14 @@
If _chooseIndex = 0 Then
Canvas.DrawRectangle(New Rectangle(Core.windowSize.Width - 213, Core.windowSize.Height - 438, 80, 50), Color.White)
Core.SpriteBatch.DrawString(FontManager.InGameFont, "Yes", New Vector2(Core.windowSize.Width - 200, Core.windowSize.Height - 430), Color.Black)
Core.SpriteBatch.DrawString(FontManager.InGameFont, "No", New Vector2(Core.windowSize.Width - 200, Core.windowSize.Height - 370), Color.White)
Core.SpriteBatch.DrawString(FontManager.InGameFont, Localization.GetString("global_yes"), New Vector2(Core.windowSize.Width - 200, Core.windowSize.Height - 430), Color.Black)
Core.SpriteBatch.DrawString(FontManager.InGameFont, Localization.GetString("global_no"), New Vector2(Core.windowSize.Width - 200, Core.windowSize.Height - 370), Color.White)
Else
Canvas.DrawRectangle(New Rectangle(Core.windowSize.Width - 213, Core.windowSize.Height - 378, 80, 50), Color.White)
Core.SpriteBatch.DrawString(FontManager.InGameFont, "Yes", New Vector2(Core.windowSize.Width - 200, Core.windowSize.Height - 430), Color.White)
Core.SpriteBatch.DrawString(FontManager.InGameFont, "No", New Vector2(Core.windowSize.Width - 200, Core.windowSize.Height - 370), Color.Black)
Core.SpriteBatch.DrawString(FontManager.InGameFont, Localization.GetString("global_yes"), New Vector2(Core.windowSize.Width - 200, Core.windowSize.Height - 430), Color.White)
Core.SpriteBatch.DrawString(FontManager.InGameFont, Localization.GetString("global_no"), New Vector2(Core.windowSize.Width - 200, Core.windowSize.Height - 370), Color.Black)
End If
If Controls.Accept(True, True, True) = True Then
If _chooseIndex = 0 Then
Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf ChoosePokemon, "Choose Pokémon to battle!", False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf ChoosePokemonHandler
SoundManager.PlaySound("select")
Core.SetScreen(selScreen)
Else
SoundManager.PlaySound("select")
_ready = True
End If
End If
End Sub
Dim TempScreen As BattleScreen
@ -127,20 +122,49 @@
End Sub
Private Sub ChoosePokemon(ByVal PokeIndex As Integer)
TempScreen.Battle.SwitchOutOwn(TempScreen, PokeIndex, insertIndex)
Me._ready = True
Dim Pokemon As Pokemon = Core.Player.Pokemons(PokeIndex)
If PokeIndex = TempScreen.OwnPokemonIndex Then
Screen.TextBox.Show(Pokemon.GetDisplayName() & " is already~in battle!", {}, True, False)
Else
If Pokemon.IsEgg() = False Then
If Pokemon.Status <> P3D.Pokemon.StatusProblems.Fainted Then
If BattleCalculation.CanSwitch(TempScreen, True) = False Then
Screen.TextBox.Show("Cannot switch out.", {}, True, False)
Else
Dim TempQuery = TempScreen.BattleQuery.ToArray
If TempScreen.OwnPokemonIndex <> PokeIndex Then
If TempScreen.IsRemoteBattle = True And TempScreen.IsHost = False Then
TempScreen.OppFaint = False
TempScreen.OwnStatistics.Switches += 1
TempScreen.BattleQuery.Clear()
TempScreen.Battle.SwitchOutOwn(TempScreen, PokeIndex, TempScreen.BattleQuery.Count)
TempScreen.BattleQuery.Reverse()
TempScreen.BattleQuery.AddRange(TempQuery)
Else
TempScreen.BattleQuery.Clear()
TempScreen.Battle.SwitchOutOwn(TempScreen, PokeIndex, TempScreen.BattleQuery.Count)
TempScreen.BattleQuery.Reverse()
TempScreen.BattleQuery.AddRange(TempQuery)
End If
Me._ready = True
End If
End If
Else
Screen.TextBox.Show(Pokemon.GetDisplayName() & " is fainted!", {}, True, False)
End If
Else
Screen.TextBox.Show("Cannot switch in~the egg!", {}, True, False)
End If
End If
End Sub
#End Region
Dim insertIndex As Integer = 0
Public Sub New(ByVal BattleScreen As BattleScreen, ByVal NewPokemon As Pokemon)
MyBase.New(QueryTypes.SwitchPokemon)
Me.insertIndex = BattleScreen.BattleQuery.Count
Me.TempScreen = BattleScreen
TransformText(BattleScreen.Trainer.Name & " is about to send out a " & NewPokemon.GetDisplayName() & "! Do you want to switch your Pokémon?")
TransformText(BattleScreen.Trainer.Name & " " & Localization.GetString("battle_main_trainer_sent_out_3") & " " & NewPokemon.GetDisplayName() & Localization.GetString("battle_main_trainer_sent_out_4"))
End Sub
Dim delay As Single = 3.0F
@ -161,9 +185,11 @@
End Sub
Public Overrides Sub Draw(BV2Screen As BattleScreen)
DrawText(BV2Screen)
If TextReady = True Then
DrawChoose()
If Me._ready = False Then
DrawText(BV2Screen)
If TextReady = True Then
DrawChoose()
End If
End If
End Sub