diff --git a/P3D/Battle/BattleSystemV2/Battle.vb b/P3D/Battle/BattleSystemV2/Battle.vb index 692a0c467..ca452ade5 100644 --- a/P3D/Battle/BattleSystemV2/Battle.vb +++ b/P3D/Battle/BattleSystemV2/Battle.vb @@ -7905,6 +7905,7 @@ End Sub Public Sub SwitchInOpp(ByVal BattleScreen As BattleScreen, ByVal FirstTime As Boolean, ByVal index As Integer) + Dim AddSwitch As Boolean = False If FirstTime = False Then ChangeCameraAngle(1, False, BattleScreen) HasSwitchedInOpp = True @@ -7959,8 +7960,10 @@ Dim oppModel As String = BattleScreen.GetModelName(False) 'Switch BattleStyle + 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 + AddSwitch = True BattleScreen.BattleQuery.Add(New SwitchPokemonQueryObject(BattleScreen, BattleScreen.OppPokemon)) BattleScreen.Battle.ChangeCameraAngle(1, False, BattleScreen) End If @@ -8015,101 +8018,98 @@ BattleScreen.BattleQuery.Add(BallThrow) 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 + If AddSwitch = False Then + With BattleScreen + Dim p As Pokemon = .OppPokemon + Dim op As Pokemon = .OwnPokemon - With BattleScreen - Dim p As Pokemon = .OppPokemon - Dim op As Pokemon = .OwnPokemon + Dim spikeAffected As Boolean = True + Dim rockAffected As Boolean = True - Dim spikeAffected As Boolean = True - Dim rockAffected As Boolean = True + spikeAffected = BattleScreen.FieldEffects.IsGrounded(False, BattleScreen) - spikeAffected = BattleScreen.FieldEffects.IsGrounded(False, BattleScreen) - - If spikeAffected = True Then - If .FieldEffects.OwnSpikes > 0 And p.Ability.Name.ToLower() <> "magic guard" Then - Dim spikeDamage As Double = 1D - Select Case .FieldEffects.OwnSpikes - Case 1 - spikeDamage = (p.MaxHP / 100) * 12.5D - Case 2 - spikeDamage = (p.MaxHP / 100) * 16.7D - Case 3 - spikeDamage = (p.MaxHP / 100) * 25D - 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 + If spikeAffected = True Then + If .FieldEffects.OwnSpikes > 0 And p.Ability.Name.ToLower() <> "magic guard" Then + Dim spikeDamage As Double = 1D + Select Case .FieldEffects.OwnSpikes + Case 1 + spikeDamage = (p.MaxHP / 100) * 12.5D + Case 2 + spikeDamage = (p.MaxHP / 100) * 16.7D + Case 3 + spikeDamage = (p.MaxHP / 100) * 25D + End Select + ReduceHP(CInt(spikeDamage), False, True, BattleScreen, "The Spikes hurt " & p.GetDisplayName() & "!", "spikes") End If End If - End If - - If rockAffected = True Then - If .FieldEffects.OwnStealthRock > 0 And p.Ability.Name.ToLower() <> "magic guard" Then - Dim rocksDamage As Double = 1D - - 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") + '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 - 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") + 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 - If Core.Player.BattleStyle = 1 OrElse BattleScreen.IsPVPBattle = True Then - BattleScreen.HasSwitchedOwn = False - StartRound(BattleScreen) - End If - End With + If rockAffected = True Then + If .FieldEffects.OwnStealthRock > 0 And p.Ability.Name.ToLower() <> "magic guard" Then + Dim rocksDamage As Double = 1D + + 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 Region