mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-30 17:25:22 +02:00
Implement Encore correctly
This commit is contained in:
parent
df17680e97
commit
7aa38cd921
@ -426,6 +426,21 @@
|
|||||||
AvailableAttacks.Add(i)
|
AvailableAttacks.Add(i)
|
||||||
Next
|
Next
|
||||||
Dim OppAttackChoice As Integer = Core.Random.Next(0, AvailableAttacks.Count)
|
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
|
Dim Ready As Boolean = False
|
||||||
While Ready = 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
|
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
|
' - use never-miss attack when own accuracy is low/opp evasion is high
|
||||||
|
|
||||||
'-------------------------------------AI BEGIN------------------------------------------------------------------------------------'
|
'-------------------------------------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---------------------------------------------------------'
|
'-------------------------------------Random move depending on difficulty---------------------------------------------------------'
|
||||||
|
|
||||||
|
@ -67,19 +67,17 @@
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If Not lastMove Is Nothing Then
|
If Not lastMove Is Nothing Then
|
||||||
If lastMove.CurrentPP > 0 Then
|
If own = True Then
|
||||||
Dim deductPP As Integer = 3
|
BattleScreen.FieldEffects.OppEncoreMove = lastMove
|
||||||
|
|
||||||
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!"))
|
|
||||||
Else
|
Else
|
||||||
BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!"))
|
BattleScreen.FieldEffects.OwnEncoreMove = lastMove
|
||||||
End If
|
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
|
Else
|
||||||
BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!"))
|
BattleScreen.BattleQuery.Add(New TextQueryObject(Me.Name & " failed!"))
|
||||||
End If
|
End If
|
||||||
|
Loading…
x
Reference in New Issue
Block a user