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

View File

@ -606,12 +606,13 @@
Case BattleSystem.BattleScreen.BattleModes.Standard
If BattleScreen.OwnFaint Then
_mainMenuItemList.Add(New MainMenuItem(1, "Pokémon", 0, AddressOf MainMenuOpenPokemon))
If BattleScreen.IsRemoteBattle AndAlso Not BattleScreen.IsHost Then
BattleScreen.OwnFaint = False
End If
ElseIf BattleScreen.OppFaint And BattleScreen.IsRemoteBattle Then
If BattleScreen.IsHost Then
BattleScreen.BattleQuery.Clear()
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!"})
Else
BattleScreen.OwnStatistics.Switches += 1

View File

@ -8,6 +8,7 @@
'Used for after fainting switching
Public Shared OwnFaint 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
@ -118,6 +119,9 @@
Me.IsTrainerBattle = False
Me.MouseVisible = False
Me.PVPGameJoltID = ""
IsAfterFaint = False
OppFaint = False
OwnFaint = False
End Sub
Public Sub New(ByVal Trainer As Trainer, ByVal OverworldScreen As Screen, ByVal defaultMapType As Integer)
@ -127,6 +131,9 @@
Me.IsTrainerBattle = True
Me.MouseVisible = False
Me.PVPGameJoltID = ""
IsAfterFaint = False
OppFaint = False
OwnFaint = False
End Sub
#Region "Initialize"
@ -1449,7 +1456,13 @@ nextIndex:
End While
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))
Else
CType(s, BattleScreen).BattleMenu.Visible = True
End If
End Sub
Public Sub SendEndRoundData()