diff --git a/P3D/Battle/BattleSystemV2/Battle.vb b/P3D/Battle/BattleSystemV2/Battle.vb index 0204d8193..a29d43930 100644 --- a/P3D/Battle/BattleSystemV2/Battle.vb +++ b/P3D/Battle/BattleSystemV2/Battle.vb @@ -473,39 +473,46 @@ Private Function GetAttack(ByVal BattleScreen As BattleScreen, ByVal own As Boolean, ByVal move As Attack) As RoundConst 'TODO: Reset rage counters - Select Case move.Name.ToLower() - Case "metronome" - If move.CurrentPP > 0 Then - move.CurrentPP -= 1 - End If - - Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = Moves.Normal.Metronome.GetMetronomeMove()} - Case "mirror move" - If move.CurrentPP > 0 Then - 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 + If move.IsGameModeMove = True AndAlso move.gmUseRandomMove = True Then + If move.CurrentPP > 0 Then + move.CurrentPP -= 1 + End If + Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = move.GetRandomAttack()} + Else + Select Case move.Name.ToLower() + Case "metronome" + If move.CurrentPP > 0 Then + move.CurrentPP -= 1 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 + Return New RoundConst() With {.StepType = RoundConst.StepTypes.Move, .Argument = Moves.Normal.Metronome.GetMetronomeMove()} + Case "mirror move" + If move.CurrentPP > 0 Then + 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 + 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 Public SelectedMoveOwn As Boolean = True diff --git a/P3D/Pokemon/Attacks/Attack.vb b/P3D/Pokemon/Attacks/Attack.vb index 92bb47d48..f1b9474ec 100644 --- a/P3D/Pokemon/Attacks/Attack.vb +++ b/P3D/Pokemon/Attacks/Attack.vb @@ -201,11 +201,11 @@ Public TimesToAttack As Integer = 1 Public gmTimesToAttack As String = "1" Public gmUseMoveAnims As Attack = Nothing + Public gmUseRandomMove As Boolean = False + Public gmRandomMoveList As List(Of Integer) Public EffectChances As New List(Of Integer) '#End - - '#SpecialDefinitions 'Damage and effect types Public MakesContact As Boolean = True @@ -1906,6 +1906,11 @@ Return returnMove 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 Dim _attack As Attack = Me If gmCopyMove <> -1 Then diff --git a/P3D/Pokemon/Attacks/GameModeAttackLoader.vb b/P3D/Pokemon/Attacks/GameModeAttackLoader.vb index 9e048259d..c640137be 100644 --- a/P3D/Pokemon/Attacks/GameModeAttackLoader.vb +++ b/P3D/Pokemon/Attacks/GameModeAttackLoader.vb @@ -395,6 +395,23 @@ End If Case "usemoveanims" 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 If Next diff --git a/P3D/Pokemon/Attacks/Normal/Metronome.vb b/P3D/Pokemon/Attacks/Normal/Metronome.vb index a7d9b0af6..f6437ffdf 100644 --- a/P3D/Pokemon/Attacks/Normal/Metronome.vb +++ b/P3D/Pokemon/Attacks/Normal/Metronome.vb @@ -55,7 +55,7 @@ Public Shared Function GetMetronomeMove() As Attack 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 moveID = Core.Random.Next(1, MOVE_COUNT + 1)