mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-29 08:45:02 +02:00
Temporarily comment out opponent switching
This commit is contained in:
parent
628528b018
commit
e5ee6cb145
@ -122,134 +122,134 @@
|
|||||||
'-------------------------------------Switching-----------------------------------------------------------------------------------'
|
'-------------------------------------Switching-----------------------------------------------------------------------------------'
|
||||||
|
|
||||||
'Only applies if trainer has an AI level above or equal 40:
|
'Only applies if trainer has an AI level above or equal 40:
|
||||||
If BattleScreen.Trainer.AILevel >= 40 Then
|
'If BattleScreen.Trainer.AILevel >= 40 Then
|
||||||
If BattleCalculation.CanSwitch(BattleScreen, False) = True Then
|
' If BattleCalculation.CanSwitch(BattleScreen, False) = True Then
|
||||||
If BattleScreen.Trainer.Pokemons.Count > 0 Then
|
' If BattleScreen.Trainer.Pokemons.Count > 0 Then
|
||||||
Dim living As Integer = 0
|
' Dim living As Integer = 0
|
||||||
For Each cP As Pokemon In BattleScreen.Trainer.Pokemons
|
' For Each cP As Pokemon In BattleScreen.Trainer.Pokemons
|
||||||
If cP.HP > 0 And cP.Status <> Pokemon.StatusProblems.Fainted Then
|
' If cP.HP > 0 And cP.Status <> Pokemon.StatusProblems.Fainted Then
|
||||||
living += 1
|
' living += 1
|
||||||
End If
|
' End If
|
||||||
Next
|
' Next
|
||||||
If living > 1 Then
|
' If living > 1 Then
|
||||||
'check for opponent moves: if super effective: 1.5x: 25%, 2x: 50%, 4x: 75%: check for pokemon in party that reacts to every move with less the detected effectiveness
|
' 'check for opponent moves: if super effective: 1.5x: 25%, 2x: 50%, 4x: 75%: check for pokemon in party that reacts to every move with less the detected effectiveness
|
||||||
Dim maxOpponentEff As Single = 0.0F
|
' Dim maxOpponentEff As Single = 0.0F
|
||||||
For Each Attack As BattleSystem.Attack In op.Attacks
|
' For Each Attack As BattleSystem.Attack In op.Attacks
|
||||||
Dim effectiveness As Single = BattleCalculation.CalculateEffectiveness(Attack.GetAttackByID(Attack.ID), BattleScreen, op, p, True)
|
' Dim effectiveness As Single = BattleCalculation.CalculateEffectiveness(Attack.GetAttackByID(Attack.ID), BattleScreen, op, p, True)
|
||||||
If effectiveness > maxOpponentEff Then
|
' If effectiveness > maxOpponentEff Then
|
||||||
maxOpponentEff = effectiveness
|
' maxOpponentEff = effectiveness
|
||||||
End If
|
' End If
|
||||||
Next
|
' Next
|
||||||
If maxOpponentEff > 1.0F Then
|
' If maxOpponentEff > 1.0F Then
|
||||||
Dim chance As Integer = 0
|
' Dim chance As Integer = 0
|
||||||
|
|
||||||
Select Case maxOpponentEff
|
' Select Case maxOpponentEff
|
||||||
Case 1.25F
|
' Case 1.25F
|
||||||
chance = 10
|
' chance = 10
|
||||||
Case 1.5F
|
' Case 1.5F
|
||||||
chance = 25
|
' chance = 25
|
||||||
Case 2.0F
|
' Case 2.0F
|
||||||
chance = 35
|
' chance = 35
|
||||||
Case 4.0F
|
' Case 4.0F
|
||||||
chance = 50
|
' chance = 50
|
||||||
End Select
|
' End Select
|
||||||
|
|
||||||
If RPercent(chance) = True Then
|
' If RPercent(chance) = True Then
|
||||||
Dim lessTeamPs As New List(Of Integer)
|
' Dim lessTeamPs As New List(Of Integer)
|
||||||
|
|
||||||
For i = 0 To BattleScreen.Trainer.Pokemons.Count - 1
|
' For i = 0 To BattleScreen.Trainer.Pokemons.Count - 1
|
||||||
If i <> BattleScreen.OppPokemonIndex Then
|
' If i <> BattleScreen.OppPokemonIndex Then
|
||||||
Dim TeamP As Pokemon = BattleScreen.Trainer.Pokemons(i)
|
' Dim TeamP As Pokemon = BattleScreen.Trainer.Pokemons(i)
|
||||||
If TeamP.HP > 0 And TeamP.Status <> Pokemon.StatusProblems.Fainted Then
|
' If TeamP.HP > 0 And TeamP.Status <> Pokemon.StatusProblems.Fainted Then
|
||||||
Dim alwaysLess As Boolean = True
|
' Dim alwaysLess As Boolean = True
|
||||||
For Each Attack As BattleSystem.Attack In op.Attacks
|
' For Each Attack As BattleSystem.Attack In op.Attacks
|
||||||
Dim effectiveness As Single = BattleCalculation.CalculateEffectiveness(Attack.GetAttackByID(Attack.ID), BattleScreen, op, TeamP, True)
|
' Dim effectiveness As Single = BattleCalculation.CalculateEffectiveness(Attack.GetAttackByID(Attack.ID), BattleScreen, op, TeamP, True)
|
||||||
|
|
||||||
If effectiveness >= maxOpponentEff Then
|
' If effectiveness >= maxOpponentEff Then
|
||||||
alwaysLess = False
|
' alwaysLess = False
|
||||||
Exit For
|
' Exit For
|
||||||
End If
|
' End If
|
||||||
Next
|
' Next
|
||||||
If alwaysLess = True Then
|
' If alwaysLess = True Then
|
||||||
lessTeamPs.Add(i)
|
' lessTeamPs.Add(i)
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
Next
|
' Next
|
||||||
|
|
||||||
If lessTeamPs.Count > 0 Then
|
' If lessTeamPs.Count > 0 Then
|
||||||
Return ProduceOppStep(lessTeamPs(Core.Random.Next(0, lessTeamPs.Count)))
|
' Return ProduceOppStep(lessTeamPs(Core.Random.Next(0, lessTeamPs.Count)))
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
'check for own moves: if only 0x: check for other pokemon in party (best fitting) and switch in
|
' 'check for own moves: if only 0x: check for other pokemon in party (best fitting) and switch in
|
||||||
Dim only0 As Boolean = True
|
' Dim only0 As Boolean = True
|
||||||
For Each Attack As BattleSystem.Attack In p.Attacks
|
' For Each Attack As BattleSystem.Attack In p.Attacks
|
||||||
Dim effectiveness As Single = BattleCalculation.CalculateEffectiveness(Attack.GetAttackByID(Attack.ID), BattleScreen, p, op, False)
|
' Dim effectiveness As Single = BattleCalculation.CalculateEffectiveness(Attack.GetAttackByID(Attack.ID), BattleScreen, p, op, False)
|
||||||
If effectiveness <> 0.0F Then
|
' If effectiveness <> 0.0F Then
|
||||||
only0 = False
|
' only0 = False
|
||||||
Exit For
|
' Exit For
|
||||||
End If
|
' End If
|
||||||
Next
|
' Next
|
||||||
If only0 = True Then
|
' If only0 = True Then
|
||||||
Dim switchList As New List(Of Integer)
|
' Dim switchList As New List(Of Integer)
|
||||||
For i = 0 To BattleScreen.Trainer.Pokemons.Count - 1
|
' For i = 0 To BattleScreen.Trainer.Pokemons.Count - 1
|
||||||
If i <> BattleScreen.OppPokemonIndex Then
|
' If i <> BattleScreen.OppPokemonIndex Then
|
||||||
Dim TeamP As Pokemon = BattleScreen.Trainer.Pokemons(i)
|
' Dim TeamP As Pokemon = BattleScreen.Trainer.Pokemons(i)
|
||||||
If TeamP.HP > 0 And TeamP.Status <> Pokemon.StatusProblems.Fainted Then
|
' If TeamP.HP > 0 And TeamP.Status <> Pokemon.StatusProblems.Fainted Then
|
||||||
switchList.Add(i)
|
' switchList.Add(i)
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
Next
|
' Next
|
||||||
If switchList.Count > 0 Then
|
' If switchList.Count > 0 Then
|
||||||
Return ProduceOppStep(switchList(Core.Random.Next(0, switchList.Count)))
|
' Return ProduceOppStep(switchList(Core.Random.Next(0, switchList.Count)))
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
'own pokemon got cursed: 75%
|
' 'own pokemon got cursed: 75%
|
||||||
If BattleScreen.FieldEffects.OppCurse > 0 Then
|
' If BattleScreen.FieldEffects.OppCurse > 0 Then
|
||||||
If RPercent(75) = True Then
|
' If RPercent(75) = True Then
|
||||||
Dim newSwitchIndex As Integer = 0
|
' Dim newSwitchIndex As Integer = 0
|
||||||
Dim canSwitchTo As New List(Of Integer)
|
' Dim canSwitchTo As New List(Of Integer)
|
||||||
For i = 0 To BattleScreen.Trainer.Pokemons.Count - 1
|
' For i = 0 To BattleScreen.Trainer.Pokemons.Count - 1
|
||||||
Dim TeamP As Pokemon = BattleScreen.Trainer.Pokemons(i)
|
' Dim TeamP As Pokemon = BattleScreen.Trainer.Pokemons(i)
|
||||||
If TeamP.HP > 0 And TeamP.Status <> Pokemon.StatusProblems.Fainted And i <> BattleScreen.OppPokemonIndex Then
|
' If TeamP.HP > 0 And TeamP.Status <> Pokemon.StatusProblems.Fainted And i <> BattleScreen.OppPokemonIndex Then
|
||||||
canSwitchTo.Add(i)
|
' canSwitchTo.Add(i)
|
||||||
End If
|
' End If
|
||||||
Next
|
' Next
|
||||||
|
|
||||||
If canSwitchTo.Count > 0 Then
|
' If canSwitchTo.Count > 0 Then
|
||||||
newSwitchIndex = canSwitchTo(Core.Random.Next(0, canSwitchTo.Count))
|
' newSwitchIndex = canSwitchTo(Core.Random.Next(0, canSwitchTo.Count))
|
||||||
|
|
||||||
Return ProduceOppStep(newSwitchIndex)
|
' Return ProduceOppStep(newSwitchIndex)
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
'own pokemon got confused: 50%
|
' 'own pokemon got confused: 50%
|
||||||
If p.HasVolatileStatus(Pokemon.VolatileStatus.Confusion) = True Then
|
' If p.HasVolatileStatus(Pokemon.VolatileStatus.Confusion) = True Then
|
||||||
If RPercent(50) = True Then
|
' If RPercent(50) = True Then
|
||||||
Dim newSwitchIndex As Integer = 0
|
' Dim newSwitchIndex As Integer = 0
|
||||||
Dim canSwitchTo As New List(Of Integer)
|
' Dim canSwitchTo As New List(Of Integer)
|
||||||
For i = 0 To BattleScreen.Trainer.Pokemons.Count - 1
|
' For i = 0 To BattleScreen.Trainer.Pokemons.Count - 1
|
||||||
Dim TeamP As Pokemon = BattleScreen.Trainer.Pokemons(i)
|
' Dim TeamP As Pokemon = BattleScreen.Trainer.Pokemons(i)
|
||||||
If TeamP.HP > 0 And TeamP.Status <> Pokemon.StatusProblems.Fainted And i <> BattleScreen.OppPokemonIndex Then
|
' If TeamP.HP > 0 And TeamP.Status <> Pokemon.StatusProblems.Fainted And i <> BattleScreen.OppPokemonIndex Then
|
||||||
canSwitchTo.Add(i)
|
' canSwitchTo.Add(i)
|
||||||
End If
|
' End If
|
||||||
Next
|
' Next
|
||||||
|
|
||||||
If canSwitchTo.Count > 0 Then
|
' If canSwitchTo.Count > 0 Then
|
||||||
newSwitchIndex = canSwitchTo(Core.Random.Next(0, canSwitchTo.Count))
|
' newSwitchIndex = canSwitchTo(Core.Random.Next(0, canSwitchTo.Count))
|
||||||
|
|
||||||
Return ProduceOppStep(newSwitchIndex)
|
' Return ProduceOppStep(newSwitchIndex)
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
'-------------------------------------Items---------------------------------------------------------------------------------------'
|
'-------------------------------------Items---------------------------------------------------------------------------------------'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user