Fixed Baton Pass, PVP needs testing

This commit is contained in:
JappaWakka 2023-08-15 18:36:02 +02:00
parent c007d0d6f4
commit 944e42cadd
4 changed files with 54 additions and 14 deletions

View File

@ -405,7 +405,15 @@
If BattleScreen.ReceivedInput.StartsWith("MEGA|") Then
BattleScreen.IsMegaEvolvingOpp = True
End If
Dim moveID As Integer = CInt(BattleScreen.ReceivedInput.Remove(0, 5))
Dim moveID As Integer
Dim inputString As String = BattleScreen.ReceivedInput.Remove(0, 5)
If inputString.Contains("|BATON|") Then
BattleScreen.FieldEffects.OppBatonPassIndex = CInt(inputString.GetSplit(2, "|"))
moveID = CInt(inputString.GetSplit(0, "|"))
Else
moveID = CInt(inputString)
End If
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = GetPokemonMoveFromID(BattleScreen.OppPokemon, moveID)}
ElseIf BattleScreen.ReceivedInput.StartsWith("SWITCH|") Then
BattleScreen.OppStatistics.Switches += 1
@ -7383,7 +7391,7 @@
If .OwnUsedBatonPass = False Then .OwnEmbargo = 0
.OwnYawn = 0
If .OwnUsedBatonPass = False Then .OwnPerishSongCount = 0
.OwnConfusionTurns = 0
If .OwnUsedBatonPass = False Then .OwnConfusionTurns = 0
.OwnTorment = 0
.OwnTormentMove = Nothing
.OwnChoiceMove = Nothing
@ -7794,7 +7802,7 @@
If .OppUsedBatonPass = False Then .OppEmbargo = 0
.OppYawn = 0
If .OppUsedBatonPass = False Then .OppPerishSongCount = 0
.OppConfusionTurns = 0
If .OppUsedBatonPass = False Then .OppConfusionTurns = 0
.OppTorment = 0
.OppTormentMove = Nothing
.OppChoiceMove = Nothing

View File

@ -913,8 +913,21 @@
_moveMenuAlpha -= 15
If _moveMenuAlpha <= 0 Then
_moveMenuAlpha = 0
MoveMenuStartRound(BattleScreen)
Visible = False
If BattleScreen.OwnPokemon.Attacks(_moveMenuIndex).ID = 226 Then
If PartyScreen.Selected <> -1 Then
BattleScreen.FieldEffects.OwnBatonPassIndex = PartyScreen.Selected
MoveMenuStartRound(BattleScreen)
PartyScreen.Selected = -1
Else
Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), Nothing, "Choose Pokémon", False, False, False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = False}
AddHandler selScreen.SelectedObject, Nothing
Core.SetScreen(selScreen)
End If
Else
MoveMenuStartRound(BattleScreen)
Visible = False
End If
End If
Else
UseStruggle(BattleScreen)
@ -980,12 +993,16 @@
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Add(BattleScreen.FocusBattle())
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
Dim BatonPassSuffix As String = ""
If BattleScreen.FieldEffects.OwnBatonPassIndex <> -1 Then
BatonPassSuffix = "|BATON|" & BattleScreen.FieldEffects.OwnBatonPassIndex
End If
If BattleScreen.IsMegaEvolvingOwn Then
BattleScreen.SendClientCommand("MEGA|" & BattleScreen.OwnPokemon.Attacks(_moveMenuIndex).ID.ToString())
BattleScreen.SendClientCommand("MEGA|" & BattleScreen.OwnPokemon.Attacks(_moveMenuIndex).ID.ToString() & BatonPassSuffix)
BattleScreen.IsMegaEvolvingOwn = False
BattleScreen.FieldEffects.OwnMegaEvolved = True
Else
BattleScreen.SendClientCommand("MOVE|" & BattleScreen.OwnPokemon.Attacks(_moveMenuIndex).ID.ToString())
BattleScreen.SendClientCommand("MOVE|" & BattleScreen.OwnPokemon.Attacks(_moveMenuIndex).ID.ToString() & BatonPassSuffix)
End If
Else
If BattleScreen.IsMegaEvolvingOwn Then

View File

@ -291,10 +291,12 @@
Public OwnUsedBatonPass As Boolean = False
Public OwnBatonPassStats As List(Of Integer)
Public OwnBatonPassConfusion As Boolean = False
Public OwnBatonPassIndex As Integer = -1
Public OppUsedBatonPass As Boolean = False
Public OppBatonPassStats As List(Of Integer)
Public OppBatonPassConfusion As Boolean = False
Public OppBatonPassIndex As Integer = -1
Public Function CanUseItem(ByVal own As Boolean) As Boolean
Dim embargo As Integer = OwnEmbargo

View File

@ -57,21 +57,34 @@
Public Overrides Sub MoveHits(own As Boolean, BattleScreen As BattleScreen)
If own = True Then
If Core.Player.CountFightablePokemon > 1 Then
If Core.Player.CountFightablePokemon > 1 AndAlso BattleScreen.FieldEffects.OwnBatonPassIndex <> BattleScreen.OwnPokemonIndex AndAlso BattleScreen.FieldEffects.OwnBatonPassIndex <> -1 Then
BattleScreen.FieldEffects.OwnUsedBatonPass = True
BattleScreen.Battle.SwitchOutOwn(BattleScreen, GetPokemonIndex(BattleScreen, own), -1)
BattleScreen.Battle.SwitchOutOwn(BattleScreen, BattleScreen.FieldEffects.OwnBatonPassIndex, -1)
BattleScreen.FieldEffects.OwnBatonPassIndex = -1
Else
BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!"))
End If
Else
If BattleScreen.IsTrainerBattle = True Or BattleScreen.IsRemoteBattle = True Or BattleScreen.IsPVPBattle = True Then
If BattleScreen.Trainer.CountUseablePokemon > 1 Then
If BattleScreen.IsTrainerBattle = True Then
If BattleScreen.IsRemoteBattle = True Or BattleScreen.IsPVPBattle = True Then
BattleScreen.FieldEffects.OppUsedBatonPass = True
If BattleScreen.Trainer.CountUseablePokemon > 1 AndAlso BattleScreen.FieldEffects.OppBatonPassIndex <> BattleScreen.OppPokemonIndex AndAlso BattleScreen.FieldEffects.OppBatonPassIndex <> -1 Then
BattleScreen.FieldEffects.OppUsedBatonPass = True
BattleScreen.Battle.SwitchOutOpp(BattleScreen, GetPokemonIndex(BattleScreen, own))
BattleScreen.Battle.SwitchOutOpp(BattleScreen, BattleScreen.FieldEffects.OppBatonPassIndex)
BattleScreen.FieldEffects.OppBatonPassIndex = -1
Else
BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!"))
End If
Else
BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!"))
If BattleScreen.Trainer.CountUseablePokemon > 1 Then
BattleScreen.FieldEffects.OppUsedBatonPass = True
BattleScreen.Battle.SwitchOutOpp(BattleScreen, GetPokemonIndex(BattleScreen, own))
Else
BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!"))
End If
End If
Else
BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!"))
@ -96,6 +109,6 @@
Return -1
End Function
End Class
End Class
End Namespace