Fix stealth rock

This commit is contained in:
JappaWakka 2023-07-21 20:11:17 +02:00
parent 71bd0eaaef
commit 0e9623c557

View File

@ -7905,6 +7905,7 @@
End Sub End Sub
Public Sub SwitchInOpp(ByVal BattleScreen As BattleScreen, ByVal FirstTime As Boolean, ByVal index As Integer) Public Sub SwitchInOpp(ByVal BattleScreen As BattleScreen, ByVal FirstTime As Boolean, ByVal index As Integer)
Dim AddSwitch As Boolean = False
If FirstTime = False Then If FirstTime = False Then
ChangeCameraAngle(1, False, BattleScreen) ChangeCameraAngle(1, False, BattleScreen)
HasSwitchedInOpp = True HasSwitchedInOpp = True
@ -7959,8 +7960,10 @@
Dim oppModel As String = BattleScreen.GetModelName(False) Dim oppModel As String = BattleScreen.GetModelName(False)
'Switch BattleStyle 'Switch BattleStyle
If BattleScreen.FieldEffects.OwnDigCounter = 0 AndAlso BattleScreen.FieldEffects.OwnFlyCounter = 0 AndAlso BattleScreen.FieldEffects.OwnDiveCounter = 0 Then If BattleScreen.FieldEffects.OwnDigCounter = 0 AndAlso BattleScreen.FieldEffects.OwnFlyCounter = 0 AndAlso BattleScreen.FieldEffects.OwnDiveCounter = 0 Then
If Core.Player.BattleStyle <> 1 AndAlso OppStep.StepType <> RoundConst.StepTypes.Switch AndAlso BattleScreen.IsPVPBattle = False Then If Core.Player.BattleStyle <> 1 AndAlso OppStep.StepType <> RoundConst.StepTypes.Switch AndAlso BattleScreen.IsPVPBattle = False Then
AddSwitch = True
BattleScreen.BattleQuery.Add(New SwitchPokemonQueryObject(BattleScreen, BattleScreen.OppPokemon)) BattleScreen.BattleQuery.Add(New SwitchPokemonQueryObject(BattleScreen, BattleScreen.OppPokemon))
BattleScreen.Battle.ChangeCameraAngle(1, False, BattleScreen) BattleScreen.Battle.ChangeCameraAngle(1, False, BattleScreen)
End If End If
@ -8015,101 +8018,98 @@
BattleScreen.BattleQuery.Add(BallThrow) BattleScreen.BattleQuery.Add(BallThrow)
End If End If
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})
End If End If
If AddSwitch = False Then
With BattleScreen
Dim p As Pokemon = .OppPokemon
Dim op As Pokemon = .OwnPokemon
With BattleScreen Dim spikeAffected As Boolean = True
Dim p As Pokemon = .OppPokemon Dim rockAffected As Boolean = True
Dim op As Pokemon = .OwnPokemon
Dim spikeAffected As Boolean = True spikeAffected = BattleScreen.FieldEffects.IsGrounded(False, BattleScreen)
Dim rockAffected As Boolean = True
spikeAffected = BattleScreen.FieldEffects.IsGrounded(False, BattleScreen) If spikeAffected = True Then
If .FieldEffects.OwnSpikes > 0 And p.Ability.Name.ToLower() <> "magic guard" Then
If spikeAffected = True Then Dim spikeDamage As Double = 1D
If .FieldEffects.OwnSpikes > 0 And p.Ability.Name.ToLower() <> "magic guard" Then Select Case .FieldEffects.OwnSpikes
Dim spikeDamage As Double = 1D Case 1
Select Case .FieldEffects.OwnSpikes spikeDamage = (p.MaxHP / 100) * 12.5D
Case 1 Case 2
spikeDamage = (p.MaxHP / 100) * 12.5D spikeDamage = (p.MaxHP / 100) * 16.7D
Case 2 Case 3
spikeDamage = (p.MaxHP / 100) * 16.7D spikeDamage = (p.MaxHP / 100) * 25D
Case 3 End Select
spikeDamage = (p.MaxHP / 100) * 25D ReduceHP(CInt(spikeDamage), False, True, BattleScreen, "The Spikes hurt " & p.GetDisplayName() & "!", "spikes")
End Select
ReduceHP(CInt(spikeDamage), False, True, BattleScreen, "The Spikes hurt " & p.GetDisplayName() & "!", "spikes")
End If
End If
'Sticky Web
If spikeAffected = True Then
If .FieldEffects.OwnStickyWeb > 0 Then
LowerStat(False, False, BattleScreen, "Speed", 1, "The opposing pokemon was caught in a Sticky Web!", "stickyweb")
End If
End If
If spikeAffected = True Then
If .FieldEffects.OwnToxicSpikes > 0 And p.Status = Pokemon.StatusProblems.None And p.Type1.Type <> Element.Types.Poison And p.Type2.Type <> Element.Types.Poison Then
Select Case .FieldEffects.OwnToxicSpikes
Case 1
InflictPoison(False, True, BattleScreen, False, "The Toxic Spikes hurt " & p.GetDisplayName() & "!", "toxicspikes")
Case 2
InflictPoison(False, True, BattleScreen, True, "The Toxic Spikes hurt " & p.GetDisplayName() & "!", "toxicspikes")
End Select
End If
If .FieldEffects.OwnToxicSpikes > 0 Then
If p.Type1.Type = Element.Types.Poison Or p.Type2.Type = Element.Types.Poison Then
.BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & " removed the Toxic Spikes!"))
.FieldEffects.OwnToxicSpikes = 0
End If End If
End If End If
End If 'Sticky Web
If spikeAffected = True Then
If rockAffected = True Then If .FieldEffects.OwnStickyWeb > 0 Then
If .FieldEffects.OwnStealthRock > 0 And p.Ability.Name.ToLower() <> "magic guard" Then LowerStat(False, False, BattleScreen, "Speed", 1, "The opposing pokemon was caught in a Sticky Web!", "stickyweb")
Dim rocksDamage As Double = 1D End If
Dim effectiveness As Single = BattleCalculation.ReverseTypeEffectiveness(Element.GetElementMultiplier(New Element(Element.Types.Rock), p.Type1)) * BattleCalculation.ReverseTypeEffectiveness(Element.GetElementMultiplier(New Element(Element.Types.Rock), p.Type2))
Select Case effectiveness
Case 0.25F
rocksDamage = (p.MaxHP / 100) * 3.125D
Case 0.5F
rocksDamage = (p.MaxHP / 100) * 6.25D
Case 1.0F
rocksDamage = (p.MaxHP / 100) * 12.5D
Case 2.0F
rocksDamage = (p.MaxHP / 100) * 25D
Case 4.0F
rocksDamage = (p.MaxHP / 100) * 50D
End Select
ReduceHP(CInt(rocksDamage), False, True, BattleScreen, "The Stealth Rocks hurt " & p.GetDisplayName() & "!", "stealthrocks")
End If End If
End If If spikeAffected = True Then
If .FieldEffects.OwnToxicSpikes > 0 And p.Status = Pokemon.StatusProblems.None And p.Type1.Type <> Element.Types.Poison And p.Type2.Type <> Element.Types.Poison Then
TriggerAbilityEffect(BattleScreen, False) Select Case .FieldEffects.OwnToxicSpikes
TriggerItemEffect(BattleScreen, False) Case 1
InflictPoison(False, True, BattleScreen, False, "The Toxic Spikes hurt " & p.GetDisplayName() & "!", "toxicspikes")
If .OppPokemon.Status = Pokemon.StatusProblems.Sleep Then Case 2
.FieldEffects.OppSleepTurns = Core.Random.Next(1, 4) InflictPoison(False, True, BattleScreen, True, "The Toxic Spikes hurt " & p.GetDisplayName() & "!", "toxicspikes")
End If End Select
End If
If BattleScreen.FieldEffects.OppHealingWish = True Then If .FieldEffects.OwnToxicSpikes > 0 Then
BattleScreen.FieldEffects.OppHealingWish = False If p.Type1.Type = Element.Types.Poison Or p.Type2.Type = Element.Types.Poison Then
.BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & " removed the Toxic Spikes!"))
If .OppPokemon.HP < .OppPokemon.MaxHP Or .OppPokemon.Status <> Pokemon.StatusProblems.None Then .FieldEffects.OwnToxicSpikes = 0
GainHP(.OppPokemon.MaxHP - .OppPokemon.HP, False, False, BattleScreen, "The Healing Wish came true for " & .OppPokemon.GetDisplayName() & "!", "move:healingwish") End If
CureStatusProblem(False, False, BattleScreen, "", "move:healingwish") End If
End If End If
End If
If Core.Player.BattleStyle = 1 OrElse BattleScreen.IsPVPBattle = True Then If rockAffected = True Then
BattleScreen.HasSwitchedOwn = False If .FieldEffects.OwnStealthRock > 0 And p.Ability.Name.ToLower() <> "magic guard" Then
StartRound(BattleScreen) Dim rocksDamage As Double = 1D
End If
End With Dim effectiveness As Single = BattleCalculation.ReverseTypeEffectiveness(Element.GetElementMultiplier(New Element(Element.Types.Rock), p.Type1)) * BattleCalculation.ReverseTypeEffectiveness(Element.GetElementMultiplier(New Element(Element.Types.Rock), p.Type2))
Select Case effectiveness
Case 0.25F
rocksDamage = (p.MaxHP / 100) * 3.125D
Case 0.5F
rocksDamage = (p.MaxHP / 100) * 6.25D
Case 1.0F
rocksDamage = (p.MaxHP / 100) * 12.5D
Case 2.0F
rocksDamage = (p.MaxHP / 100) * 25D
Case 4.0F
rocksDamage = (p.MaxHP / 100) * 50D
End Select
ReduceHP(CInt(rocksDamage), False, True, BattleScreen, "The Stealth Rocks hurt " & p.GetDisplayName() & "!", "stealthrocks")
End If
End If
TriggerAbilityEffect(BattleScreen, False)
TriggerItemEffect(BattleScreen, False)
If .OppPokemon.Status = Pokemon.StatusProblems.Sleep Then
.FieldEffects.OppSleepTurns = Core.Random.Next(1, 4)
End If
If BattleScreen.FieldEffects.OppHealingWish = True Then
BattleScreen.FieldEffects.OppHealingWish = False
If .OppPokemon.HP < .OppPokemon.MaxHP Or .OppPokemon.Status <> Pokemon.StatusProblems.None Then
GainHP(.OppPokemon.MaxHP - .OppPokemon.HP, False, False, BattleScreen, "The Healing Wish came true for " & .OppPokemon.GetDisplayName() & "!", "move:healingwish")
CureStatusProblem(False, False, BattleScreen, "", "move:healingwish")
End If
End If
If Core.Player.BattleStyle = 1 OrElse BattleScreen.IsPVPBattle = True Then
BattleScreen.HasSwitchedOwn = False
StartRound(BattleScreen)
End If
End With
End If
End Sub End Sub
#End Region #End Region