Implemented Cud Chew Ability

This commit is contained in:
Jasper Speelman 2025-08-22 16:52:55 +02:00
parent 9cb12a4130
commit 034fa14393
6 changed files with 119 additions and 2 deletions

View File

@ -4927,6 +4927,59 @@
End If End If
End Sub End Sub
Public Sub UseEffectBerry(ByVal own As Boolean, ByVal from As Boolean, ByVal BerryItem As Item, ByVal BattleScreen As BattleScreen, ByVal message As String, ByVal cause As String)
Dim p As Pokemon = BattleScreen.OwnPokemon
Dim op As Pokemon = BattleScreen.OppPokemon
If own = False Then
p = BattleScreen.OppPokemon
op = BattleScreen.OwnPokemon
End If
Select Case BerryItem.Name.ToLower()
Case "lum"
If p.Status = Pokemon.StatusProblems.Burn Then
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("single_heal", False))
CureStatusProblem(own, own, BattleScreen, "The Lum Berry cured the burn of " & p.GetDisplayName() & "!", "berry:lum")
End If
If p.Status = Pokemon.StatusProblems.Freeze Then
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("single_heal", False))
CureStatusProblem(own, own, BattleScreen, "The Lum Berry thraw out " & p.GetDisplayName() & "!", "berry:lum")
End If
If p.Status = Pokemon.StatusProblems.Paralyzed Then
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("single_heal", False))
CureStatusProblem(own, own, BattleScreen, "The Lum Berry cured the paralysis of " & p.GetDisplayName() & "!", "berry:lum")
End If
If p.Status = Pokemon.StatusProblems.Sleep Then
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("single_heal", False))
CureStatusProblem(own, own, BattleScreen, "The Lum Berry woke up " & p.GetDisplayName() & "!", "berry:lum")
End If
Case "rawst"
If p.Status = Pokemon.StatusProblems.Burn Then
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("single_heal", False))
CureStatusProblem(own, own, BattleScreen, "The Rawst Berry cured the burn of " & p.GetDisplayName() & "!", "berry:rawst")
End If
Case "aspear"
If p.Status = Pokemon.StatusProblems.Freeze Then
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("single_heal", False))
CureStatusProblem(own, own, BattleScreen, "The Aspear Berry thraw out " & p.GetDisplayName() & "!", "berry:aspear")
End If
Case "cheri"
If p.Status = Pokemon.StatusProblems.Paralyzed Then
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("single_heal", False))
CureStatusProblem(own, own, BattleScreen, "The Cheri Berry cured the paralysis of " & p.GetDisplayName() & "!", "berry:cheri")
End If
Case "chesto"
If p.Status = Pokemon.StatusProblems.Sleep Then
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("single_heal", False))
CureStatusProblem(own, own, BattleScreen, "The Chesto Berry woke up " & p.GetDisplayName() & "!", "berry:chesto")
End If
End Select
End Sub
Public Sub UseBerry(ByVal own As Boolean, ByVal from As Boolean, ByVal BerryItem As Item, ByVal BattleScreen As BattleScreen, ByVal message As String, ByVal cause As String) Public Sub UseBerry(ByVal own As Boolean, ByVal from As Boolean, ByVal BerryItem As Item, ByVal BattleScreen As BattleScreen, ByVal message As String, ByVal cause As String)
Dim p As Pokemon = BattleScreen.OwnPokemon Dim p As Pokemon = BattleScreen.OwnPokemon
Dim op As Pokemon = BattleScreen.OppPokemon Dim op As Pokemon = BattleScreen.OppPokemon
@ -5056,6 +5109,21 @@
Dim ItemID As Integer = p.Item.ID Dim ItemID As Integer = p.Item.ID
Dim lostItem As Item = Item.GetItemByID(ItemID.ToString) Dim lostItem As Item = Item.GetItemByID(ItemID.ToString)
Dim CudChewBerries As String() = {"oran", "sitrus", "figy", "wiki", "mago", "aguav", "iapapa", "liechi", "ganlon", "salac", "petaya", "apicot", "lansat", "starf", "lum", "rawst", "aspear", "cheri", "chesto"}
If CudChewBerries.Contains(lostItem.Name.ToLower) Then
If lostItem.IsBerry = True Then
If p.Ability.Name.ToLower() = "cud chew" Then
If own = True Then
BattleScreen.FieldEffects.OwnCudChewBerry = lostItem
BattleScreen.FieldEffects.OwnCudChewIndex = BattleScreen.OwnPokemonIndex
Else
BattleScreen.FieldEffects.OppCudChewBerry = lostItem
BattleScreen.FieldEffects.OppCudChewIndex = BattleScreen.OppPokemonIndex
End If
End If
End If
End If
If from = own Then If from = own Then
If own = True Then If own = True Then
BattleScreen.FieldEffects.OwnConsumedItem = lostItem BattleScreen.FieldEffects.OwnConsumedItem = lostItem
@ -6615,6 +6683,18 @@
End If End If
End If End If
If .FieldEffects.OwnCudChewIndex <> -1 AndAlso .FieldEffects.OwnCudChewBerry IsNot Nothing Then
.BattleQuery.Add(New TextQueryObject(.OwnPokemon.GetDisplayName() & " regurgitated the " & .FieldEffects.OwnCudChewBerry.Name & " Berry due to Cud Chew!"))
Dim RegularBerries As String() = {"oran", "sitrus", "figy", "wiki", "mago", "aguav", "iapapa", "liechi", "ganlon", "salac", "petaya", "apicot", "lansat", "starf"}
If RegularBerries.Contains(.FieldEffects.OwnCudChewBerry.Name.ToLower) Then
UseBerry(True, True, .FieldEffects.OwnCudChewBerry, BattleScreen, "", "ability:cudchew")
Else
UseEffectBerry(True, True, .FieldEffects.OwnCudChewBerry, BattleScreen, "", "ability:cudchew")
End If
.FieldEffects.OwnCudChewBerry = Nothing
.FieldEffects.OwnCudChewIndex = -1
End If
If .OwnPokemon.HP > 0 Then If .OwnPokemon.HP > 0 Then
If .OwnPokemon.Ability.Name.ToLower() = "moody" Then If .OwnPokemon.Ability.Name.ToLower() = "moody" Then
Dim cannotRaise As New List(Of Integer) Dim cannotRaise As New List(Of Integer)
@ -7508,6 +7588,19 @@
End If End If
End If End If
If .FieldEffects.OppCudChewIndex <> -1 AndAlso .FieldEffects.OppCudChewBerry IsNot Nothing Then
.BattleQuery.Add(New TextQueryObject(.OppPokemon.GetDisplayName() & " regurgitated the " & .FieldEffects.OppCudChewBerry.Name & " Berry due to Cud Chew!"))
Dim RegularBerries As String() = {"oran", "sitrus", "figy", "wiki", "mago", "aguav", "iapapa", "liechi", "ganlon", "salac", "petaya", "apicot", "lansat", "starf"}
If RegularBerries.Contains(.FieldEffects.OppCudChewBerry.Name.ToLower) Then
UseBerry(False, False, .FieldEffects.OppCudChewBerry, BattleScreen, "", "ability:cudchew")
Else
UseEffectBerry(False, False, .FieldEffects.OwnCudChewBerry, BattleScreen, "", "ability:cudchew")
End If
.FieldEffects.OppCudChewBerry = Nothing
.FieldEffects.OppCudChewIndex = -1
End If
If .OppPokemon.HP > 0 Then If .OppPokemon.HP > 0 Then
If .OppPokemon.Ability.Name.ToLower() = "moody" Then If .OppPokemon.Ability.Name.ToLower() = "moody" Then
Dim cannotRaise As New List(Of Integer) Dim cannotRaise As New List(Of Integer)

