Fixed some logic on ability changing situations. First implementation of Parental Bond. Fixed Solar Power effect upon round end.

This commit is contained in:
CaptainSegis 2018-03-12 01:58:10 -05:00
parent aa03355abf
commit 5e4d6e28ce
22 changed files with 125 additions and 41 deletions

View File

@ -1696,9 +1696,44 @@
Dim Hits As Integer = 0
Dim TimesToAttack As Integer = moveUsed.GetTimesToAttack(own, BattleScreen)
Dim useParentalBond As Boolean = False
If TimesToAttack = 1 AndAlso p.Ability IsNot Nothing AndAlso p.Ability.Name.ToLower = "parental bond" Then
Dim moveList As String() = {"endeavor",
"fling",
"explosion",
"selfdestruct",
"final gambit",
"bounce",
"dig",
"dive",
"fly",
"freeze shock",
"geomancy",
"ice burn",
"phantom force",
"razor wind",
"shadow force",
"skull bash",
"sky attack",
"sky drop",
"solar beam",
"solar blade"
}
If Not moveList.Contains(moveUsed.Name.ToLower) Then
useParentalBond = True
TimesToAttack += 1
End If
End If
For i = 1 To TimesToAttack
Dim Critical As Boolean = BattleCalculation.IsCriticalHit(moveUsed, own, BattleScreen)
Dim Damage As Integer = moveUsed.GetDamage(Critical, own, Not own, BattleScreen)
Dim Damage As Integer = 0
If useParentalBond AndAlso i = TimesToAttack Then
Damage = moveUsed.GetDamage(Critical, own, Not own, BattleScreen, "parental bond")
Else
Damage = moveUsed.GetDamage(Critical, own, Not own, BattleScreen)
End If
If effectiveness <> 0 Then
Dim sturdyWorked As Boolean = False
@ -1861,6 +1896,8 @@
If effectiveness <> 0 Then
Dim canUseEffect As Boolean = True
Dim canUseRecharge As Boolean = True
If op.Ability.Name.ToLower() = "shield dust" AndAlso moveUsed.HasSecondaryEffect = True Then
If BattleScreen.FieldEffects.CanUseAbility(Not own, BattleScreen) = True Then
canUseEffect = False
@ -1870,6 +1907,39 @@
canUseEffect = False
End If
'Moves that only use secondary effects on the second turn of parental bond
If p.Ability IsNot Nothing AndAlso p.Ability.Name.ToLower = "parental bond" AndAlso i <> TimesToAttack Then
Dim PBmoveList As String() = {"secret power",
"struggle",
"circle throw",
"dragon tail",
"bug bite",
"pluck",
"u-turn",
"volt switch",
"smelling salt",
"wake-up slap",
"knock off",
"relic song",
"outrage",
"thrash",
"petal dance",
"hyper beam",
"giga impact",
"blast burn",
"frenzy plant",
"hydro cannon",
"roar of time",
"rock wrecker"
}
If PBmoveList.Contains(moveUsed.Name.ToLower) Then
canUseEffect = False
canUseRecharge = False
End If
End If
If canUseEffect = True Then
If substitute = 0 OrElse moveUsed.IsAffectedBySubstitute = False Then
moveUsed.MoveHits(own, BattleScreen)
@ -1886,7 +1956,11 @@
End If
moveUsed.MoveRecoil(own, BattleScreen)
moveUsed.MoveRecharge(own, BattleScreen)
If canUseRecharge Then
moveUsed.MoveRecharge(own, BattleScreen)
End If
If op.HP > 0 Then
If own = True Then
@ -1985,7 +2059,6 @@
Case "mummy"
If moveUsed.MakesContact = True Then
If p.Ability.Name.ToLower() <> "multitype" And p.Ability.Name.ToLower() <> "mummy" Then
p.OriginalAbility = p.Ability
p.Ability = Ability.GetAbilityByID(152)
ChangeCameraAngel(1, own, BattleScreen)
BattleScreen.BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & "'s ability changed to Mummy!"))
@ -4012,7 +4085,6 @@
LowerStat(Not own, own, BattleScreen, "Attack", 1, p.GetDisplayName() & "'s Intimidate cuts " & op.GetDisplayName() & "'s attack!", "intimidate")
Case "trace"
If op.Ability.Name.ToLower() <> "multitype" And op.Ability.Name.ToLower() <> "illusion" Then
p.OriginalAbility = p.Ability
p.Ability = op.Ability
.BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & " copied the ability " & op.Ability.Name & " from " & op.GetDisplayName() & "!"))
End If
@ -4141,7 +4213,6 @@
p.OriginalShiny = CInt(p.IsShiny.ToNumberString())
p.OriginalMoves = New List(Of BattleSystem.Attack)
p.OriginalMoves.AddRange(p.Attacks.ToArray())
p.OriginalAbility = Ability.GetAbilityByID(p.Ability.ID)
'Apply new stats:
p.Number = op.Number
@ -4673,6 +4744,11 @@
HPChange = CInt(.OwnPokemon.MaxHP / 8)
HPMessage = "Dry Skin"
End If
Case "solar power"
If .FieldEffects.Weather = BattleWeather.WeatherTypes.Sunny Then
HPChange = -CInt(.OwnPokemon.MaxHP / 8)
HPMessage = "Solar Power"
End If
Case "rain dish"
If .FieldEffects.Weather = BattleWeather.WeatherTypes.Rain Then
HPChange = CInt(.OwnPokemon.MaxHP / 16)
@ -5402,6 +5478,11 @@
HPChange = CInt(.OppPokemon.MaxHP / 8)
HPMessage = "Dry Skin"
End If
Case "solar power"
If .FieldEffects.Weather = BattleWeather.WeatherTypes.Sunny Then
HPChange = -CInt(.OppPokemon.MaxHP / 8)
HPMessage = "Solar Power"
End If
Case "rain dish"
If .FieldEffects.Weather = BattleWeather.WeatherTypes.Rain Then
HPChange = CInt(.OppPokemon.MaxHP / 16)

