Implemented Torment move

This commit is contained in:
JappaWakka 2023-03-27 17:59:57 +02:00
parent ae5a26f8e3
commit f90152c506
3 changed files with 35 additions and 14 deletions

View File

@ -428,7 +428,7 @@
Dim OppAttackChoice As Integer = Core.Random.Next(0, AvailableAttacks.Count) Dim OppAttackChoice As Integer = Core.Random.Next(0, AvailableAttacks.Count)
Dim Ready As Boolean = False Dim Ready As Boolean = False
While Ready = False While Ready = False
If BattleScreen.OppPokemon.Attacks(OppAttackChoice).Disabled > 0 OrElse BattleScreen.FieldEffects.OppTaunt > 0 AndAlso BattleScreen.OppPokemon.Attacks(OppAttackChoice).Category = Attack.Categories.Status Or BattleScreen.OppPokemon.Attacks(OppAttackChoice).CurrentPP <= 0 Then If BattleScreen.OppPokemon.Attacks(OppAttackChoice) Is BattleScreen.FieldEffects.OppTormentMove OrElse BattleScreen.OppPokemon.Attacks(OppAttackChoice).Disabled > 0 OrElse BattleScreen.FieldEffects.OppTaunt > 0 AndAlso BattleScreen.OppPokemon.Attacks(OppAttackChoice).Category = Attack.Categories.Status Or BattleScreen.OppPokemon.Attacks(OppAttackChoice).CurrentPP <= 0 Then
AvailableAttacks.Remove(OppAttackChoice) AvailableAttacks.Remove(OppAttackChoice)
If AvailableAttacks.Count > 0 Then If AvailableAttacks.Count > 0 Then
OppAttackChoice = AvailableAttacks(Core.Random.Next(0, AvailableAttacks.Count)) OppAttackChoice = AvailableAttacks(Core.Random.Next(0, AvailableAttacks.Count))
@ -1606,6 +1606,24 @@
BattleScreen.FieldEffects.OppLastMove = moveUsed BattleScreen.FieldEffects.OppLastMove = moveUsed
End If End If
If own = True Then
If BattleScreen.FieldEffects.OwnTorment > 0 Then
If moveUsed Is BattleScreen.FieldEffects.OwnTormentMove Then
BattleScreen.BattleQuery.Add(New TextQueryObject(moveUsed.Name & " failed!"))
Exit Sub
End If
BattleScreen.FieldEffects.OwnTormentMove = BattleScreen.FieldEffects.OwnLastMove
End If
Else
If BattleScreen.FieldEffects.OppTorment > 0 Then
If moveUsed Is BattleScreen.FieldEffects.OppTormentMove Then
BattleScreen.BattleQuery.Add(New TextQueryObject(moveUsed.Name & " failed!"))
Exit Sub
End If
BattleScreen.FieldEffects.OppTormentMove = BattleScreen.FieldEffects.OppLastMove
End If
End If
If own = True Then If own = True Then
Dim ObedienceCheck As Integer = BattleCalculation.ObedienceCheck(moveUsed, BattleScreen) Dim ObedienceCheck As Integer = BattleCalculation.ObedienceCheck(moveUsed, BattleScreen)
If ObedienceCheck > 0 Then If ObedienceCheck > 0 Then
@ -5475,6 +5493,7 @@
End If End If
If .FieldEffects.OwnTorment > 0 Then If .FieldEffects.OwnTorment > 0 Then
.FieldEffects.OwnTorment = 0 .FieldEffects.OwnTorment = 0
.FieldEffects.OwnTormentMove = Nothing
.BattleQuery.Add(New TextQueryObject(.OwnPokemon.GetDisplayName() & " got healed from the Torment" & Environment.NewLine & "due to Mental Herb!")) .BattleQuery.Add(New TextQueryObject(.OwnPokemon.GetDisplayName() & " got healed from the Torment" & Environment.NewLine & "due to Mental Herb!"))
usedMentalHerb = True usedMentalHerb = True
End If End If