View File

@ -1198,6 +1198,12 @@
Dim Item As Item = Item.GetItemByID(TempItemID) Dim Item As Item = Item.GetItemByID(TempItemID)
If Item.UseOnPokemon(PokeIndex) = True Then If Item.UseOnPokemon(PokeIndex) = True Then
Dim CudChewBerries As String() = {"oran", "sitrus", "figy", "wiki", "mago", "aguav", "iapapa", "liechi", "ganlon", "salac", "petaya", "apicot", "lansat", "starf", "lum", "rawst", "aspear", "cheri", "chesto"}
If Core.Player.Pokemons(PokeIndex).Ability.Name.ToLower() = "cud chew" AndAlso Item.IsBerry = True AndAlso CudChewBerries.Contains(Item.Name.ToLower) Then
TempBattleScreen.FieldEffects.OwnCudChewBerry = Item
TempBattleScreen.FieldEffects.OwnCudChewIndex = PokeIndex
End If
TempBattleScreen.BattleQuery.Clear() TempBattleScreen.BattleQuery.Clear()
TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle()) TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle())
TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True)) TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))

View File

@ -102,6 +102,8 @@
Public OwnUsedMoves As New List(Of Integer) Public OwnUsedMoves As New List(Of Integer)
Public OwnMagicCoat As Integer = 0 Public OwnMagicCoat As Integer = 0
Public OwnConsumedItem As Item = Nothing Public OwnConsumedItem As Item = Nothing
Public OwnCudChewBerry As Item = Nothing 'Cud Chew Ability
Public OwnCudChewIndex As Integer = -1
Public OwnSmacked As Integer = 0 'Smack Down effect condition Public OwnSmacked As Integer = 0 'Smack Down effect condition
Public OwnPursuit As Boolean = False Public OwnPursuit As Boolean = False
Public OwnMegaEvolved As Boolean = False Public OwnMegaEvolved As Boolean = False
@ -231,6 +233,8 @@
Public OppPokemonDamagedLastTurn As Boolean = False Public OppPokemonDamagedLastTurn As Boolean = False
Public OppMagicCoat As Integer = 0 Public OppMagicCoat As Integer = 0
Public OppConsumedItem As Item = Nothing Public OppConsumedItem As Item = Nothing
Public OppCudChewBerry As Item = Nothing
Public OppCudChewIndex As Integer = -1
Public OppSmacked As Integer = 0 Public OppSmacked As Integer = 0
Public OppPursuit As Boolean = False Public OppPursuit As Boolean = False
Public OppMegaEvolved As Boolean = False Public OppMegaEvolved As Boolean = False

