Improved the Custom Move commands

This commit is contained in:
JappaWakka 2022-12-26 20:54:00 +01:00
parent 8338c385ee
commit 68a9d197e5
3 changed files with 46 additions and 10 deletions

View File

@ -218,7 +218,7 @@
End If End If
End Sub End Sub
Private Sub DeleteHostQuery(ByVal BattleScreen As BattleScreen) Public Sub DeleteHostQuery(ByVal BattleScreen As BattleScreen)
If BattleScreen.IsRemoteBattle Then If BattleScreen.IsRemoteBattle Then
BattleScreen.BattleQuery.Clear() BattleScreen.BattleQuery.Clear()
BattleScreen.TempPVPBattleQuery.Clear() BattleScreen.TempPVPBattleQuery.Clear()

View File

@ -4,6 +4,7 @@
Inherits Screen Inherits Screen
Public NextPokemonIndex As Integer = -1
'Used for after fainting switching 'Used for after fainting switching
Public OwnFaint As Boolean = False Public OwnFaint As Boolean = False
Public OppFaint As Boolean = False Public OppFaint As Boolean = False
@ -1351,10 +1352,14 @@ nextIndex:
End While End While
Else Else
i = Core.Random.Next(0, Trainer.Pokemons.Count) If Me.NextPokemonIndex <> -1 Then
While Trainer.Pokemons(i).Status = Pokemon.StatusProblems.Fainted OrElse OppPokemonIndex = i OrElse Trainer.Pokemons(i).HP <= 0 i = NextPokemonIndex
Else
i = Core.Random.Next(0, Trainer.Pokemons.Count) i = Core.Random.Next(0, Trainer.Pokemons.Count)
End While While Trainer.Pokemons(i).Status = Pokemon.StatusProblems.Fainted OrElse OppPokemonIndex = i OrElse Trainer.Pokemons(i).HP <= 0
i = Core.Random.Next(0, Trainer.Pokemons.Count)
End While
End If
End If End If
End If End If
@ -1364,6 +1369,7 @@ nextIndex:
If Pokedex.GetEntryType(Core.Player.PokedexData, OppPokemon.Number) = 0 Then If Pokedex.GetEntryType(Core.Player.PokedexData, OppPokemon.Number) = 0 Then
Core.Player.PokedexData = Pokedex.ChangeEntry(Core.Player.PokedexData, OppPokemon.Number, 1) Core.Player.PokedexData = Pokedex.ChangeEntry(Core.Player.PokedexData, OppPokemon.Number, 1)
End If End If
NextPokemonIndex = -1
End Sub End Sub
Public Function GetModelName(ByVal own As Boolean) As String Public Function GetModelName(ByVal own As Boolean) As String

View File

@ -32,7 +32,14 @@
BattleScreen.Battle.ChangeCameraAngle(2, True, BattleScreen) BattleScreen.Battle.ChangeCameraAngle(2, True, BattleScreen)
End Select End Select
Case "message", "text" Case "message", "text"
fSub = Localization.GetString(fSub, fSub) Dim OppPokemon As Pokemon = BattleScreen.OppPokemon
Dim OwnPokemon As Pokemon = BattleScreen.OwnPokemon
If own = False Then
OwnPokemon = BattleScreen.OppPokemon
OppPokemon = BattleScreen.OwnPokemon
End If
fSub = Localization.GetString(fSub, fSub).Replace("[OPPNAME]", OppPokemon.GetDisplayName).Replace("[OWNNAME]", OwnPokemon.GetDisplayName)
BattleScreen.BattleQuery.Add(New TextQueryObject(fSub)) BattleScreen.BattleQuery.Add(New TextQueryObject(fSub))
Case "raisestat", "increasestat" Case "raisestat", "increasestat"
Dim Stat As String = f.GetSplit(1, ",") Dim Stat As String = f.GetSplit(1, ",")
@ -103,17 +110,36 @@
Case "faint" Case "faint"
Dim Target As Boolean = CBool(f.GetSplit(1, ",")) Dim Target As Boolean = CBool(f.GetSplit(1, ","))
Dim Message As String = "" Dim Message As String = ""
Dim NextPokemonIndex As Integer = -1
Dim OppPokemon As Pokemon = BattleScreen.OppPokemon
Dim OwnPokemon As Pokemon = BattleScreen.OwnPokemon
If Target = False Then
OwnPokemon = BattleScreen.OppPokemon
OppPokemon = BattleScreen.OwnPokemon
End If
If Target = True Then
If f.Split(CChar(",")).Count > 3 Then
If f.GetSplit(3, ",").StartsWith("~+") Then
NextPokemonIndex = BattleScreen.OppPokemonIndex + CInt(f.GetSplit(3, ",").Remove(0, 2))
End If
If f.GetSplit(3, ",").StartsWith("~-") Then
NextPokemonIndex = BattleScreen.OppPokemonIndex - CInt(f.GetSplit(3, ",").Remove(0, 2))
End If
End If
End If
BattleScreen.NextPokemonIndex = NextPokemonIndex
If f.Split(CChar(",")).Count > 2 Then If f.Split(CChar(",")).Count > 2 Then
Message = f.GetSplit(2, ",") Message = f.GetSplit(2, ",").Replace("[OPPNAME]", OppPokemon.GetDisplayName).Replace("[OWNNAME]", OwnPokemon.GetDisplayName)
End If End If
BattleScreen.Battle.FaintPokemon(Not Target, BattleScreen, Message) BattleScreen.Battle.FaintPokemon(Not Target, BattleScreen, Message)
Case "switch" Case "switch"
Dim Target As Boolean = CBool(f.GetSplit(1, ",")) Dim Target As Boolean = CBool(f.GetSplit(1, ","))
Dim SwitchTo As Integer = CInt(f.GetSplit(2, ",")) Dim SwitchTo As Integer = 0
Dim Message As String = "" Dim Message As String = ""
If f.Split(CChar(",")).Count > 3 Then If f.Split(CChar(",")).Count > 3 Then
Message = f.GetSplit(3, ",") Message = f.GetSplit(3, ",")
End If End If
@ -135,8 +161,12 @@
BattleScreen.Battle.SwitchOutOwn(BattleScreen, SwitchTo, -1, Message) BattleScreen.Battle.SwitchOutOwn(BattleScreen, SwitchTo, -1, Message)
End If End If
Case "endround" Case "endround"
Dim Type As Integer = CInt(f.GetSplit(1, ",")) BattleScreen.Battle.DeleteHostQuery(BattleScreen)
BattleScreen.Battle.EndRound(BattleScreen, Type) 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})
BattleScreen.Battle.StartRound(BattleScreen)
Case Else Case Else
fSub = CInt(f.GetSplit(1, ",")).Clamp(0, 100).ToString fSub = CInt(f.GetSplit(1, ",")).Clamp(0, 100).ToString
End Select End Select