From dc5b439baf61013bf18acd320f0dcf29ba813c2c Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Sun, 27 Feb 2022 15:28:45 +0100 Subject: [PATCH] Made it possible for custom moves to end a battle Also made the text message MoveHitsFunction only appear if there's a message to display. --- P3D/Pokemon/Attacks/Attack.vb | 2 +- P3D/Pokemon/Attacks/AttackSpecialFunctions.vb | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/P3D/Pokemon/Attacks/Attack.vb b/P3D/Pokemon/Attacks/Attack.vb index cdddaf3ee..f8ebc40cf 100644 --- a/P3D/Pokemon/Attacks/Attack.vb +++ b/P3D/Pokemon/Attacks/Attack.vb @@ -1951,7 +1951,7 @@ ''' Reference to the BattleScreen. Public Overridable Sub MoveHits(ByVal own As Boolean, ByVal BattleScreen As BattleScreen) If Me.IsGameModeMove = True Then - AttackSpecialFunctions.ExecuteAttackFunction(Me, own, BattleScreen) + AttackSpecialFunctions.ExecuteMoveHitsFunction(Me, own, BattleScreen) Else 'DO NOTHING HERE (will do secondary effect if moves overrides it) End If diff --git a/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb b/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb index a1ae48b0c..f801f07fa 100644 --- a/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb +++ b/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb @@ -11,7 +11,7 @@ ''' The move containing the attack function. ''' Own toggle. ''' Reference to the BattleScreen. - Public Shared Sub ExecuteAttackFunction(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen) + Public Shared Sub ExecuteMoveHitsFunction(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen) Dim functions() As String = Move.GameModeFunction.Split(CChar("|")) For i = 0 To functions.Count - 1 Dim f As String = functions(i) @@ -22,6 +22,7 @@ Select Case fMain.ToLower() Case "message" fSub = Localization.GetString(f.GetSplit(1, ","), f.GetSplit(1, ",")) + BattleScreen.BattleQuery.Add(New TextQueryObject(fSub)) Case "reducehp", "drainhp", "damage" Dim HPAmount As Integer = CInt(fSub.GetSplit(0, ",")) Dim Message As String = "" @@ -44,11 +45,19 @@ End If End If BattleScreen.Battle.GainHP(HPAmount, Target, Target, BattleScreen, Message, Move.Name.ToLower) + Case "endbattle" + Dim Blackout As Boolean = False + If fSub.Split(CChar(",")).Count > 1 Then + Blackout = CBool(fSub.GetSplit(1, ",")) + End If + BattleScreen.EndBattle(Blackout) Case Else fSub = CInt(f.GetSplit(1, ",")).Clamp(0, 100).ToString End Select Else Select Case f.ToLower() + Case "endbattle" + BattleScreen.EndBattle(False) Case "freeze" fSub = "15" Case "poison" @@ -61,8 +70,6 @@ End If Select Case fMain.ToLower() - Case "message" - BattleScreen.BattleQuery.Add(New TextQueryObject(fSub)) Case "paralyze" Paralyze(Move, own, BattleScreen, CInt(fSub)) Case "poison"