After Fainting Switch, Revision 1

This commit is contained in:
CaptainSegis 2016-10-25 18:04:49 -05:00
parent a328c279b0
commit d22d1fd5d8
3 changed files with 212 additions and 180 deletions

View File

@ -229,6 +229,12 @@
Return BattleCalculation.SafariRound(BattleScreen) Return BattleCalculation.SafariRound(BattleScreen)
End If End If
'Own after fainting switching in non remote battles.
If (Not BattleScreen.IsRemoteBattle) AndAlso BattleScreen.OwnFaint Then
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Text, .Argument = "You have sent your next Pokemon!"}
End If
If Not BattleScreen.IsAfterFaint Then
If BattleScreen.FieldEffects.OppRecharge > 0 Then If BattleScreen.FieldEffects.OppRecharge > 0 Then
SelectedMoveOpp = False SelectedMoveOpp = False
BattleScreen.FieldEffects.OppRecharge -= 1 BattleScreen.FieldEffects.OppRecharge -= 1
@ -334,6 +340,7 @@
SelectedMoveOpp = False SelectedMoveOpp = False
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = GetPokemonMoveFromID(BattleScreen.OppPokemon, 117)} Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = GetPokemonMoveFromID(BattleScreen.OppPokemon, 117)}
End If End If
End If
'PVP action: 'PVP action:
If BattleScreen.IsRemoteBattle AndAlso BattleScreen.IsHost Then If BattleScreen.IsRemoteBattle AndAlso BattleScreen.IsHost Then
@ -355,7 +362,6 @@
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Text, .Argument = text} Return New RoundConst() With {.StepType = RoundConst.StepTypes.Text, .Argument = text}
End If End If
End If End If
'AI move here: 'AI move here:
If BattleScreen.IsTrainerBattle AndAlso Not BattleScreen.IsRemoteBattle Then If BattleScreen.IsTrainerBattle AndAlso Not BattleScreen.IsRemoteBattle Then
Return TrainerAI.GetAIMove(BattleScreen, OwnStep) Return TrainerAI.GetAIMove(BattleScreen, OwnStep)
@ -457,11 +463,16 @@
Public Sub InitializeRound(ByVal BattleScreen As BattleScreen, ByVal OwnStep As RoundConst) Public Sub InitializeRound(ByVal BattleScreen As BattleScreen, ByVal OwnStep As RoundConst)
If BattleScreen.OwnFaint OrElse BattleScreen.OppFaint Then
BattleScreen.IsAfterFaint = True
End If
If BattleHasEnded(BattleScreen) Then If BattleHasEnded(BattleScreen) Then
Exit Sub Exit Sub
End If End If
Dim OppStep As RoundConst = GetOppStep(BattleScreen, OwnStep) Dim OppStep As RoundConst = GetOppStep(BattleScreen, OwnStep)
BattleScreen.OwnFaint = False '''
BattleScreen.OppFaint = False '''
If OwnStep.StepType = RoundConst.StepTypes.Move Then If OwnStep.StepType = RoundConst.StepTypes.Move Then
OwnStep = GetAttack(BattleScreen, True, CType(OwnStep.Argument, Attack)) OwnStep = GetAttack(BattleScreen, True, CType(OwnStep.Argument, Attack))
Else Else
@ -3978,6 +3989,7 @@
EndRoundOpp(BattleScreen) EndRoundOpp(BattleScreen)
EndRoundOwn(BattleScreen) EndRoundOwn(BattleScreen)
End If End If
If BattleScreen.IsAfterFaint = False Then
.FieldEffects.Rounds += 1 .FieldEffects.Rounds += 1
If .FieldEffects.WeatherRounds > 0 Then If .FieldEffects.WeatherRounds > 0 Then
.FieldEffects.WeatherRounds -= 1 .FieldEffects.WeatherRounds -= 1
@ -4067,7 +4079,8 @@
If .FieldEffects.OppProtectMovesCount > 0 AndAlso Not .FieldEffects.OppLastMove Is Nothing AndAlso .FieldEffects.OppLastMove.IsProtectMove = False Then If .FieldEffects.OppProtectMovesCount > 0 AndAlso Not .FieldEffects.OppLastMove Is Nothing AndAlso .FieldEffects.OppLastMove.IsProtectMove = False Then
.FieldEffects.OppProtectMovesCount = 0 .FieldEffects.OppProtectMovesCount = 0
End If End If
End If
BattleScreen.IsAfterFaint = False
If .OwnPokemon.Status = Pokemon.StatusProblems.Fainted Or .OwnPokemon.HP <= 0 Then If .OwnPokemon.Status = Pokemon.StatusProblems.Fainted Or .OwnPokemon.HP <= 0 Then
.OwnPokemon.Status = Pokemon.StatusProblems.Fainted .OwnPokemon.Status = Pokemon.StatusProblems.Fainted
BattleScreen.OwnFaint = True BattleScreen.OwnFaint = True
@ -4219,7 +4232,9 @@
Exit Sub Exit Sub
End If End If
ChangeCameraAngel(0, True, BattleScreen) ChangeCameraAngel(0, True, BattleScreen)
If BattleScreen.IsAfterFaint = True Then
Exit Sub
End If
With BattleScreen With BattleScreen
If .FieldEffects.OwnReflect > 0 Then 'Stop reflect If .FieldEffects.OwnReflect > 0 Then 'Stop reflect
.FieldEffects.OwnReflect -= 1 .FieldEffects.OwnReflect -= 1
@ -4944,7 +4959,9 @@
Private Sub EndRoundOpp(ByVal BattleScreen As BattleScreen) Private Sub EndRoundOpp(ByVal BattleScreen As BattleScreen)
ChangeCameraAngel(0, True, BattleScreen) ChangeCameraAngel(0, True, BattleScreen)
If BattleScreen.IsAfterFaint = True Then
Exit Sub
End If
With BattleScreen With BattleScreen
If .FieldEffects.OppReflect > 0 Then 'Stop reflect If .FieldEffects.OppReflect > 0 Then 'Stop reflect
.FieldEffects.OppReflect -= 1 .FieldEffects.OppReflect -= 1
@ -6205,6 +6222,7 @@
Public Sub EndBattle(ByVal reason As EndBattleReasons, ByVal BattleScreen As BattleScreen, ByVal AddPVP As Boolean) Public Sub EndBattle(ByVal reason As EndBattleReasons, ByVal BattleScreen As BattleScreen, ByVal AddPVP As Boolean)
BattleSystem.BattleScreen.OwnFaint = False BattleSystem.BattleScreen.OwnFaint = False
BattleSystem.BattleScreen.OppFaint = False BattleSystem.BattleScreen.OppFaint = False
BattleSystem.BattleScreen.IsAfterFaint = False
If AddPVP = True Then If AddPVP = True Then
Select Case reason Select Case reason
Case EndBattleReasons.WinTrainer 'Lost Case EndBattleReasons.WinTrainer 'Lost

