Added GameRule "OverworldPoison"

if set to 0, no overworld poison (default)
if set to 1, overworld poison until fainted
if set to 2, overworld poison until 1 hp, then it's cured
This commit is contained in:
JappaWakka 2023-01-06 12:16:41 +01:00
parent a1a84bbe40
commit 728739760d
1 changed files with 47 additions and 0 deletions

View File

@ -168,6 +168,14 @@
_daycareSteps = value
End Set
End Property
Public Property PoisonSteps() As Integer
Get
Return _poisonSteps
End Get
Set(value As Integer)
_poisonSteps = value
End Set
End Property
Public Property GameMode() As String
Get
@ -393,6 +401,7 @@
Private _repelSteps As Integer = 0
Private _saveCreated As String = "Pre 0.21"
Private _daycareSteps As Integer = 0
Private _poisonSteps As Integer = 0
Private _gameMode As String = "Kolben"
Private _skin As String = "Hilbert"
Private _visitedMaps As String = ""
@ -1730,6 +1739,8 @@
Screen.Level.WalkedSteps += 1
Temp.MapSteps += 1
DaycareSteps += stepAmount
StepEventPoison(stepAmount)
PlayerStatistics.Track("Steps taken", stepAmount)
'Daycare cycle:
@ -1862,6 +1873,42 @@
End If
End If
End Sub
Private Sub StepEventPoison(ByVal stepAmount As Integer)
If CanFireStepEvent() = True Then
If CInt(GameModeManager.GetGameRuleValue("OverworldPoison", "0")) > 0 Then
Dim PoisonAmount As Integer = 0
PoisonSteps += stepAmount
If PoisonSteps >= 3 Then
PoisonAmount += 1
PoisonSteps -= 4
End If
If PoisonAmount > 0 Then
For i = 0 To Core.Player.Pokemons.Count - 1
If Core.Player.Pokemons(i).Status = Pokemon.StatusProblems.Poison OrElse Core.Player.Pokemons(i).Status = Pokemon.StatusProblems.BadPoison Then
If Core.Player.Pokemons(i).Ability IsNot Ability.GetAbilityByID(17) Then
Core.Player.Pokemons(i).HP -= 1 * PoisonAmount
End If
End If
Next
If CInt(GameModeManager.GetGameRuleValue("OverworldPoison", "0")) = 1 Then
For i = 0 To Core.Player.Pokemons.Count - 1
If Core.Player.Pokemons(i).HP <= 0 Then
Core.Player.Pokemons(i).Status = Pokemon.StatusProblems.Fainted
End If
Next
ElseIf CInt(GameModeManager.GetGameRuleValue("OverworldPoison", "0")) = 2 Then
For i = 0 To Core.Player.Pokemons.Count - 1
If Core.Player.Pokemons(i).HP <= 1 Then
Core.Player.Pokemons(i).Status = Pokemon.StatusProblems.None
Core.Player.Pokemons(i).HP = 1
Screen.TextBox.Show(Core.Player.Pokemons(i).GetDisplayName & "was cured of Poison")
End If
Next
End If
End If
End If
End If
End Sub
Private Sub StepEventPokegearCall()
If CanFireStepEvent() = True Then