View File

@ -976,7 +976,7 @@
Return True
End Function
Public Shared Function CalculateDamage(ByVal Attack As Attack, ByVal Critical As Boolean, ByVal Own As Boolean, ByVal targetPokemon As Boolean, ByVal BattleScreen As BattleScreen) As Integer
Public Shared Function CalculateDamage(ByVal Attack As Attack, ByVal Critical As Boolean, ByVal Own As Boolean, ByVal targetPokemon As Boolean, ByVal BattleScreen As BattleScreen, Optional ByVal ExtraParameter As String = "") As Integer
Dim p As Pokemon = Nothing
Dim Op As Pokemon = Nothing
If Own = True Then
@ -1221,6 +1221,10 @@
If Attack.Type.Type = Element.Types.Fairy Then
UA = 1.3F
End If
Case "parental bond"
If ExtraParameter = "parental bond" Then
UA = 0.25
End If
Case Else
UA = 1.0F
End Select

View File

@ -405,6 +405,10 @@
Return New Abilities.Pixilate
Case 183
Return New Abilities.Gooey
Case 184
Return New Abilities.Aerilate
Case 185
Return New Abilities.ParentalBond
Case 186
Return New Abilities.DarkAura
Case 187

View File

@ -1559,8 +1559,8 @@
''' </summary>
''' <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) As Integer
Return BattleCalculation.CalculateDamage(Me, Critical, Own, targetPokemon, BattleScreen)
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)
End Function
''' <summary>

View File

@ -52,7 +52,7 @@
'#End
End Sub
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen) As Integer
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen, Optional ExtraParameter As String = "") As Integer
Return 40
End Function

View File

@ -80,7 +80,7 @@
Return True
End Function
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen) As Integer
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen, Optional ExtraParameter As String = "") As Integer
Dim damage As Integer = BattleScreen.FieldEffects.OwnLastDamage
If Own = True Then
damage = BattleScreen.FieldEffects.OppLastDamage

View File

@ -52,7 +52,7 @@
'#End
End Sub
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen) As Integer
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen, Optional ExtraParameter As String = "") As Integer
Dim p As Pokemon = BattleScreen.OwnPokemon
If Own = False Then
p = BattleScreen.OppPokemon

View File

@ -52,7 +52,7 @@
'#End
End Sub
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen) As Integer
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen, Optional ExtraParameter As String = "") As Integer
Dim p As Pokemon = BattleScreen.OwnPokemon
If Own = False Then
p = BattleScreen.OppPokemon

View File

@ -79,7 +79,7 @@
End If
End Function
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen) As Integer
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen, Optional ExtraParameter As String = "") As Integer
If Own = True Then
Dim damage As Integer = BattleScreen.FieldEffects.OwnBideDamage * 2
BattleScreen.FieldEffects.OwnBideDamage = 0

View File

@ -52,10 +52,10 @@ Namespace BattleSystem.Moves.Normal
'#End
End Sub
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen) As Integer
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen, Optional ExtraParameter As String = "") As Integer
Dim p As Pokemon = BattleScreen.OwnPokemon
Dim o As Pokemon = BattleScreen.OppPokemon
If own = False Then
If Own = False Then
p = BattleScreen.OppPokemon
o = BattleScreen.OwnPokemon
End If
@ -68,6 +68,6 @@ Namespace BattleSystem.Moves.Normal
Return (o.HP - p.HP)
End Function
End Class
End Class
End Namespace

View File

@ -55,7 +55,7 @@
Me.AIField2 = AIField.Nothing
End Sub
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen) As Integer
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen, Optional ExtraParameter As String = "") As Integer
Dim d As Integer = MyBase.GetDamage(Critical, Own, targetPokemon, BattleScreen)
Dim subst As Integer = BattleScreen.FieldEffects.OppSubstitute

View File

@ -52,7 +52,7 @@
'#End
End Sub
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen) As Integer
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen, Optional ExtraParameter As String = "") As Integer
Return 20
End Function

View File

@ -52,7 +52,7 @@
'#End
End Sub
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen) As Integer
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen, Optional ExtraParameter As String = "") As Integer
Dim op As Pokemon = BattleScreen.OppPokemon
If Own = False Then
op = BattleScreen.OwnPokemon

View File

@ -79,7 +79,7 @@
p.OriginalShiny = CInt(p.IsShiny.ToNumberString())
p.OriginalMoves = New List(Of BattleSystem.Attack)
p.OriginalMoves.AddRange(p.Attacks.ToArray())
p.OriginalAbility = Ability.GetAbilityByID(p.Ability.ID)
'Apply new stats:
p.Number = op.Number

View File

@ -76,7 +76,7 @@
Return True
End Function
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen) As Integer
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen, Optional ExtraParameter As String = "") As Integer
Dim damage As Integer = BattleScreen.FieldEffects.OwnLastDamage
If Own = True Then
damage = BattleScreen.FieldEffects.OppLastDamage

View File

@ -52,7 +52,7 @@
'#End
End Sub
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen) As Integer
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen, Optional ExtraParameter As String = "") As Integer
Dim p As Pokemon = BattleScreen.OwnPokemon
If Own = False Then
p = BattleScreen.OppPokemon

View File

@ -63,10 +63,6 @@ Namespace BattleSystem.Moves.Psychic
op = BattleScreen.OwnPokemon
End If
If p.OriginalAbility Is Nothing Then
p.OriginalAbility = p.Ability
End If
p.Ability = New Ability(op.Ability.ID, op.Ability.Name, op.Ability.Description)
BattleScreen.BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & " copies " & op.Ability.Name & " from " & op.GetDisplayName() & "."))

View File

@ -69,9 +69,6 @@ Namespace BattleSystem.Moves.Psychic
Dim pAbility As Integer = p.Ability.ID
Dim opAbility As Integer = op.Ability.ID
p.OriginalAbility = Ability.GetAbilityByID(p.Ability.ID)
op.OriginalAbility = Ability.GetAbilityByID(op.Ability.ID)
p.Ability = Ability.GetAbilityByID(opAbility)
op.Ability = Ability.GetAbilityByID(pAbility)

View File

@ -77,7 +77,7 @@
Return True
End Function
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen) As Integer
Public Overrides Function GetDamage(Critical As Boolean, Own As Boolean, targetPokemon As Boolean, BattleScreen As BattleScreen, Optional ExtraParameter As String = "") As Integer
If Own = True Then
Return CInt(BattleScreen.FieldEffects.OppLastDamage * 1.5)
Else

View File

@ -49,6 +49,7 @@ Namespace Items.Standard
End While
p.Ability = Ability.GetAbilityByID(p.NewAbilities(newAbility).ID)
p.SetOriginalAbility()
Screen.TextBox.Show(p.GetDisplayName() & " forgot how~to use " & oldAbilityName & ".*It learned~" & p.NewAbilities(newAbility).Name & " instead." & RemoveItem())
Return True

View File

@ -1012,10 +1012,7 @@ Public Class Pokemon
Me._originalMoves = Nothing
End If
If Not Me._originalAbility Is Nothing Then
Me.Ability = Me._originalAbility
Me._originalAbility = Nothing
End If
Me.Ability = Me._originalAbility
'If Not Me._originalItem Is Nothing Then
' Me.Item = P3D.Item.GetItemByID(Me._originalItem.ID)
@ -1031,11 +1028,12 @@ Public Class Pokemon
'Just use these subs when doing/reverting mega evolutions.
Public NormalAbility As Ability = New Abilities.Stench
Public Sub LoadAltAbility()
NormalAbility = Ability
NormalAbility = OriginalAbility
Me.Ability = NewAbilities(0)
End Sub
Public Sub RestoreAbility()
Me.Ability = NormalAbility
SetOriginalAbility()
End Sub
#End Region
@ -1118,16 +1116,14 @@ Public Class Pokemon
''' <summary>
''' The Pokémon's original ability.
''' </summary>
Public Property OriginalAbility() As Ability
Public ReadOnly Property OriginalAbility() As Ability
Get
Return Me._originalAbility
End Get
Set(value As Ability)
If Me._originalAbility Is Nothing Then
Me._originalAbility = value
End If
End Set
End Property
Public Sub SetOriginalAbility()
Me._originalAbility = Ability
End Sub
''' <summary>
''' The Pokémon's original hold item.
@ -1579,6 +1575,8 @@ Public Class Pokemon
Me.OT = tagValue
Case "ability"
Me.Ability = P3D.Ability.GetAbilityByID(CInt(tagValue))
'is this relevant for the client in PvP?
SetOriginalAbility()
Me.NormalAbility = Ability
Case "status"
Select Case tagValue
@ -1767,6 +1765,7 @@ Public Class Pokemon
If Me.Ability Is Nothing Then
Me.Ability = Me.NewAbilities(Core.Random.Next(0, Me.NewAbilities.Count))
SetOriginalAbility()
End If
Dim Data As String = "{""Pokemon""[" & Me.Number & "]}" &
@ -1827,8 +1826,10 @@ Public Class Pokemon
If Screen.Level IsNot Nothing Then
If Screen.Level.HiddenAbilityChance > Core.Random.Next(0, 100) And Me.HasHiddenAbility = True Then
Me.Ability = P3D.Ability.GetAbilityByID(Me.HiddenAbility.ID)
SetOriginalAbility()
Else
Me.Ability = P3D.Ability.GetAbilityByID(Me.NewAbilities(Core.Random.Next(0, Me.NewAbilities.Count)).ID)
SetOriginalAbility()
End If
End If

Binary file not shown.