Implement metronome-like effect for GM moves

This commit is contained in:
JappaWakka 2025-01-31 14:27:17 +01:00
parent e9a8a89856
commit 98ee3d48eb
4 changed files with 63 additions and 34 deletions

View File

@ -473,39 +473,46 @@
Private Function GetAttack(ByVal BattleScreen As BattleScreen, ByVal own As Boolean, ByVal move As Attack) As RoundConst Private Function GetAttack(ByVal BattleScreen As BattleScreen, ByVal own As Boolean, ByVal move As Attack) As RoundConst
'TODO: Reset rage counters 'TODO: Reset rage counters
Select Case move.Name.ToLower() If move.IsGameModeMove = True AndAlso move.gmUseRandomMove = True Then
Case "metronome" If move.CurrentPP > 0 Then
If move.CurrentPP > 0 Then move.CurrentPP -= 1
move.CurrentPP -= 1 End If
End If Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = move.GetRandomAttack()}
Else
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = Moves.Normal.Metronome.GetMetronomeMove()} Select Case move.Name.ToLower()
Case "mirror move" Case "metronome"
If move.CurrentPP > 0 Then If move.CurrentPP > 0 Then
move.CurrentPP -= 1 move.CurrentPP -= 1
End If
Dim id As Integer = -1
If own = True Then
If Not BattleScreen.FieldEffects.OppLastMove Is Nothing AndAlso BattleScreen.FieldEffects.OppLastMove.MirrorMoveAffected = True Then
id = BattleScreen.FieldEffects.OppLastMove.ID
End If End If
Else
If Not BattleScreen.FieldEffects.OwnLastMove Is Nothing AndAlso BattleScreen.FieldEffects.OwnLastMove.MirrorMoveAffected = True Then
id = BattleScreen.FieldEffects.OwnLastMove.ID
End If
End If
If id <> -1 Then Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = Moves.Normal.Metronome.GetMetronomeMove()}
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = Attack.GetAttackByID(id)} Case "mirror move"
Else If move.CurrentPP > 0 Then
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Text, .Argument = "Mirror Move failed!"} move.CurrentPP -= 1
End If End If
Case "struggle"
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = move} Dim id As Integer = -1
Case Else If own = True Then
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = move} If Not BattleScreen.FieldEffects.OppLastMove Is Nothing AndAlso BattleScreen.FieldEffects.OppLastMove.MirrorMoveAffected = True Then
End Select id = BattleScreen.FieldEffects.OppLastMove.ID
End If
Else
If Not BattleScreen.FieldEffects.OwnLastMove Is Nothing AndAlso BattleScreen.FieldEffects.OwnLastMove.MirrorMoveAffected = True Then
id = BattleScreen.FieldEffects.OwnLastMove.ID
End If
End If
If id <> -1 Then
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = Attack.GetAttackByID(id)}
Else
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Text, .Argument = "Mirror Move failed!"}
End If
Case "struggle"
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = move}
Case Else
Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = move}
End Select
End If
End Function End Function
Public SelectedMoveOwn As Boolean = True Public SelectedMoveOwn As Boolean = True

View File

@ -201,11 +201,11 @@
Public TimesToAttack As Integer = 1 Public TimesToAttack As Integer = 1
Public gmTimesToAttack As String = "1" Public gmTimesToAttack As String = "1"
Public gmUseMoveAnims As Attack = Nothing Public gmUseMoveAnims As Attack = Nothing
Public gmUseRandomMove As Boolean = False
Public gmRandomMoveList As List(Of Integer)
Public EffectChances As New List(Of Integer) Public EffectChances As New List(Of Integer)
'#End '#End
'#SpecialDefinitions '#SpecialDefinitions
'Damage and effect types 'Damage and effect types
Public MakesContact As Boolean = True Public MakesContact As Boolean = True
@ -1906,6 +1906,11 @@
Return returnMove Return returnMove
End Function End Function
Public Function GetRandomAttack() As Attack
Dim moveID As Integer = gmRandomMoveList(Core.Random.Next(0, gmRandomMoveList.Count - 1))
Return Attack.GetAttackByID(moveID)
End Function
Public Function GetEffectChance(ByVal i As Integer, ByVal own As Boolean, ByVal BattleScreen As BattleScreen) As Integer Public Function GetEffectChance(ByVal i As Integer, ByVal own As Boolean, ByVal BattleScreen As BattleScreen) As Integer
Dim _attack As Attack = Me Dim _attack As Attack = Me
If gmCopyMove <> -1 Then If gmCopyMove <> -1 Then

View File

@ -395,6 +395,23 @@
End If End If
Case "usemoveanims" Case "usemoveanims"
move.gmUseMoveAnims = Attack.GetAttackByID(CInt(value)) move.gmUseMoveAnims = Attack.GetAttackByID(CInt(value))
Case "userandommove"
move.gmUseRandomMove = True
Dim movelist As New List(Of Integer)
If value <> "" Then
Dim stringList As List(Of String) = value.Split(";").ToList
For a = 0 To stringList.Count - 1
movelist.Add(CInt(stringList(a)))
Next
Else
Dim forbiddenIDs As List(Of Integer) = {68, 102, 118, 119, 144, 165, 166, 168, 173, 182, 194, 197, 203, 214, 243, 264, 266, 267, 270, 271, 274, 289, 343, 364, 382, 383, 415, 448, 476, 469, 495, 501, 511, 516, 546, 547, 548, 553, 554, 555, 557}.ToList()
For a = 1 To Attack.MOVE_COUNT + 1
If forbiddenIDs.Contains(a) = False Then
movelist.Add(a)
End If
Next
End If
move.gmRandomMoveList = moveList
End Select End Select
End If End If
Next Next

View File

@ -55,7 +55,7 @@
Public Shared Function GetMetronomeMove() As Attack Public Shared Function GetMetronomeMove() As Attack
Dim moveID As Integer = Core.Random.Next(1, MOVE_COUNT + 1) Dim moveID As Integer = Core.Random.Next(1, MOVE_COUNT + 1)
Dim forbiddenIDs As List(Of Integer) = {68, 102, 119, 144, 165, 166, 168, 173, 182, 194, 197, 203, 214, 243, 264, 266, 267, 270, 271, 274, 289, 343, 364, 382, 383, 415, 448, 476, 469, 495, 501, 511, 516, 546, 547, 548, 553, 554, 555, 557}.ToList() Dim forbiddenIDs As List(Of Integer) = {68, 102, 118, 119, 144, 165, 166, 168, 173, 182, 194, 197, 203, 214, 243, 264, 266, 267, 270, 271, 274, 289, 343, 364, 382, 383, 415, 448, 476, 469, 495, 501, 511, 516, 546, 547, 548, 553, 554, 555, 557}.ToList()
While forbiddenIDs.Contains(moveID) = True While forbiddenIDs.Contains(moveID) = True
moveID = Core.Random.Next(1, MOVE_COUNT + 1) moveID = Core.Random.Next(1, MOVE_COUNT + 1)