Pokémon no longer choose taunted status moves

but instead pick another move. if there are no usable moves left, the pokémon uses struggle
This commit is contained in:
JappaWakka 2023-03-09 20:00:20 +01:00
parent 66046800d3
commit 2987cbb177
2 changed files with 39 additions and 18 deletions

View File

@ -428,7 +428,7 @@
Dim OppAttackChoice As Integer = Core.Random.Next(0, AvailableAttacks.Count)
Dim Ready As Boolean = False
While Ready = False
If BattleScreen.OppPokemon.Attacks(OppAttackChoice).Disabled > 0 Then
If BattleScreen.OppPokemon.Attacks(OppAttackChoice).Disabled > 0 OrElse BattleScreen.FieldEffects.OppTaunt > 0 AndAlso BattleScreen.OppPokemon.Attacks(OppAttackChoice).Category = Attack.Categories.Status Then
AvailableAttacks.Remove(OppAttackChoice)
If AvailableAttacks.Count > 0 Then
OppAttackChoice = AvailableAttacks(Core.Random.Next(0, AvailableAttacks.Count))

View File

@ -115,7 +115,7 @@ Namespace BattleSystem
Dim OppAttackChoice As Integer = Core.Random.Next(0, AvailableAttacks.Count)
Dim Ready As Boolean = False
While Ready = False
If m(OppAttackChoice).Disabled > 0 Then
If m(OppAttackChoice).Disabled > 0 OrElse BattleScreen.FieldEffects.OppTaunt > 0 AndAlso BattleScreen.OppPokemon.Attacks(OppAttackChoice).Category = Attack.Categories.Status Then
AvailableAttacks.Remove(OppAttackChoice)
If AvailableAttacks.Count > 0 Then
OppAttackChoice = AvailableAttacks(Core.Random.Next(0, AvailableAttacks.Count))
@ -368,13 +368,17 @@ Namespace BattleSystem
'If own pokemon is asleep, try to use Sleep Talk (100%)
If p.Status = Pokemon.StatusProblems.Sleep And BattleScreen.FieldEffects.OppSleepTurns > 1 And HasMove(m, 214) = True AndAlso m(IDtoMoveIndex(m, 214)).Disabled = 0 Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 214)).Category <> Attack.Categories.Status Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 214))
End If
End If
'If own pokemon is asleep, try to use Snore (100%)
If p.Status = Pokemon.StatusProblems.Sleep And BattleScreen.FieldEffects.OppSleepTurns > 1 And HasMove(m, 173) = True AndAlso m(IDtoMoveIndex(m, 173)).Disabled = 0 Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 173)).Category <> Attack.Categories.Status Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 173))
End If
End If
'If own pokemon is frozen and has a move to thraw out -> use that move
If p.Status = Pokemon.StatusProblems.Freeze Then
@ -539,21 +543,25 @@ Namespace BattleSystem
If op.IsType(Element.Types.Grass) = False Then
If BattleScreen.FieldEffects.OwnLeechSeed = 0 Then
If HasMove(m, 73) = True AndAlso m(IDtoMoveIndex(m, 73)).Disabled = 0 Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 75)).Category <> Attack.Categories.Status Then
If RPercent(75) = True Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 73))
End If
End If
End If
End If
End If
'try to use FocusEnergy (50%)
If BattleScreen.FieldEffects.OppFocusEnergy = 0 Then
If HasMove(m, 116) = True AndAlso m(IDtoMoveIndex(m, 116)).Disabled = 0 Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 116)).Category <> Attack.Categories.Status Then
If RPercent(50) = True Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 116))
End If
End If
End If
End If
'higher sp atk than atk, not boosted stat, higher spatk than spdef: use sp atk boost (50%)
If p.SpAttack > p.Attack And p.StatSpAttack <= 0 And p.SpAttack > p.SpDefense Then
@ -643,32 +651,42 @@ Namespace BattleSystem
'Use LightScreen/Reflect (75%):
If RPercent(75) = True Then
If HasMove(m, 113) = True And op.SpAttack > op.Attack And BattleScreen.FieldEffects.OppLightScreen = 0 AndAlso m(IDtoMoveIndex(m, 113)).Disabled = 0 Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 113)).Category <> Attack.Categories.Status Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 113))
End If
End If
If HasMove(m, 115) = True And op.Attack > op.SpAttack And BattleScreen.FieldEffects.OppReflect = 0 AndAlso m(IDtoMoveIndex(m, 115)).Disabled = 0 Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 115)).Category <> Attack.Categories.Status Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 115))
End If
End If
End If
'Special Moveset combos:
' - Defense Curl + Rollout
If HasMove(m, 205) = True And HasMove(m, 111) = True Then
If BattleScreen.FieldEffects.OppDefenseCurl = 0 AndAlso m(IDtoMoveIndex(m, 111)).Disabled = 0 Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 111)).Category <> Attack.Categories.Status Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 111))
End If
Else
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 205)).Category <> Attack.Categories.Status Then
If m(IDtoMoveIndex(m, 205)).Disabled = 0 Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 205))
End If
End If
End If
End If
'Determine best attacking move:
Dim attackDic As New Dictionary(Of Integer, Integer)
For i = 0 To m.Count - 1
If MoveHasAIField(m(i), Attack.AIField.Damage) = True AndAlso m(i).Disabled = 0 Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 214)).Category <> Attack.Categories.Status Then
attackDic.Add(i, 0)
End If
End If
Next
'If has more than 0 attacking moves:
If attackDic.Count > 0 Then
@ -857,12 +875,15 @@ Namespace BattleSystem
Private Shared Function MoveAI(ByVal m As List(Of Attack), ByVal AIType As Attack.AIField) As Integer
Dim validMoves As New List(Of Integer)
Dim battleScreen As BattleScreen = CType(CurrentScreen, BattleScreen)
For i = 0 To m.Count - 1
If m(i).Disabled = 0 Then
If battleScreen.FieldEffects.OppTaunt = 0 OrElse m(i).Category <> Attack.Categories.Status Then
If m(i).AIField1 = AIType Or m(i).AIField2 = AIType Or m(i).AIField3 = AIType Then
validMoves.Add(i)
End If
End If
End If
Next
If validMoves.Count > 0 Then