Added CopyMove property for GM Moves

This commit is contained in:
JappaWakka 2023-12-15 18:21:24 +01:00
parent 0dad856a14
commit b40dde8904
3 changed files with 178 additions and 9 deletions

Binary file not shown.

View File

@ -184,6 +184,7 @@
Public GameModeBasePower As String = "" 'A GameMode can specify a base power calculation for a move.
Public IsGameModeMove As Boolean = False
Public gmDeductPP As Boolean = True
Public gmCopyMove As Integer = -1
Private _power As Integer = 40
Private _accuracy As Integer = 100
@ -1906,9 +1907,14 @@
End Function
Public Function GetEffectChance(ByVal i As Integer, ByVal own As Boolean, ByVal BattleScreen As BattleScreen) As Integer
Dim chance As Integer = Me.EffectChances(i)
Dim _attack As Attack = Me
If gmCopyMove <> -1 Then
_attack = GameModeAttackLoader.GetAttackByID(gmCopyMove)
End If
If Me.HasSecondaryEffect = True Then
Dim chance As Integer = _attack.EffectChances(i)
If _attack.HasSecondaryEffect = True Then
Dim p As Pokemon = BattleScreen.OwnPokemon
If own = False Then
p = BattleScreen.OppPokemon
@ -1938,6 +1944,9 @@
''' <param name="Own">If the own Pokémon used the move.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub PreAttack(ByVal Own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).PreAttack(Own, BattleScreen)
End If
'DO NOTHING HERE
End Sub
@ -1947,6 +1956,9 @@
''' <param name="Own">If the own Pokémon used the move.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Function MoveFailBeforeAttack(ByVal Own As Boolean, ByVal BattleScreen As BattleScreen) As Boolean
If gmCopyMove <> -1 Then
Return GameModeAttackLoader.GetAttackByID(gmCopyMove).MoveFailBeforeAttack(Own, BattleScreen)
End If
'DO NOTHING HERE
Return False
End Function
@ -1960,7 +1972,16 @@
If Me.IsGameModeMove = False Then
Return Me.Power
Else
Return AttackSpecialBasePower.GetGameModeBasePower(Me, own, BattleScreen)
If gmCopyMove <> -1 Then
Dim _attack As Attack = GameModeAttackLoader.GetAttackByID(gmCopyMove)
If _attack.IsGameModeMove = False Then
Return _attack.GetBasePower(own, BattleScreen)
Else
Return AttackSpecialBasePower.GetGameModeBasePower(_attack, own, BattleScreen)
End If
Else
Return AttackSpecialBasePower.GetGameModeBasePower(Me, own, BattleScreen)
End If
End If
End Function
@ -1970,7 +1991,12 @@
''' <param name="Own">If the own Pokémon used the move.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Function GetDamage(ByVal Critical As Boolean, ByVal Own As Boolean, ByVal targetPokemon As Boolean, ByVal BattleScreen As BattleScreen, Optional ByVal ExtraParameter As String = "") As Integer
Return BattleCalculation.CalculateDamage(Me, Critical, Own, targetPokemon, BattleScreen, ExtraParameter)
If gmCopyMove <> -1 Then
Dim _attack As Attack = GameModeAttackLoader.GetAttackByID(gmCopyMove)
Return BattleCalculation.CalculateDamage(_attack, Critical, Own, targetPokemon, BattleScreen, ExtraParameter)
Else
Return BattleCalculation.CalculateDamage(Me, Critical, Own, targetPokemon, BattleScreen, ExtraParameter)
End If
End Function
''' <summary>
@ -1982,10 +2008,23 @@
If Me.IsGameModeMove = False Then
Return Me.TimesToAttack
Else
If gmTimesToAttack.Contains("-") Then
Return Core.Random.Next(CInt(gmTimesToAttack.GetSplit(0, "-")), CInt(gmTimesToAttack.GetSplit(1, "-")) + 1)
If gmCopyMove <> -1 Then
Dim _attack As Attack = GameModeAttackLoader.GetAttackByID(gmCopyMove)
If _attack.IsGameModeMove = False Then
Return _attack.GetTimesToAttack(own, BattleScreen)
Else
If _attack.gmTimesToAttack.Contains("-") Then
Return Core.Random.Next(CInt(_attack.gmTimesToAttack.GetSplit(0, "-")), CInt(_attack.gmTimesToAttack.GetSplit(1, "-")) + 1)
Else
Return CInt(_attack.gmTimesToAttack)
End If
End If
Else
Return CInt(gmTimesToAttack)
If gmTimesToAttack.Contains("-") Then
Return Core.Random.Next(CInt(gmTimesToAttack.GetSplit(0, "-")), CInt(gmTimesToAttack.GetSplit(1, "-")) + 1)
Else
Return CInt(gmTimesToAttack)
End If
End If
End If
End Function
@ -1997,21 +2036,39 @@
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub MoveHits(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If Me.IsGameModeMove = True Then
AttackSpecialFunctions.ExecuteMoveHitsFunction(Me, own, BattleScreen)
If gmCopyMove <> -1 Then
Dim _attack As Attack = GameModeAttackLoader.GetAttackByID(gmCopyMove)
If _attack.IsGameModeMove = False Then
_attack.MoveHits(own, BattleScreen)
Else
AttackSpecialFunctions.ExecuteMoveHitsFunction(_attack, own, BattleScreen)
End If
Else
AttackSpecialFunctions.ExecuteMoveHitsFunction(Me, own, BattleScreen)
End If
Else
'DO NOTHING HERE (will do secondary effect if moves overrides it)
End If
End Sub
Public Overridable Sub MoveRecoil(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).MoveRecoil(own, BattleScreen)
End If
'DO NOTHING HERE (will do recoil if moves overrides it)
End Sub
Public Overridable Sub MoveRecharge(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).MoveRecharge(own, BattleScreen)
End If
'DO NOTHING HERE (will do a one turn recharge if moves overrides it)
End Sub
Public Overridable Sub MoveMultiTurn(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).MoveMultiTurn(own, BattleScreen)
End If
'DO NOTHING HERE (will do the multi turn countdown if moves overrides it)
End Sub
@ -2025,6 +2082,9 @@
''' <param name="Own">If the own Pokémon used the move.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub MoveMisses(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).MoveMisses(own, BattleScreen)
End If
'DO NOTHING HERE
End Sub
@ -2034,6 +2094,9 @@
''' <param name="Own">If the own Pokémon used the move.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub MoveProtectedDetected(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).MoveProtectedDetected(own, BattleScreen)
End If
'DO NOTHING HERE
End Sub
@ -2043,6 +2106,9 @@
''' <param name="Own">If the own Pokémon used the move.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub MoveHasNoEffect(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).MoveHasNoEffect(own, BattleScreen)
End If
'DO NOTHING HERE
End Sub
@ -2092,7 +2158,16 @@
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Function DeductPP(ByVal own As Boolean, ByVal BattleScreen As BattleScreen) As Boolean
If Me.IsGameModeMove = True Then
Return gmDeductPP
If gmCopyMove <> -1 Then
Dim _attack As Attack = GameModeAttackLoader.GetAttackByID(gmCopyMove)
If _attack.IsGameModeMove = False Then
Return _attack.DeductPP(own, BattleScreen)
Else
Return _attack.gmDeductPP
End If
Else
Return gmDeductPP
End If
Else
Return True
End If
@ -2113,6 +2188,10 @@
''' <param name="Own">If the own Pokémon used the move.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub MoveSelected(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).MoveSelected(own, BattleScreen)
End If
'DO NOTHING
End Sub
@ -2122,6 +2201,9 @@
''' <param name="Own">If the own Pokémon used the move.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub BeforeDealingDamage(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).BeforeDealingDamage(own, BattleScreen)
End If
'DO NOTHING
End Sub
@ -2131,6 +2213,9 @@
''' <param name="Own">If the own Pokémon used the move.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub AbsorbedBySubstitute(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).AbsorbedBySubstitute(own, BattleScreen)
End If
'DO NOTHING
End Sub
@ -2140,6 +2225,9 @@
''' <param name="Own">If the own Pokémon used the move.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub MoveFailsSoundproof(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).MoveFailsSoundproof(own, BattleScreen)
End If
'DO NOTHING
End Sub
@ -2149,6 +2237,9 @@
''' <param name="Own">If the own Pokémon used the move.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub InflictedFlinch(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).InflictedFlinch(own, BattleScreen)
End If
'DO NOTHING
End Sub
@ -2158,6 +2249,9 @@
''' <param name="Own">If the own Pokémon is confused.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub HurtItselfInConfusion(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).HurtItselfInConfusion(own, BattleScreen)
End If
'DO NOTHING
End Sub
@ -2167,6 +2261,9 @@
''' <param name="Own">If the own Pokémon is in love.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub IsAttracted(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).IsAttracted(own, BattleScreen)
End If
'DO NOTHING
End Sub
@ -2176,6 +2273,9 @@
''' <param name="Own">If the own Pokémon used the move.</param>
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
Public Overridable Sub IsSleeping(ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
If gmCopyMove <> -1 Then
GameModeAttackLoader.GetAttackByID(gmCopyMove).IsSleeping(own, BattleScreen)
End If
'DO NOTHING
End Sub

View File

@ -57,6 +57,75 @@
value = l.Remove(0, l.IndexOf("|") + 1)
Select Case key.ToLower()
Case "copymove"
If nonCommentLines = 1 Then
move.gmCopyMove = CInt(value)
Dim _attack As Attack = GameModeAttackLoader.GetAttackByID(move.gmCopyMove)
move.Power = _attack.Power
move.Accuracy = _attack.Accuracy
move.Name = _attack.Name
move.OriginalPP = _attack.OriginalPP
move.CurrentPP = _attack.CurrentPP
move.MaxPP = _attack.MaxPP
move.Category = _attack.Category
move.ContestCategory = _attack.ContestCategory
move.Description = _attack.Description
move.CriticalChance = _attack.CriticalChance
move.IsHMMove = _attack.IsHMMove
move.Target = _attack.Target
move.Priority = _attack.Priority
move.TimesToAttack = _attack.TimesToAttack
move.EffectChances = _attack.EffectChances
move.MakesContact = _attack.MakesContact
move.HasSecondaryEffect = _attack.HasSecondaryEffect
move.IsHealingMove = _attack.IsHealingMove
move.IsDamagingMove = _attack.IsDamagingMove
move.IsProtectMove = _attack.IsProtectMove
move.IsOneHitKOMove = _attack.IsOneHitKOMove
move.IsRecoilMove = _attack.IsRecoilMove
move.IsTrappingMove = _attack.IsTrappingMove
move.RemovesOwnFrozen = _attack.RemovesOwnFrozen
move.RemovesOppFrozen = _attack.RemovesOppFrozen
move.SwapsOutOwnPokemon = _attack.SwapsOutOwnPokemon
move.SwapsOutOppPokemon = _attack.SwapsOutOppPokemon
move.ProtectAffected = _attack.ProtectAffected
move.MagicCoatAffected = _attack.MagicCoatAffected
move.SnatchAffected = _attack.SnatchAffected
move.MirrorMoveAffected = _attack.MirrorMoveAffected
move.KingsrockAffected = _attack.KingsrockAffected
move.CounterAffected = _attack.CounterAffected
move.IsAffectedBySubstitute = _attack.IsAffectedBySubstitute
move.ImmunityAffected = _attack.ImmunityAffected
move.IsWonderGuardAffected = _attack.IsWonderGuardAffected
move.DisabledWhileGravity = _attack.DisabledWhileGravity
move.UseEffectiveness = _attack.UseEffectiveness
move.UseAccEvasion = _attack.UseAccEvasion
move.CanHitInMidAir = _attack.CanHitInMidAir
move.CanHitUnderground = _attack.CanHitUnderground
move.CanHitUnderwater = _attack.CanHitUnderwater
move.CanHitSleeping = _attack.CanHitSleeping
move.CanGainSTAB = _attack.CanGainSTAB
move.UseOppDefense = _attack.UseOppDefense
move.UseOppEvasion = _attack.UseOppEvasion
move.IsPulseMove = _attack.IsPulseMove
move.IsBulletMove = _attack.IsBulletMove
move.IsJawMove = _attack.IsJawMove
move.IsDanceMove = _attack.IsDanceMove
move.IsExplosiveMove = _attack.IsExplosiveMove
move.IsPowderMove = _attack.IsPowderMove
move.IsPunchingMove = _attack.IsPunchingMove
move.IsSlicingMove = _attack.IsSlicingMove
move.IsSoundMove = _attack.IsSoundMove
move.IsWindMove = _attack.IsWindMove
move.FocusOppPokemon = _attack.FocusOppPokemon
move.Disabled = _attack.Disabled
move.AIField1 = _attack.AIField1
move.AIField2 = _attack.AIField2
move.AIField3 = _attack.AIField3
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeAttackLoader.vb: The CopyMove property should be the first property set in the move definition file. It is currently property number " & nonCommentLines.ToString & ".")
End If
Case "id"
move.ID = CInt(value)
move.OriginalID = CInt(value)