View File

@ -606,12 +606,13 @@
Case BattleSystem.BattleScreen.BattleModes.Standard Case BattleSystem.BattleScreen.BattleModes.Standard
If BattleScreen.OwnFaint Then If BattleScreen.OwnFaint Then
_mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 0, AddressOf MainMenuOpenPokemon)) _mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 0, AddressOf MainMenuOpenPokemon))
If BattleScreen.IsRemoteBattle AndAlso Not BattleScreen.IsHost Then
BattleScreen.OwnFaint = False BattleScreen.OwnFaint = False
End If
ElseIf BattleScreen.OppFaint And BattleScreen.IsRemoteBattle Then ElseIf BattleScreen.OppFaint And BattleScreen.IsRemoteBattle Then
If BattleScreen.IsHost Then If BattleScreen.IsHost Then
BattleScreen.BattleQuery.Clear() BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True)) BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
BattleScreen.OppFaint = False
BattleScreen.Battle.InitializeRound(BattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Text, .Argument = "The client sends the next pokemon!"}) BattleScreen.Battle.InitializeRound(BattleScreen, New Battle.RoundConst With {.StepType = Battle.RoundConst.StepTypes.Text, .Argument = "The client sends the next pokemon!"})
Else Else
BattleScreen.OwnStatistics.Switches += 1 BattleScreen.OwnStatistics.Switches += 1

View File

@ -8,6 +8,7 @@
'Used for after fainting switching 'Used for after fainting switching
Public Shared OwnFaint As Boolean = False Public Shared OwnFaint As Boolean = False
Public Shared OppFaint As Boolean = False Public Shared OppFaint As Boolean = False
Public Shared IsAfterFaint As Boolean = False 'Is after faint switching round
'Used for lead picking in PvP Battles 'Used for lead picking in PvP Battles
@ -118,6 +119,9 @@
Me.IsTrainerBattle = False Me.IsTrainerBattle = False
Me.MouseVisible = False Me.MouseVisible = False
Me.PVPGameJoltID = "" Me.PVPGameJoltID = ""
IsAfterFaint = False
OppFaint = False
OwnFaint = False
End Sub End Sub
Public Sub New(ByVal Trainer As Trainer, ByVal OverworldScreen As Screen, ByVal defaultMapType As Integer) Public Sub New(ByVal Trainer As Trainer, ByVal OverworldScreen As Screen, ByVal defaultMapType As Integer)
@ -127,6 +131,9 @@
Me.IsTrainerBattle = True Me.IsTrainerBattle = True
Me.MouseVisible = False Me.MouseVisible = False
Me.PVPGameJoltID = "" Me.PVPGameJoltID = ""
IsAfterFaint = False
OppFaint = False
OwnFaint = False
End Sub End Sub
#Region "Initialize" #Region "Initialize"
@ -1449,7 +1456,13 @@ nextIndex:
End While End While
CType(s, BattleScreen).BattleMenu.Visible = False CType(s, BattleScreen).BattleMenu.Visible = False
'prevents multi turn action to take place in an after fainting switching turn
If Not (OppFaint And CType(s, BattleScreen).IsRemoteBattle) Then
CType(s, BattleScreen).Battle.StartMultiTurnAction(CType(s, BattleScreen)) CType(s, BattleScreen).Battle.StartMultiTurnAction(CType(s, BattleScreen))
Else
CType(s, BattleScreen).BattleMenu.Visible = True
End If
End Sub End Sub
Public Sub SendEndRoundData() Public Sub SendEndRoundData()