From f7c97ec7c94124e13c64b9fbded1d909794860ca Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Thu, 22 Dec 2022 14:48:06 +0100 Subject: [PATCH] Implemented Disable move & fixed Cursed Body turns When Cursed Body successfully executes, it now always disables moves for 4 turns too --- P3D/Battle/BattleSystemV2/Battle.vb | 32 +++++++++- P3D/Battle/BattleSystemV2/BattleMenu.vb | 10 ++- P3D/P3D.vbproj | 1 + P3D/Pokemon/Attacks/Attack.vb | 4 +- P3D/Pokemon/Attacks/Normal/Disable.vb | 84 +++++++++++++++++++++++++ 5 files changed, 123 insertions(+), 8 deletions(-) create mode 100644 P3D/Pokemon/Attacks/Normal/Disable.vb diff --git a/P3D/Battle/BattleSystemV2/Battle.vb b/P3D/Battle/BattleSystemV2/Battle.vb index 06d77fa3a..b5d272750 100644 --- a/P3D/Battle/BattleSystemV2/Battle.vb +++ b/P3D/Battle/BattleSystemV2/Battle.vb @@ -2364,7 +2364,7 @@ If Core.Random.Next(0, 100) < 30 Then ChangeCameraAngle(2, own, BattleScreen) BattleScreen.BattleQuery.Add(New TextQueryObject(op.GetDisplayName() & "'s Cursed Body disabled " & moveUsed.Name & "!")) - moveUsed.Disabled = Core.Random.Next(1, 6) + moveUsed.Disabled = 4 End If End If End If @@ -5445,7 +5445,12 @@ .BattleQuery.Add(New TextQueryObject(.OwnPokemon.GetDisplayName() & " got healed from the Torment" & Environment.NewLine & "due to Mental Herb!")) usedMentalHerb = True End If - 'Remove disable + For Each a As BattleSystem.Attack In .OwnPokemon.Attacks + If a.Disabled > 0 Then + a.Disabled = 0 + .BattleQuery.Add(New TextQueryObject(.OwnPokemon.GetDisplayName() & "'s" & " " & a.Name & " " & "is no longer disabled" & Environment.NewLine & "due to Mental Herb!")) + End If + Next If usedMentalHerb = True Then .OwnPokemon.Item = Nothing End If @@ -6092,6 +6097,14 @@ 'Disable 'For each move in moveset, reduce Disable count. If disable count = 0, print message. + For Each a As BattleSystem.Attack In .OwnPokemon.Attacks + If a.Disabled > 0 Then + a.Disabled -= 1 + If a.Disabled = 0 Then + .BattleQuery.Add(New TextQueryObject(.OwnPokemon.GetDisplayName() & "'s" & " " & a.Name & " " & "is no longer disabled.")) + End If + End If + Next If .FieldEffects.OwnEncore > 0 And .OwnPokemon.HP > 0 Then 'Encore .FieldEffects.OwnEncore -= 1 @@ -6328,7 +6341,12 @@ .BattleQuery.Add(New TextQueryObject(.OppPokemon.GetDisplayName() & " got healed from the Torment" & Environment.NewLine & "due to Mental Herb!")) usedMentalHerb = True End If - 'Remove disable + For Each a As BattleSystem.Attack In .OppPokemon.Attacks + If a.Disabled > 0 Then + a.Disabled = 0 + .BattleQuery.Add(New TextQueryObject(.OppPokemon.GetDisplayName() & "'s" & " " & a.Name & " " & "is no longer disabled" & Environment.NewLine & "due to Mental Herb!")) + End If + Next If usedMentalHerb = True Then .OppPokemon.Item = Nothing End If @@ -6969,6 +6987,14 @@ 'Disable 'For each move in moveset, reduce Disable count. If disable count = 0, print message. + For Each a As BattleSystem.Attack In .OppPokemon.Attacks + If a.Disabled > 0 Then + a.Disabled -= 1 + If a.Disabled = 0 Then + .BattleQuery.Add(New TextQueryObject(.OppPokemon.GetDisplayName() & "'s" & " " & a.Name & " " & "is no longer disabled.")) + End If + End If + Next If .FieldEffects.OppEncore > 0 And .OppPokemon.HP > 0 Then 'Encore .FieldEffects.OppEncore -= 1 diff --git a/P3D/Battle/BattleSystemV2/BattleMenu.vb b/P3D/Battle/BattleSystemV2/BattleMenu.vb index 133fbda0d..b48bcdf68 100644 --- a/P3D/Battle/BattleSystemV2/BattleMenu.vb +++ b/P3D/Battle/BattleSystemV2/BattleMenu.vb @@ -468,10 +468,14 @@ Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\Types", Me.Move.Type.GetElementImage(), ""), New Rectangle(Core.ScreenSize.Width - (AllExtended + extraExtended) + 28, 132 + Index * 96, 48, 16), New Color(255, 255, 255, 255 - deductAlpha)) If isSelected = True Then - Dim ppColor As Color = GetPPColor() - ppColor.A = CByte((extraExtended + AllExtended - deductAlpha).Clamp(0, 255)) + If Move.Disabled > 0 Then + Core.SpriteBatch.DrawString(FontManager.MainFont, "Disabled!", New Vector2(CInt(Core.ScreenSize.Width - (AllExtended + extraExtended) + 28), CInt(152 + Index * 96)), Color.Black) + Else + Dim ppColor As Color = GetPPColor() + ppColor.A = CByte((extraExtended + AllExtended - deductAlpha).Clamp(0, 255)) - Core.SpriteBatch.DrawString(FontManager.MainFont, Me.Move.CurrentPP & "/" & Me.Move.MaxPP, New Vector2(CInt(Core.ScreenSize.Width - (AllExtended + extraExtended) + 28), CInt(152 + Index * 96)), ppColor) + Core.SpriteBatch.DrawString(FontManager.MainFont, Me.Move.CurrentPP & "/" & Me.Move.MaxPP, New Vector2(CInt(Core.ScreenSize.Width - (AllExtended + extraExtended) + 28), CInt(152 + Index * 96)), ppColor) + End If Core.SpriteBatch.DrawString(FontManager.MainFont, Me.Move.Name, New Vector2(CInt(Core.ScreenSize.Width - (AllExtended + extraExtended) + 86), CInt(132 + Index * 96)), New Color(0, 0, 0, (SelExtended + AllExtended) - deductAlpha)) Else Core.SpriteBatch.DrawString(FontManager.MainFont, Me.Move.Name, New Vector2(Core.ScreenSize.Width - (AllExtended + extraExtended) + 28, 152 + Index * 96), New Color(0, 0, 0, 255 - (extraExtended + AllExtended) - deductAlpha)) diff --git a/P3D/P3D.vbproj b/P3D/P3D.vbproj index 6e400e518..04d530b7f 100644 --- a/P3D/P3D.vbproj +++ b/P3D/P3D.vbproj @@ -28282,6 +28282,7 @@ + diff --git a/P3D/Pokemon/Attacks/Attack.vb b/P3D/Pokemon/Attacks/Attack.vb index 4c5bb3dad..1920b22e6 100644 --- a/P3D/Pokemon/Attacks/Attack.vb +++ b/P3D/Pokemon/Attacks/Attack.vb @@ -353,8 +353,8 @@ returnMove = New Moves.Normal.Supersonic() Case 49 returnMove = New Moves.Normal.SonicBoom() - 'Case 50 - 'Disable + Case 50 + returnMove = New Moves.Normal.Disable() Case 51 returnMove = New Moves.Poison.Acid() Case 52 diff --git a/P3D/Pokemon/Attacks/Normal/Disable.vb b/P3D/Pokemon/Attacks/Normal/Disable.vb new file mode 100644 index 000000000..966cc68cb --- /dev/null +++ b/P3D/Pokemon/Attacks/Normal/Disable.vb @@ -0,0 +1,84 @@ +Namespace BattleSystem.Moves.Normal + + Public Class Disable + + Inherits Attack + + Public Sub New() + '#Definitions + Me.Type = New Element(Element.Types.Normal) + Me.ID = 50 + Me.OriginalPP = 20 + Me.CurrentPP = 20 + Me.MaxPP = 32 + Me.Power = 0 + Me.Accuracy = 100 + Me.Category = Categories.Status + Me.ContestCategory = ContestCategories.Smart + Me.Name = Localization.GetString("move_name_" & Me.ID, "Disable") + Me.Description = "For four turns, the target will be unable to use whichever move it last used." + Me.CriticalChance = 0 + Me.IsHMMove = False + Me.Target = Targets.AllAdjacentTargets + Me.Priority = 0 + Me.TimesToAttack = 1 + '#End + + '#SpecialDefinitions + Me.MakesContact = False + Me.ProtectAffected = True + Me.MagicCoatAffected = True + Me.SnatchAffected = False + Me.MirrorMoveAffected = True + Me.KingsrockAffected = False + Me.CounterAffected = False + + Me.DisabledWhileGravity = False + Me.UseEffectiveness = False + Me.ImmunityAffected = False + Me.HasSecondaryEffect = False + Me.RemovesFrozen = False + + Me.IsHealingMove = False + Me.IsRecoilMove = False + + Me.IsDamagingMove = False + Me.IsProtectMove = False + Me.IsSoundMove = False + + Me.IsAffectedBySubstitute = True + Me.IsOneHitKOMove = False + Me.IsWonderGuardAffected = False + '#End + + Me.AIField1 = AIField.LowerAttack + Me.AIField2 = AIField.Nothing + End Sub + + Public Overrides Sub MoveHits(own As Boolean, BattleScreen As BattleScreen) + Dim Target As Pokemon = BattleScreen.OppPokemon + Dim LastMove As Attack = BattleScreen.FieldEffects.OppLastMove + If own = False Then + Target = BattleScreen.OwnPokemon + LastMove = BattleScreen.FieldEffects.OwnLastMove + End If + If LastMove IsNot Nothing Then + If LastMove.Name.ToLower <> "struggle" AndAlso LastMove.Disabled = 0 Then + For Each a As BattleSystem.Attack In Target.Attacks + If a.ID = LastMove.ID Then + a.Disabled = 4 + BattleScreen.BattleQuery.Add(New TextQueryObject(Target.GetDisplayName() & "'s " & a.Name & " was Disabled!")) + End If + Next + Else + BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!")) + End If + Else + BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!")) + End If + + End Sub + + End Class + +End Namespace \ No newline at end of file