Implement Encore correctly
This commit is contained in:
parent
df17680e97
commit
7aa38cd921
|
@ -426,6 +426,21 @@
|
|||
AvailableAttacks.Add(i)
|
||||
Next
|
||||
Dim OppAttackChoice As Integer = Core.Random.Next(0, AvailableAttacks.Count)
|
||||
If BattleScreen.FieldEffects.OppEncore > 0 Then
|
||||
Dim attackIndex As Integer = -1
|
||||
For a = 0 To BattleScreen.OppPokemon.Attacks.Count - 1
|
||||
If BattleScreen.OppPokemon.Attacks(a).ID = BattleScreen.FieldEffects.OppEncoreMove.ID Then
|
||||
attackIndex = a
|
||||
End If
|
||||
Next
|
||||
If attackIndex <> -1 AndAlso BattleScreen.OppPokemon.Attacks(attackIndex).CurrentPP > 0 Then
|
||||
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = BattleScreen.FieldEffects.OppEncoreMove}
|
||||
Else
|
||||
BattleScreen.FieldEffects.OppEncoreMove = Nothing
|
||||
BattleScreen.FieldEffects.OppEncore = 0
|
||||
BattleScreen.BattleQuery.Add(New TextQueryObject(BattleScreen.OppPokemon.GetDisplayName() & "'s encore stopped."))
|
||||
End If
|
||||
End If
|
||||
Dim Ready As Boolean = False
|
||||
While Ready = False
|
||||
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
|
||||
|
|
|
@ -103,6 +103,23 @@ Namespace BattleSystem
|
|||
' - use never-miss attack when own accuracy is low/opp evasion is high
|
||||
|
||||
'-------------------------------------AI BEGIN------------------------------------------------------------------------------------'
|
||||
'-------------------------------------Encore Move if an encore is in effect-------------------------------------------------------'
|
||||
|
||||
If BattleScreen.FieldEffects.OppEncore > 0 Then
|
||||
Dim attackIndex As Integer = -1
|
||||
For a = 0 To p.Attacks.Count - 1
|
||||
If p.Attacks(a).ID = BattleScreen.FieldEffects.OppEncoreMove.ID Then
|
||||
attackIndex = a
|
||||
End If
|
||||
Next
|
||||
If attackIndex <> -1 AndAlso p.Attacks(attackIndex).CurrentPP > 0 Then
|
||||
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = BattleScreen.FieldEffects.OppEncoreMove}
|
||||
Else
|
||||
BattleScreen.FieldEffects.OppEncoreMove = Nothing
|
||||
BattleScreen.FieldEffects.OppEncore = 0
|
||||
BattleScreen.BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & "'s encore stopped."))
|
||||
End If
|
||||
End If
|
||||
|
||||
'-------------------------------------Random move depending on difficulty---------------------------------------------------------'
|
||||
|
||||
|
|
|
@ -67,19 +67,17 @@
|
|||
End If
|
||||
|
||||
If Not lastMove Is Nothing Then
|
||||
If lastMove.CurrentPP > 0 Then
|
||||
Dim deductPP As Integer = 3
|
||||
|
||||
If lastMove.CurrentPP < 3 Then
|
||||
deductPP = lastMove.CurrentPP
|
||||
End If
|
||||
|
||||
lastMove.CurrentPP -= deductPP
|
||||
|
||||
BattleScreen.BattleQuery.Add(New TextQueryObject(op.GetDisplayName() & "'s " & lastMove.Name & " lost " & deductPP & " PP!"))
|
||||
If own = True Then
|
||||
BattleScreen.FieldEffects.OppEncoreMove = lastMove
|
||||
Else
|
||||
BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!"))
|
||||
BattleScreen.FieldEffects.OwnEncoreMove = lastMove
|
||||
End If
|
||||
If own = True Then
|
||||
BattleScreen.FieldEffects.OppEncore = 3
|
||||
Else
|
||||
BattleScreen.FieldEffects.OwnEncore = 3
|
||||
End If
|
||||
BattleScreen.BattleQuery.Add(New TextQueryObject(op.GetDisplayName & " received an encore!"))
|
||||
Else
|
||||
BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!"))
|
||||
End If
|
||||
|
|
Loading…
Reference in New Issue