View File

@ -28842,6 +28842,7 @@
<Compile Include="Entites\Enviroment\HoleBlock.vb" /> <Compile Include="Entites\Enviroment\HoleBlock.vb" />
<Compile Include="Overworld\NotificationPopup.vb" /> <Compile Include="Overworld\NotificationPopup.vb" />
<Compile Include="Overworld\RouteSign.vb" /> <Compile Include="Overworld\RouteSign.vb" />
<Compile Include="Pokemon\Abilities\CudChew.vb" />
<Compile Include="Pokemon\Abilities\SteamEngine.vb" /> <Compile Include="Pokemon\Abilities\SteamEngine.vb" />
<Compile Include="Pokemon\Abilities\Aerilate.vb" /> <Compile Include="Pokemon\Abilities\Aerilate.vb" />
<Compile Include="Pokemon\Abilities\PsychicSurge.vb" /> <Compile Include="Pokemon\Abilities\PsychicSurge.vb" />

View File

@ -619,8 +619,8 @@
'Hadron Engine 'Hadron Engine
'Case 290 'Case 290
'Opportunist 'Opportunist
'Case 291 Case 291
'Cud Chew Return New Abilities.CudChew
'Case 292 'Case 292
'Sharpness 'Sharpness
'Case 293 'Case 293

View File

@ -0,0 +1,13 @@
Namespace Abilities
Public Class CudChew
Inherits Ability
Public Sub New()
MyBase.New(291, "Cud Chew", "When the Pokémon eats a Berry, it will regurgitate that Berry at the end of the next turn and eat it one more time.")
End Sub
End Class
End Namespace