From 4cca56097e7e77f7288dc7023f157f137bcdbb04 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Tue, 22 Feb 2022 22:25:49 +0100 Subject: [PATCH 1/7] MoveHits effects added Effects added: message, drainhp, gainhp Status effect now have a second argument (separated with a ",") to define the chance (integer between 0 and 100) Also fixed Freeze effect, which used to execute a Burn effect instead. --- P3D/Pokemon/Attacks/AttackSpecialFunctions.vb | 92 ++++++++++++++----- P3D/Pokemon/Attacks/GameModeAttackLoader.vb | 9 +- 2 files changed, 76 insertions(+), 25 deletions(-) diff --git a/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb b/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb index 69a474fce..a1ae48b0c 100644 --- a/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb +++ b/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb @@ -12,23 +12,71 @@ ''' Own toggle. ''' Reference to the BattleScreen. Public Shared Sub ExecuteAttackFunction(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen) - Dim functions() As String = Move.GameModeFunction.Split(CChar(",")) + Dim functions() As String = Move.GameModeFunction.Split(CChar("|")) + For i = 0 To functions.Count - 1 + Dim f As String = functions(i) + Dim fMain As String = f + Dim fSub As String = "" + If f.Contains(",") = True Then + fMain = f.GetSplit(0, ",") + Select Case fMain.ToLower() + Case "message" + fSub = Localization.GetString(f.GetSplit(1, ","), f.GetSplit(1, ",")) + Case "reducehp", "drainhp", "damage" + Dim HPAmount As Integer = CInt(fSub.GetSplit(0, ",")) + Dim Message As String = "" + Dim Target As Boolean = True + If fSub.Split(CChar(",")).Count > 1 Then + Target = CBool(fSub.GetSplit(1, ",")) + If fSub.Split(CChar(",")).Count > 2 Then + Message = fSub.GetSplit(2, ",") + End If + End If + BattleScreen.Battle.ReduceHP(HPAmount, Not Target, Target, BattleScreen, Message, Move.Name.ToLower) + Case "gainhp", "increasehp", "heal" + Dim HPAmount As Integer = CInt(fSub.GetSplit(0, ",")) + Dim Message As String = "" + Dim Target As Boolean = True + If fSub.Split(CChar(",")).Count > 1 Then + Target = CBool(fSub.GetSplit(1, ",")) + If fSub.Split(CChar(",")).Count > 2 Then + Message = fSub.GetSplit(2, ",") + End If + End If + BattleScreen.Battle.GainHP(HPAmount, Target, Target, BattleScreen, Message, Move.Name.ToLower) + Case Else + fSub = CInt(f.GetSplit(1, ",")).Clamp(0, 100).ToString + End Select + Else + Select Case f.ToLower() + Case "freeze" + fSub = "15" + Case "poison" + fSub = "40" + Case "toxic", "badpoison" + fSub = "25" + Case Else + fSub = "30" + End Select + End If - For Each f As String In functions - Select Case f.ToLower() + Select Case fMain.ToLower() + Case "message" + BattleScreen.BattleQuery.Add(New TextQueryObject(fSub)) Case "paralyze" - Paralyze(Move, own, BattleScreen) + Paralyze(Move, own, BattleScreen, CInt(fSub)) Case "poison" - Poison(Move, own, BattleScreen) + Poison(Move, own, BattleScreen, CInt(fSub)) Case "toxic", "badpoison" - BadPoison(Move, own, BattleScreen) + BadPoison(Move, own, BattleScreen, CInt(fSub)) Case "burn" - Burn(Move, own, BattleScreen) + Burn(Move, own, BattleScreen, CInt(fSub)) Case "freeze" - Burn(Move, own, BattleScreen) + Freeze(Move, own, BattleScreen, CInt(fSub)) Case "sleep" - Sleep(Move, own, BattleScreen) + Sleep(Move, own, BattleScreen, CInt(fSub)) End Select + i += 1 Next End Sub @@ -36,52 +84,52 @@ If move.Category = Attack.Categories.Special Then Return True Else - Return Core.Random.Next(0, 100) < chance + Return Core.Random.Next(0, 100) <= chance End If End Function - Private Shared Sub Paralyze(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen) - If GetEffectChanceResult(Move, 30) = True Then + Private Shared Sub Paralyze(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Chance As Integer) + If GetEffectChanceResult(Move, Chance) = True Then If BattleScreen.Battle.InflictParalysis(Not own, own, BattleScreen, "", "move:" & Move.Name.ToLower()) = False Then If Move.Category = Attack.Categories.Status Then BattleScreen.BattleQuery.Add(New TextQueryObject(Move.Name & " failed!")) End If End If End Sub - Private Shared Sub Burn(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen) - If GetEffectChanceResult(Move, 30) = True Then + Private Shared Sub Burn(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Chance As Integer) + If GetEffectChanceResult(Move, Chance) = True Then If BattleScreen.Battle.InflictBurn(Not own, own, BattleScreen, "", "move:" & Move.Name.ToLower()) = False Then If Move.Category = Attack.Categories.Status Then BattleScreen.BattleQuery.Add(New TextQueryObject(Move.Name & " failed!")) End If End If End Sub - Private Shared Sub Sleep(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen) - If GetEffectChanceResult(Move, 30) = True Then + Private Shared Sub Sleep(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Chance As Integer) + If GetEffectChanceResult(Move, Chance) = True Then If BattleScreen.Battle.InflictSleep(Not own, own, BattleScreen, -1, "", "move:" & Move.Name.ToLower()) = False Then If Move.Category = Attack.Categories.Status Then BattleScreen.BattleQuery.Add(New TextQueryObject(Move.Name & " failed!")) End If End If End Sub - Private Shared Sub Freeze(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen) - If GetEffectChanceResult(Move, 15) = True Then + Private Shared Sub Freeze(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Chance As Integer) + If GetEffectChanceResult(Move, Chance) = True Then If BattleScreen.Battle.InflictFreeze(Not own, own, BattleScreen, "", "move:" & Move.Name.ToLower()) = False Then If Move.Category = Attack.Categories.Status Then BattleScreen.BattleQuery.Add(New TextQueryObject(Move.Name & " failed!")) End If End If End Sub - Private Shared Sub Poison(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen) - If GetEffectChanceResult(Move, 40) = True Then + Private Shared Sub Poison(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Chance As Integer) + If GetEffectChanceResult(Move, Chance) = True Then If BattleScreen.Battle.InflictPoison(Not own, own, BattleScreen, False, "", "move:" & Move.Name.ToLower()) = False Then If Move.Category = Attack.Categories.Status Then BattleScreen.BattleQuery.Add(New TextQueryObject(Move.Name & " failed!")) End If End If End Sub - Private Shared Sub BadPoison(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen) - If GetEffectChanceResult(Move, 25) = True Then + Private Shared Sub BadPoison(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Chance As Integer) + If GetEffectChanceResult(Move, Chance) = True Then If BattleScreen.Battle.InflictPoison(Not own, own, BattleScreen, True, "", "move:" & Move.Name.ToLower()) = False Then If Move.Category = Attack.Categories.Status Then BattleScreen.BattleQuery.Add(New TextQueryObject(Move.Name & " failed!")) End If diff --git a/P3D/Pokemon/Attacks/GameModeAttackLoader.vb b/P3D/Pokemon/Attacks/GameModeAttackLoader.vb index 26be3a96c..05c9d826d 100644 --- a/P3D/Pokemon/Attacks/GameModeAttackLoader.vb +++ b/P3D/Pokemon/Attacks/GameModeAttackLoader.vb @@ -63,8 +63,12 @@ move.CurrentPP = CInt(value) move.MaxPP = CInt(value) move.OriginalPP = CInt(value) - Case "function" - move.GameModeFunction = value + Case "function", "movehits" + If move.GameModeFunction = "" Then + move.GameModeFunction = value + Else + move.GameModeFunction &= "|" & value + End If Case "power", "basepower" move.Power = CInt(value) Case "accuracy", "acc" @@ -105,7 +109,6 @@ move.Priority = CInt(value) Case "timestoattack", "tta" move.TimesToAttack = CInt(value) - Case "makescontact", "contact" move.MakesContact = CBool(value) Case "protectaffected" From dc5b439baf61013bf18acd320f0dcf29ba813c2c Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Sun, 27 Feb 2022 15:28:45 +0100 Subject: [PATCH 2/7] 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" From cc4203b15011ee735c0e682a0c1b2d24ebab63ca Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Sun, 27 Feb 2022 15:29:39 +0100 Subject: [PATCH 3/7] Made the 3d intro screen auto-load custom moves Just like the old 2d intro screen --- P3D/Screens/MainMenu/NewNewGameScreen.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/P3D/Screens/MainMenu/NewNewGameScreen.vb b/P3D/Screens/MainMenu/NewNewGameScreen.vb index 06bda6a75..6c884fc4f 100644 --- a/P3D/Screens/MainMenu/NewNewGameScreen.vb +++ b/P3D/Screens/MainMenu/NewNewGameScreen.vb @@ -17,7 +17,7 @@ PreScreen = currentScreen CanBePaused = False UpdateFadeOut = True - + BattleSystem.GameModeAttackLoader.Load() 'Set up 3D environment variables (Effect, Camera, SkyDome and Level): Effect = New BasicEffect(GraphicsDevice) From 2bdd3a3468647a2425948e00a324ce652d74d5f4 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Sat, 26 Mar 2022 11:47:07 +0100 Subject: [PATCH 4/7] GameMode Attack functionality update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed bug with GameModeAttackLoader not loading the right path * Added functionality for custom moves to change the camera angle * Added functionality for custom moves to faint a pokémon --- P3D/Pokemon/Attacks/AttackSpecialFunctions.vb | 18 ++++++++++++++++++ P3D/Pokemon/Attacks/GameModeAttackLoader.vb | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb b/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb index f801f07fa..e44ccda50 100644 --- a/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb +++ b/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb @@ -19,7 +19,11 @@ Dim fSub As String = "" If f.Contains(",") = True Then fMain = f.GetSplit(0, ",") + fSub = f.GetSplit(1, ",") Select Case fMain.ToLower() + Case "cameraangle" + Dim Direction As Integer = CInt(fSub) + BattleScreen.Battle.ChangeCameraAngle(Direction, own, BattleScreen) Case "message" fSub = Localization.GetString(f.GetSplit(1, ","), f.GetSplit(1, ",")) BattleScreen.BattleQuery.Add(New TextQueryObject(fSub)) @@ -27,6 +31,7 @@ Dim HPAmount As Integer = CInt(fSub.GetSplit(0, ",")) Dim Message As String = "" Dim Target As Boolean = True + If fSub.Split(CChar(",")).Count > 1 Then Target = CBool(fSub.GetSplit(1, ",")) If fSub.Split(CChar(",")).Count > 2 Then @@ -38,6 +43,7 @@ Dim HPAmount As Integer = CInt(fSub.GetSplit(0, ",")) Dim Message As String = "" Dim Target As Boolean = True + If fSub.Split(CChar(",")).Count > 1 Then Target = CBool(fSub.GetSplit(1, ",")) If fSub.Split(CChar(",")).Count > 2 Then @@ -47,10 +53,22 @@ 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 "faint" + Dim Target As Boolean = Not own + Dim Message As String = "" + + If fSub.Split(CChar(",")).Count > 1 Then + Target = Not CBool(fSub.GetSplit(1, ",")) + End If + If fSub.Split(CChar(",")).Count > 2 Then + Message = fSub.GetSplit(2, ",") + End If + BattleScreen.Battle.FaintPokemon(Target, BattleScreen, Message) Case Else fSub = CInt(f.GetSplit(1, ",")).Clamp(0, 100).ToString End Select diff --git a/P3D/Pokemon/Attacks/GameModeAttackLoader.vb b/P3D/Pokemon/Attacks/GameModeAttackLoader.vb index 05c9d826d..e785278f3 100644 --- a/P3D/Pokemon/Attacks/GameModeAttackLoader.vb +++ b/P3D/Pokemon/Attacks/GameModeAttackLoader.vb @@ -20,7 +20,7 @@ If GameModeManager.ActiveGameMode.IsDefaultGamemode = False Then If System.IO.Directory.Exists(GameController.GamePath & "\" & GameModeManager.ActiveGameMode.ContentPath & "\" & PATH) = True Then - For Each file As String In System.IO.Directory.GetFiles(GameController.GamePath & "\" & GameModeManager.ActiveGameMode.ContentPath & "\" & PATH, "*.dat") + For Each file As String In System.IO.Directory.GetFiles(GameController.GamePath & "\" & GameModeManager.ActiveGameMode.ContentPath & PATH, "*.dat") LoadMove(file) Next End If From 813992bf517ed76f068c5fbacd0a4bec348d200c Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Thu, 9 Jun 2022 13:35:54 +0200 Subject: [PATCH 5/7] Fix positioning of values in move summary screen --- P3D/Pokemon/Attacks/GameModeAttackLoader.vb | 3 ++- P3D/Screens/Pokemon/SummaryScreen.vb | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/P3D/Pokemon/Attacks/GameModeAttackLoader.vb b/P3D/Pokemon/Attacks/GameModeAttackLoader.vb index e785278f3..1b78c05ee 100644 --- a/P3D/Pokemon/Attacks/GameModeAttackLoader.vb +++ b/P3D/Pokemon/Attacks/GameModeAttackLoader.vb @@ -67,7 +67,8 @@ If move.GameModeFunction = "" Then move.GameModeFunction = value Else - move.GameModeFunction &= "|" & value + Dim OldFunctionList = move.GameModeFunction + move.GameModeFunction = OldFunctionList & "|" & value End If Case "power", "basepower" move.Power = CInt(value) diff --git a/P3D/Screens/Pokemon/SummaryScreen.vb b/P3D/Screens/Pokemon/SummaryScreen.vb index 524583c7e..404f56e88 100644 --- a/P3D/Screens/Pokemon/SummaryScreen.vb +++ b/P3D/Screens/Pokemon/SummaryScreen.vb @@ -516,14 +516,14 @@ 'Type: SpriteBatch.DrawString(FontManager.ChatFont, "Type:", New Vector2(DeltaX + 710, DeltaY + 80), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade * _moveFade))) - Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\Types"), New Rectangle(DeltaX + 824, DeltaY + 86, 48, 16), .Attacks(_moveIndex).Type.GetElementImage(), New Color(255, 255, 255, CInt(255 * _fadeIn * _pageFade * _moveFade))) + Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\Types"), New Rectangle(DeltaX + 840, DeltaY + 86, 48, 16), .Attacks(_moveIndex).Type.GetElementImage(), New Color(255, 255, 255, CInt(255 * _fadeIn * _pageFade * _moveFade))) SpriteBatch.DrawString(FontManager.ChatFont, "PP:", New Vector2(DeltaX + 710, DeltaY + 114), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade * _moveFade))) - SpriteBatch.DrawString(FontManager.ChatFont, .Attacks(_moveIndex).CurrentPP & " / " & .Attacks(_moveIndex).MaxPP, New Vector2(DeltaX + 824, DeltaY + 114), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade * _moveFade))) + SpriteBatch.DrawString(FontManager.MainFont, .Attacks(_moveIndex).CurrentPP & " / " & .Attacks(_moveIndex).MaxPP, New Vector2(DeltaX + 840, DeltaY + 114), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade * _moveFade))) 'Stats: SpriteBatch.DrawString(FontManager.ChatFont, "Category:", New Vector2(DeltaX + 710, DeltaY + 144), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade * _moveFade))) - Core.SpriteBatch.Draw(.Attacks(_moveIndex).GetDamageCategoryImage(), New Rectangle(DeltaX + 824, DeltaY + 145, 48, 24), New Color(255, 255, 255, CInt(255 * _fadeIn * _pageFade * _moveFade))) + Core.SpriteBatch.Draw(.Attacks(_moveIndex).GetDamageCategoryImage(), New Rectangle(DeltaX + 840, DeltaY + 145, 48, 24), New Color(255, 255, 255, CInt(255 * _fadeIn * _pageFade * _moveFade))) SpriteBatch.DrawString(FontManager.ChatFont, "Power:", New Vector2(DeltaX + 710, DeltaY + 176), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade * _moveFade))) @@ -532,7 +532,7 @@ power = "-" End If - SpriteBatch.DrawString(FontManager.ChatFont, power, New Vector2(DeltaX + 824, DeltaY + 176), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade * _moveFade))) + SpriteBatch.DrawString(FontManager.MainFont, power, New Vector2(DeltaX + 840, DeltaY + 176), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade * _moveFade))) Dim accuracy As String = .Attacks(_moveIndex).Accuracy.ToString() If .Attacks(_moveIndex).Accuracy <= 0 Then @@ -540,7 +540,7 @@ End If SpriteBatch.DrawString(FontManager.ChatFont, "Accuracy:", New Vector2(DeltaX + 710, DeltaY + 208), New Color(255, 255, 255, CInt(220 * _interfaceFade * _pageFade * _moveFade))) - SpriteBatch.DrawString(FontManager.ChatFont, accuracy, New Vector2(DeltaX + 824, DeltaY + 208), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade * _moveFade))) + SpriteBatch.DrawString(FontManager.MainFont, accuracy, New Vector2(DeltaX + 840, DeltaY + 208), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade * _moveFade))) 'Description: SpriteBatch.DrawString(FontManager.ChatFont, .Attacks(_moveIndex).Description.CropStringToWidth(FontManager.ChatFont, 300), New Vector2(DeltaX + 720, DeltaY + 240), New Color(255, 255, 255, CInt(220 * _fadeIn * _pageFade * _moveFade)), 0.0F, New Vector2(0), 1.0F, SpriteEffects.None, 0.0F) From a40a44181b0774ab33aa59e43d32ab3b5bb72f5e Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Thu, 9 Jun 2022 21:29:30 +0200 Subject: [PATCH 6/7] Make gamemode moves actually work --- P3D/Battle/BattleSystemV2/Battle.vb | 20 +--- P3D/Pokemon/Attacks/AttackSpecialFunctions.vb | 98 +++++++++++++------ 2 files changed, 69 insertions(+), 49 deletions(-) diff --git a/P3D/Battle/BattleSystemV2/Battle.vb b/P3D/Battle/BattleSystemV2/Battle.vb index 07b311e05..3f0ffee8f 100644 --- a/P3D/Battle/BattleSystemV2/Battle.vb +++ b/P3D/Battle/BattleSystemV2/Battle.vb @@ -3798,7 +3798,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -3813,7 +3812,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -3828,7 +3826,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -3843,7 +3840,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -3858,7 +3854,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -3873,7 +3868,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -3888,7 +3882,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -3902,11 +3895,9 @@ Dim p As Pokemon = BattleScreen.OwnPokemon Dim op As Pokemon = BattleScreen.OppPokemon Dim pNPC As NPC = BattleScreen.OwnPokemonNPC - If own = False Then - pNPC = BattleScreen.OppPokemonNPC - End If If own = False Then p = BattleScreen.OppPokemon + pNPC = BattleScreen.OppPokemonNPC op = BattleScreen.OwnPokemon End If @@ -4082,7 +4073,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -4097,7 +4087,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -4112,7 +4101,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -4127,7 +4115,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -4142,7 +4129,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -4157,7 +4143,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select Return True @@ -4172,7 +4157,6 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) - BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) End Select If val > 0 Then @@ -5337,11 +5321,11 @@ End If End If - ChangeCameraAngle(0, True, BattleScreen) 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}) diff --git a/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb b/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb index e44ccda50..099f81249 100644 --- a/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb +++ b/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb @@ -12,7 +12,7 @@ ''' Own toggle. ''' Reference to the 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("|")) + Dim functions() As String = Move.GameModeFunction.Split("|") For i = 0 To functions.Count - 1 Dim f As String = functions(i) Dim fMain As String = f @@ -23,59 +23,96 @@ Select Case fMain.ToLower() Case "cameraangle" Dim Direction As Integer = CInt(fSub) - BattleScreen.Battle.ChangeCameraAngle(Direction, own, BattleScreen) - Case "message" - fSub = Localization.GetString(f.GetSplit(1, ","), f.GetSplit(1, ",")) + Select Case Direction + Case 0 + BattleScreen.Battle.ChangeCameraAngle(0, own, BattleScreen) + Case 1 + BattleScreen.Battle.ChangeCameraAngle(1, True, BattleScreen) + Case 2 + BattleScreen.Battle.ChangeCameraAngle(2, True, BattleScreen) + End Select + Case "message", "text" + fSub = Localization.GetString(fSub, fSub) BattleScreen.BattleQuery.Add(New TextQueryObject(fSub)) + Case "raisestat", "increasestat" + Dim Stat As String = f.GetSplit(1, ",") + Dim Target As Boolean = own + Dim Message As String = "" + Dim RaiseAmount As Integer = 1 + + If f.Split(CChar(",")).Count > 2 Then + Target = CBool(f.GetSplit(2, ",")) + If f.Split(CChar(",")).Count > 3 Then + Message = f.GetSplit(3, ",") + If f.Split(CChar(",")).Count > 4 Then + If CInt(f.GetSplit(4, ",")) > 0 Then + RaiseAmount = CInt(f.GetSplit(4, ",")) + End If + End If + End If + End If + BattleScreen.Battle.RaiseStat(Target, own, BattleScreen, Stat, RaiseAmount, Message, "move:" & Move.Name) + Case "lowerstat", "decreasestat" + Dim Stat As String = f.GetSplit(1, ",") + Dim Message As String = "" + Dim Target As Boolean = own + Dim LowerAmount As Integer = 1 + If f.Split(CChar(",")).Count > 2 Then + Target = CBool(f.GetSplit(2, ",")) + If f.Split(CChar(",")).Count > 3 Then + Message = f.GetSplit(3, ",") + If f.Split(CChar(",")).Count > 4 Then + If CInt(f.GetSplit(4, ",")) > 0 Then + LowerAmount = CInt(f.GetSplit(4, ",")) + End If + End If + End If + End If + BattleScreen.Battle.LowerStat(Target, own, BattleScreen, Stat, LowerAmount, Message, "move:" & Move.Name) Case "reducehp", "drainhp", "damage" - Dim HPAmount As Integer = CInt(fSub.GetSplit(0, ",")) + Dim Target As Boolean = CBool(f.GetSplit(1, ",")) + Dim HPAmount As Integer = 0 Dim Message As String = "" - Dim Target As Boolean = True - If fSub.Split(CChar(",")).Count > 1 Then - Target = CBool(fSub.GetSplit(1, ",")) - If fSub.Split(CChar(",")).Count > 2 Then - Message = fSub.GetSplit(2, ",") + If f.Split(CChar(",")).Count > 2 Then + HPAmount = CInt(f.GetSplit(2, ",")) + If f.Split(CChar(",")).Count > 3 Then + Message = f.GetSplit(3, ",") End If End If - BattleScreen.Battle.ReduceHP(HPAmount, Not Target, Target, BattleScreen, Message, Move.Name.ToLower) + BattleScreen.Battle.ReduceHP(HPAmount, Target, own, BattleScreen, Message, Move.Name.ToLower) Case "gainhp", "increasehp", "heal" - Dim HPAmount As Integer = CInt(fSub.GetSplit(0, ",")) + Dim Target As Boolean = CBool(f.GetSplit(1, ",")) + Dim HPAmount As Integer = 0 Dim Message As String = "" - Dim Target As Boolean = True - If fSub.Split(CChar(",")).Count > 1 Then - Target = CBool(fSub.GetSplit(1, ",")) - If fSub.Split(CChar(",")).Count > 2 Then - Message = fSub.GetSplit(2, ",") + If f.Split(CChar(",")).Count > 2 Then + HPAmount = CInt(f.GetSplit(2, ",")) + If f.Split(CChar(",")).Count > 3 Then + Message = f.GetSplit(3, ",") End If End If - BattleScreen.Battle.GainHP(HPAmount, Target, Target, BattleScreen, Message, Move.Name.ToLower) + BattleScreen.Battle.GainHP(HPAmount, Target, own, BattleScreen, Message, Move.Name.ToLower) Case "endbattle" Dim Blackout As Boolean = False - If fSub.Split(CChar(",")).Count > 1 Then - Blackout = CBool(fSub.GetSplit(1, ",")) + If f.Split(CChar(",")).Count > 2 Then + Blackout = CBool(fSub) End If - BattleScreen.EndBattle(Blackout) + BattleScreen.BattleQuery.Add(New EndBattleQueryObject(Blackout)) Case "faint" - Dim Target As Boolean = Not own + Dim Target As Boolean = CBool(f.GetSplit(1, ",")) Dim Message As String = "" - If fSub.Split(CChar(",")).Count > 1 Then - Target = Not CBool(fSub.GetSplit(1, ",")) + If f.Split(CChar(",")).Count > 2 Then + Message = f.GetSplit(2, ",") End If - If fSub.Split(CChar(",")).Count > 2 Then - Message = fSub.GetSplit(2, ",") - End If - BattleScreen.Battle.FaintPokemon(Target, BattleScreen, Message) + BattleScreen.Battle.FaintPokemon(Not Target, BattleScreen, Message) 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" @@ -101,7 +138,6 @@ Case "sleep" Sleep(Move, own, BattleScreen, CInt(fSub)) End Select - i += 1 Next End Sub From 790afcdbbc55983131125388cb645e99cf739f48 Mon Sep 17 00:00:00 2001 From: "Jasper \"JappaWakka\" Speelman" Date: Fri, 10 Jun 2022 10:13:23 +0200 Subject: [PATCH 7/7] Made sure regular moves still work as expected --- P3D/Battle/BattleSystemV2/Battle.vb | 46 ++++++++++++++++++- P3D/Pokemon/Attacks/AttackSpecialFunctions.vb | 4 +- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/P3D/Battle/BattleSystemV2/Battle.vb b/P3D/Battle/BattleSystemV2/Battle.vb index 3f0ffee8f..3dcc2e882 100644 --- a/P3D/Battle/BattleSystemV2/Battle.vb +++ b/P3D/Battle/BattleSystemV2/Battle.vb @@ -3653,7 +3653,7 @@ End If End Function - Public Function RaiseStat(ByVal own As Boolean, ByVal from As Boolean, ByVal BattleScreen As BattleScreen, ByVal Stat As String, ByVal val As Integer, ByVal message As String, ByVal cause As String) As Boolean + Public Function RaiseStat(ByVal own As Boolean, ByVal from As Boolean, ByVal BattleScreen As BattleScreen, ByVal Stat As String, ByVal val As Integer, ByVal message As String, ByVal cause As String, Optional IsGameModeMove As Boolean = False) As Boolean Dim p As Pokemon = BattleScreen.OwnPokemon Dim op As Pokemon = BattleScreen.OppPokemon Dim pNPC As NPC = BattleScreen.OwnPokemonNPC @@ -3798,6 +3798,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -3812,6 +3815,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -3826,6 +3832,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -3840,6 +3849,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -3854,6 +3866,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -3868,6 +3883,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -3882,6 +3900,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -3891,7 +3912,7 @@ Return True End Function - Public Function LowerStat(ByVal own As Boolean, ByVal from As Boolean, ByVal BattleScreen As BattleScreen, ByVal Stat As String, ByVal val As Integer, ByVal message As String, ByVal cause As String) As Boolean + Public Function LowerStat(ByVal own As Boolean, ByVal from As Boolean, ByVal BattleScreen As BattleScreen, ByVal Stat As String, ByVal val As Integer, ByVal message As String, ByVal cause As String, Optional IsGameModeMove As Boolean = False) As Boolean Dim p As Pokemon = BattleScreen.OwnPokemon Dim op As Pokemon = BattleScreen.OppPokemon Dim pNPC As NPC = BattleScreen.OwnPokemonNPC @@ -4073,6 +4094,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -4087,6 +4111,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -4101,6 +4128,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -4115,6 +4145,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -4129,6 +4162,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -4143,6 +4179,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select Return True @@ -4157,6 +4196,9 @@ 'Do nothing Case Else 'Print message given in 'message' BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + If IsGameModeMove = False Then + BattleScreen.BattleQuery.Add(New TextQueryObject(printMessage)) + End If End Select If val > 0 Then diff --git a/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb b/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb index 099f81249..b5b6043c2 100644 --- a/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb +++ b/P3D/Pokemon/Attacks/AttackSpecialFunctions.vb @@ -51,7 +51,7 @@ End If End If End If - BattleScreen.Battle.RaiseStat(Target, own, BattleScreen, Stat, RaiseAmount, Message, "move:" & Move.Name) + BattleScreen.Battle.RaiseStat(Target, own, BattleScreen, Stat, RaiseAmount, Message, "move:" & Move.Name, True) Case "lowerstat", "decreasestat" Dim Stat As String = f.GetSplit(1, ",") Dim Message As String = "" @@ -68,7 +68,7 @@ End If End If End If - BattleScreen.Battle.LowerStat(Target, own, BattleScreen, Stat, LowerAmount, Message, "move:" & Move.Name) + BattleScreen.Battle.LowerStat(Target, own, BattleScreen, Stat, LowerAmount, Message, "move:" & Move.Name, True) Case "reducehp", "drainhp", "damage" Dim Target As Boolean = CBool(f.GetSplit(1, ",")) Dim HPAmount As Integer = 0