View File

@ -115,7 +115,7 @@ Namespace BattleSystem
Dim OppAttackChoice As Integer = Core.Random.Next(0, AvailableAttacks.Count) Dim OppAttackChoice As Integer = Core.Random.Next(0, AvailableAttacks.Count)
Dim Ready As Boolean = False Dim Ready As Boolean = False
While Ready = False While Ready = False
If m(OppAttackChoice).Disabled > 0 OrElse BattleScreen.FieldEffects.OppTaunt > 0 AndAlso BattleScreen.OppPokemon.Attacks(OppAttackChoice).Category = Attack.Categories.Status Then If m(OppAttackChoice) Is BattleScreen.FieldEffects.OppTormentMove OrElse m(OppAttackChoice).Disabled > 0 OrElse BattleScreen.FieldEffects.OppTaunt > 0 AndAlso BattleScreen.OppPokemon.Attacks(OppAttackChoice).Category = Attack.Categories.Status Then
AvailableAttacks.Remove(OppAttackChoice) AvailableAttacks.Remove(OppAttackChoice)
If AvailableAttacks.Count > 0 Then If AvailableAttacks.Count > 0 Then
OppAttackChoice = AvailableAttacks(Core.Random.Next(0, AvailableAttacks.Count)) OppAttackChoice = AvailableAttacks(Core.Random.Next(0, AvailableAttacks.Count))
@ -367,21 +367,21 @@ Namespace BattleSystem
'-------------------------------------Moves---------------------------------------------------------------------------------------' '-------------------------------------Moves---------------------------------------------------------------------------------------'
'If own pokemon is asleep, try to use Sleep Talk (100%) '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 p.Status = Pokemon.StatusProblems.Sleep And BattleScreen.FieldEffects.OppSleepTurns > 1 And HasMove(m, 214) = True AndAlso m(IDtoMoveIndex(m, 214)).Disabled = 0 AndAlso m(IDtoMoveIndex(m, 214)) IsNot BattleScreen.FieldEffects.OppTormentMove Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 214)).Category <> Attack.Categories.Status Then If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 214)).Category <> Attack.Categories.Status Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 214)) Return ProduceOppStep(m, IDtoMoveIndex(m, 214))
End If End If
End If End If
'If own pokemon is asleep, try to use Snore (100%) '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 p.Status = Pokemon.StatusProblems.Sleep And BattleScreen.FieldEffects.OppSleepTurns > 1 And HasMove(m, 173) = True AndAlso m(IDtoMoveIndex(m, 173)).Disabled = 0 AndAlso m(IDtoMoveIndex(m, 173)) IsNot BattleScreen.FieldEffects.OppTormentMove Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 173)).Category <> Attack.Categories.Status Then If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 173)).Category <> Attack.Categories.Status Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 173)) Return ProduceOppStep(m, IDtoMoveIndex(m, 173))
End If End If
End If End If
'If own pokemon is frozen and has a move to thraw out -> use that move 'If own pokemon is frozen and has a move to thraw out -> use that move
If p.Status = Pokemon.StatusProblems.Freeze Then If p.Status = Pokemon.StatusProblems.Freeze Then
Dim chosenMove As Integer = MoveAI(m, Attack.AIField.ThrawOut) Dim chosenMove As Integer = MoveAI(m, Attack.AIField.ThrawOut)
If chosenMove > -1 Then If chosenMove > -1 Then
Return ProduceOppStep(m, chosenMove) Return ProduceOppStep(m, chosenMove)
@ -389,7 +389,7 @@ Namespace BattleSystem
End If End If
'Fake Out if first turn -> try to inflict flinch (100%) 'Fake Out if first turn -> try to inflict flinch (100%)
If HasMove(m, 252) = True AndAlso m(IDtoMoveIndex(m, 252)).Disabled = 0 Then If HasMove(m, 252) = True AndAlso m(IDtoMoveIndex(m, 252)).Disabled = 0 AndAlso m(IDtoMoveIndex(m, 252)) IsNot BattleScreen.FieldEffects.OppTormentMove Then
If op.Ability.Name.ToLower() <> "inner focus" Then If op.Ability.Name.ToLower() <> "inner focus" Then
Dim turns As Integer = BattleScreen.FieldEffects.OppPokemonTurns Dim turns As Integer = BattleScreen.FieldEffects.OppPokemonTurns
If turns = 0 Then If turns = 0 Then
@ -542,7 +542,7 @@ Namespace BattleSystem
'try to set up leech seed (75%) 'try to set up leech seed (75%)
If op.IsType(Element.Types.Grass) = False Then If op.IsType(Element.Types.Grass) = False Then
If BattleScreen.FieldEffects.OwnLeechSeed = 0 Then If BattleScreen.FieldEffects.OwnLeechSeed = 0 Then
If HasMove(m, 73) = True AndAlso m(IDtoMoveIndex(m, 73)).Disabled = 0 Then If HasMove(m, 73) = True AndAlso m(IDtoMoveIndex(m, 73)).Disabled = 0 AndAlso m(IDtoMoveIndex(m, 73)) IsNot BattleScreen.FieldEffects.OppTormentMove Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 75)).Category <> Attack.Categories.Status Then If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 75)).Category <> Attack.Categories.Status Then
If RPercent(75) = True Then If RPercent(75) = True Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 73)) Return ProduceOppStep(m, IDtoMoveIndex(m, 73))
@ -554,7 +554,7 @@ Namespace BattleSystem
'try to use FocusEnergy (50%) 'try to use FocusEnergy (50%)
If BattleScreen.FieldEffects.OppFocusEnergy = 0 Then If BattleScreen.FieldEffects.OppFocusEnergy = 0 Then
If HasMove(m, 116) = True AndAlso m(IDtoMoveIndex(m, 116)).Disabled = 0 Then If HasMove(m, 116) = True AndAlso m(IDtoMoveIndex(m, 116)).Disabled = 0 AndAlso m(IDtoMoveIndex(m, 116)) IsNot BattleScreen.FieldEffects.OppTormentMove Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 116)).Category <> Attack.Categories.Status Then If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 116)).Category <> Attack.Categories.Status Then
If RPercent(50) = True Then If RPercent(50) = True Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 116)) Return ProduceOppStep(m, IDtoMoveIndex(m, 116))
@ -650,12 +650,12 @@ Namespace BattleSystem
'Use LightScreen/Reflect (75%): 'Use LightScreen/Reflect (75%):
If RPercent(75) = True Then 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 HasMove(m, 113) = True And op.SpAttack > op.Attack And BattleScreen.FieldEffects.OppLightScreen = 0 AndAlso m(IDtoMoveIndex(m, 113)).Disabled = 0 AndAlso m(IDtoMoveIndex(m, 113)) IsNot BattleScreen.FieldEffects.OppTormentMove Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 113)).Category <> Attack.Categories.Status Then If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 113)).Category <> Attack.Categories.Status Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 113)) Return ProduceOppStep(m, IDtoMoveIndex(m, 113))
End If End If
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 HasMove(m, 115) = True And op.Attack > op.SpAttack And BattleScreen.FieldEffects.OppReflect = 0 AndAlso m(IDtoMoveIndex(m, 115)).Disabled = 0 AndAlso m(IDtoMoveIndex(m, 115)) IsNot BattleScreen.FieldEffects.OppTormentMove Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 115)).Category <> Attack.Categories.Status Then If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 115)).Category <> Attack.Categories.Status Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 115)) Return ProduceOppStep(m, IDtoMoveIndex(m, 115))
End If End If
@ -665,7 +665,7 @@ Namespace BattleSystem
'Special Moveset combos: 'Special Moveset combos:
' - Defense Curl + Rollout ' - Defense Curl + Rollout
If HasMove(m, 205) = True And HasMove(m, 111) = True Then 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.OppDefenseCurl = 0 AndAlso m(IDtoMoveIndex(m, 111)).Disabled = 0 AndAlso m(IDtoMoveIndex(m, 111)) IsNot BattleScreen.FieldEffects.OppTormentMove Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 111)).Category <> Attack.Categories.Status Then If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 111)).Category <> Attack.Categories.Status Then
Return ProduceOppStep(m, IDtoMoveIndex(m, 111)) Return ProduceOppStep(m, IDtoMoveIndex(m, 111))
End If End If
@ -682,7 +682,7 @@ Namespace BattleSystem
Dim attackDic As New Dictionary(Of Integer, Integer) Dim attackDic As New Dictionary(Of Integer, Integer)
For i = 0 To m.Count - 1 For i = 0 To m.Count - 1
If MoveHasAIField(m(i), Attack.AIField.Damage) = True AndAlso m(i).Disabled = 0 Then If MoveHasAIField(m(i), Attack.AIField.Damage) = True AndAlso m(i).Disabled = 0 AndAlso m(i) IsNot BattleScreen.FieldEffects.OppTormentMove Then
If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 214)).Category <> Attack.Categories.Status Then If BattleScreen.FieldEffects.OppTaunt = 0 OrElse m(IDtoMoveIndex(m, 214)).Category <> Attack.Categories.Status Then
attackDic.Add(i, 0) attackDic.Add(i, 0)
End If End If
@ -880,7 +880,7 @@ Namespace BattleSystem
_battleScreen = _battleScreen.PreScreen _battleScreen = _battleScreen.PreScreen
End While End While
For i = 0 To m.Count - 1 For i = 0 To m.Count - 1
If m(i).Disabled = 0 Then If m(i).Disabled = 0 AndAlso m(i) IsNot CType(_battleScreen, BattleScreen).FieldEffects.OppTormentMove Then
If CType(_battleScreen, BattleScreen).FieldEffects.OppTaunt = 0 OrElse m(i).Category <> Attack.Categories.Status Then If CType(_battleScreen, 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 If m(i).AIField1 = AIType Or m(i).AIField2 = AIType Or m(i).AIField3 = AIType Then
validMoves.Add(i) validMoves.Add(i)

View File

@ -65,12 +65,14 @@
If own = True Then If own = True Then
If BattleScreen.OppPokemon.Ability.Name.ToLower() <> "aroma veil" Then If BattleScreen.OppPokemon.Ability.Name.ToLower() <> "aroma veil" Then
BattleScreen.FieldEffects.OppTorment = 1 BattleScreen.FieldEffects.OppTorment = 1
BattleScreen.BattleQuery.Add(New TextQueryObject(BattleScreen.OppPokemon.GetDisplayName() & " was subjected to " & Me.Name & "!"))
Else Else
BattleScreen.BattleQuery.Add(New TextQueryObject("Aroma Veil protected " & BattleScreen.OppPokemon.GetDisplayName() & " from " & Me.Name & "!")) BattleScreen.BattleQuery.Add(New TextQueryObject("Aroma Veil protected " & BattleScreen.OppPokemon.GetDisplayName() & " from " & Me.Name & "!"))
End If End If
Else Else
If BattleScreen.OwnPokemon.Ability.Name.ToLower() <> "aroma veil" Then If BattleScreen.OwnPokemon.Ability.Name.ToLower() <> "aroma veil" Then
BattleScreen.FieldEffects.OwnTorment = 1 BattleScreen.FieldEffects.OwnTorment = 1
BattleScreen.BattleQuery.Add(New TextQueryObject(BattleScreen.OwnPokemon.GetDisplayName() & " was subjected to " & Me.Name & "!"))
Else Else
BattleScreen.BattleQuery.Add(New TextQueryObject("Aroma Veil protected " & BattleScreen.OwnPokemon.GetDisplayName() & " from " & Me.Name & "!")) BattleScreen.BattleQuery.Add(New TextQueryObject("Aroma Veil protected " & BattleScreen.OwnPokemon.GetDisplayName() & " from " & Me.Name & "!"))
End If End If