Skip to content

Commit

Permalink
add support for to apply different buff to the party and the caster
Browse files Browse the repository at this point in the history
  • Loading branch information
matiascalegaris committed Aug 30, 2023
1 parent 8bb5255 commit 48b3188
Show file tree
Hide file tree
Showing 25 changed files with 129 additions and 21 deletions.
4 changes: 4 additions & 0 deletions Codigo/ApplyEffectOnHit.cls
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ Public Property Get IBaseEffectOverTime_TypeId() As Integer
IBaseEffectOverTime_TypeId = e_EffectOverTimeType.eApplyEffectOnHit
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = DotInfo.UniqueId
End Property
Expand Down
8 changes: 7 additions & 1 deletion Codigo/ApplyEffectOnParty.cls
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = DotInfo.UniqueId
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_CasterIsValid() As Boolean
IBaseEffectOverTime_CasterIsValid = IsValidRef(Source)
End Property
Expand Down Expand Up @@ -268,7 +272,9 @@ Private Sub ApplyEffectTo(ByVal TargetId As Integer, ByVal TargetType As e_Refer
Set Effect = FindEffectOnTarget(DotInfo.TargetRef.ArrayIndex, UserList(TargetId).EffectOverTime, EffectIdToApply)
If Effect Is Nothing Then
Call CreateEffect(DotInfo.TargetRef.ArrayIndex, DotInfo.TargetRef.RefType, TargetId, TargetType, EffectIdToApply)
ElseIf EffectOverTime(DotInfo.EotId).Override Then
ElseIf EffectOverTime(EffectIdToApply).Override And _
(Effect.EotId = EffectIdToApply Or EffectIdToApply = ApplyEffectId) Then
'either we don't override personal buff with other bard buff or we override anohter bard buff with ours on ourself
Call Effect.Reset(DotInfo.TargetRef.ArrayIndex, DotInfo.TargetRef.RefType, EffectIdToApply)
End If
Call RegisterNewHelp(TargetId, DotInfo.TargetRef.ArrayIndex)
Expand Down
13 changes: 13 additions & 0 deletions Codigo/Declares.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,7 @@ End Enum

Public Type t_EffectOverTime
Type As e_EffectOverTimeType
SharedTypeId As e_EotTypeId
Limit As e_EOTTargetLimit
SubType As Integer
TickPowerMin As Single
Expand Down Expand Up @@ -2967,11 +2968,23 @@ Public Enum e_EffectOverTimeType
[EffectTypeCount]
End Enum

Public Enum e_EotTypeId
eNone = 0
eHealingDot = 1
eManaSong = 2
eSpeedSong = 3
eHitSing = 4
eEvasionSong = 5
eDivineProtection = 6
[EotTypeIdCount]
End Enum

Public Enum e_EOTTargetLimit
eSingle = 1 'Only one on target for this type
eSingleByCaster 'The target can have more than 1 effect of this type but only 1 for every caster
eAny 'No limits
eSingleByType 'can only have one effect of given type active at the time (like weapon poison)
eSingleByTypeId 'only one by TypeId (so we can have different buff that share the same id and can't stack like different lvls of the same buff)
End Enum

Public Type t_BaseDotInfo
Expand Down
4 changes: 4 additions & 0 deletions Codigo/DrunkEffect.cls
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = DotInfo.UniqueId
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_CasterIsValid() As Boolean
IBaseEffectOverTime_CasterIsValid = IsValidRef(DotInfo.TargetRef)
End Property
Expand Down
4 changes: 4 additions & 0 deletions Codigo/EffectOverTime/AttrackEffect.cls
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = DotInfo.UniqueId
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_CasterIsValid() As Boolean
IBaseEffectOverTime_CasterIsValid = IsValidRef(Source)
End Property
Expand Down
4 changes: 4 additions & 0 deletions Codigo/EffectOverTime/BonusDamageEffect.cls
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ Public Property Get IBaseEffectOverTime_TypeId() As Integer
IBaseEffectOverTime_TypeId = e_EffectOverTimeType.eBonusDamage
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(EffectInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = EffectInfo.UniqueId
End Property
Expand Down
4 changes: 4 additions & 0 deletions Codigo/EffectOverTime/DelayedBlast.cls
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ Public Property Get IBaseEffectOverTime_TypeId() As Integer
IBaseEffectOverTime_TypeId = e_EffectOverTimeType.eDelayedBlast
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = DotInfo.UniqueId
End Property
Expand Down
4 changes: 4 additions & 0 deletions Codigo/EffectOverTime/MultipleAttacks.cls
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = mDotInfo.UniqueId
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(mDotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_CasterIsValid() As Boolean
IBaseEffectOverTime_CasterIsValid = IsValidRef(mDotInfo.TargetRef)
End Property
Expand Down
4 changes: 4 additions & 0 deletions Codigo/EffectOverTime/ProtectEffect.cls
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ Public Property Get IBaseEffectOverTime_TypeId() As Integer
IBaseEffectOverTime_TypeId = e_EffectOverTimeType.eProtection
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = DotInfo.UniqueId
End Property
Expand Down
4 changes: 4 additions & 0 deletions Codigo/EffectOverTime/TransformEffect.cls
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ Public Property Get IBaseEffectOverTime_TypeId() As Integer
IBaseEffectOverTime_TypeId = e_EffectOverTimeType.eTransform
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = DotInfo.UniqueId
End Property
Expand Down
4 changes: 4 additions & 0 deletions Codigo/EffectOverTime/UnequipItem.cls
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ Public Property Get IBaseEffectOverTime_TypeId() As Integer
IBaseEffectOverTime_TypeId = e_EffectOverTimeType.eUnequip
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(mDotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = mDotInfo.UniqueId
End Property
Expand Down
4 changes: 4 additions & 0 deletions Codigo/EffectProvoke.cls
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = DotInfo.UniqueId
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_CasterIsValid() As Boolean
IBaseEffectOverTime_CasterIsValid = IsValidRef(Source)
End Property
Expand Down
4 changes: 4 additions & 0 deletions Codigo/EffectProvoked.cls
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ Public Property Get IBaseEffectOverTime_TypeId() As Integer
IBaseEffectOverTime_TypeId = e_EffectOverTimeType.eProvoked
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = DotInfo.UniqueId
End Property
Expand Down
5 changes: 5 additions & 0 deletions Codigo/EffectsOverTime.bas
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,11 @@ On Error GoTo FindEffectOnTarget_Err
Set FindEffectOnTarget = EffectList.EffectList(i)
Exit Function
End If
ElseIf EffectLimit = eSingleByTypeId Then
If EffectList.EffectList(i).SharedTypeId = EffectOverTime(EffectId).SharedTypeId Then
Set FindEffectOnTarget = EffectList.EffectList(i)
Exit Function
End If
End If
Next i
Exit Function
Expand Down
1 change: 1 addition & 0 deletions Codigo/FileIO.bas
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,7 @@ On Error GoTo ErrHandler
114 For i = 1 To EffectCount
EffectOverTime(i).Type = val(Leer.GetValue("EOT" & i, "Type"))
EffectOverTime(i).SubType = val(Leer.GetValue("EOT" & i, "SubType"))
EffectOverTime(i).SharedTypeId = val(Leer.GetValue("EOT" & i, "SharedTypeId"))
EffectOverTime(i).TickPowerMin = val(Leer.GetValue("EOT" & i, "TickPowerMin"))
EffectOverTime(i).TickPowerMax = val(Leer.GetValue("EOT" & i, "TickPowerMax"))
EffectOverTime(i).Ticks = val(Leer.GetValue("EOT" & i, "Ticks"))
Expand Down
3 changes: 3 additions & 0 deletions Codigo/IBaseEffectOverTime.cls
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ End Property
Public Property Get TypeId() As Integer
End Property

Public Property Get SharedTypeId() As Integer
End Property

Public Property Get EotId() As Integer
End Property

Expand Down
8 changes: 7 additions & 1 deletion Codigo/InvUsuario.bas
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,15 @@ Function MeterItemEnInventario(ByVal UserIndex As Integer, ByRef MiObj As t_Obj)
Dim Y As Integer

Dim Slot As Integer

If MiObj.ObjIndex = 12 Then
UserList(UserIndex).Stats.GLD = UserList(UserIndex).Stats.GLD + MiObj.amount
MeterItemEnInventario = True
Call WriteUpdateGold(UserIndex)
Exit Function
End If
'¿el user ya tiene un objeto del mismo tipo? ?????
100 Slot = GetSlotForItemInInvetory(UserIndex, MiObj)

If Slot <= 0 Then
118 Call WriteLocaleMsg(UserIndex, MsgInventoryIsFull, e_FontTypeNames.FONTTYPE_FIGHT)
120 MeterItemEnInventario = False
Expand Down
9 changes: 9 additions & 0 deletions Codigo/Matematicas.bas
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ RandomNumber_Err:
102 Call TraceError(Err.Number, Err.Description, "Matematicas.RandomNumber", Erl)
End Function

Public Function RandomRange(ByVal LowerBound As Single, ByVal UpperBound As Single) As Single
On Error GoTo RandomNumber_Err
100 RandomRange = Rnd
RandomRange = RandomRange * (UpperBound - LowerBound) + LowerBound
Exit Function
RandomNumber_Err:
102 Call TraceError(Err.Number, Err.Description, "Matematicas.RandomNumber", Erl)
End Function

Public Sub SetMask(ByRef mask As Long, ByVal value As Long)
mask = mask Or value
End Sub
Expand Down
10 changes: 0 additions & 10 deletions Codigo/Modulo_InventANDobj.bas
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,6 @@ Public Sub NpcDropeo(ByRef npc As t_Npc, ByRef UserIndex As Integer)

End If

110 If UserList(UserIndex).Invent.MagicoObjIndex = 383 Then
112 If npc.QuizaProb = 0 Then
114 Probabilidad = RandomNumber(1, DropMult / 2) 'Tiro Item?
Else
116 Probabilidad = RandomNumber(1, npc.QuizaProb / 2) 'Tiro Item?

End If

End If

118 If Probabilidad <> 1 Then Exit Sub

120 objRandom = RandomNumber(1, npc.NumQuiza) 'Que item puede ser que tire?
Expand Down
2 changes: 0 additions & 2 deletions Codigo/Modulo_UsUaRiOs.bas
Original file line number Diff line number Diff line change
Expand Up @@ -3526,8 +3526,6 @@ Public Sub RemoveUserInvisibility(ByVal UserIndex As Integer)
Dim RemoveHiddenState As Boolean
If IsFeatureEnabled("remove-inv-on-attack") And Not MapInfo(.pos.Map).KeepInviOnAttack Then
RemoveHiddenState = .flags.Oculto > 0 Or .flags.invisible > 0
Else
RemoveHiddenState = .flags.Oculto > 0
End If
'I see you...
If RemoveHiddenState And .flags.AdminInvisible = 0 Then
Expand Down
4 changes: 4 additions & 0 deletions Codigo/StatModifier.cls
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ Public Property Get IBaseEffectOverTime_TypeId() As Integer
IBaseEffectOverTime_TypeId = e_EffectOverTimeType.eApplyModifiers
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = DotInfo.UniqueId
End Property
Expand Down
4 changes: 4 additions & 0 deletions Codigo/TranslationEffect.cls
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ Public Property Get IBaseEffectOverTime_TypeId() As Integer
IBaseEffectOverTime_TypeId = e_EffectOverTimeType.eTranslation
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = DotInfo.UniqueId
End Property
Expand Down
4 changes: 4 additions & 0 deletions Codigo/UpdateHpOverTime.cls
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ Public Property Get IBaseEffectOverTime_TypeId() As Integer
IBaseEffectOverTime_TypeId = e_EffectOverTimeType.eHealthModifier
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = DotInfo.UniqueId
End Property
Expand Down
31 changes: 24 additions & 7 deletions Codigo/UpdateManaOverTime.cls
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,18 @@ Public Sub Setup(ByVal SourceIndex As Integer, ByVal SourceType As e_ReferenceTy
TickCount = 0
Call SetBaseDot(DotInfo, TargetIndex, TargetType, ID, EffectId)
Call SetRef(Source, SourceIndex, SourceType)
With EffectOverTime(EffectId)
Call ConfigEffect
End Sub

Private Sub ConfigEffect()
With EffectOverTime(DotInfo.EotId)
DotManaMin = .TickPowerMin
DotManaMax = .TickPowerMax
TargetTicks = .Ticks
TickTime = .TickTime
TickEffect = .TickFX
If DotInfo.TargetRef.RefType = eUser And EffectOverTime(DotInfo.EotId).ClientEffectTypeId > 0 Then
Call WriteSendSkillCdUpdate(TargetIndex, .ClientEffectTypeId, ID, .TickTime * TargetTicks, .TickTime * TargetTicks, .buffType)
Call WriteSendSkillCdUpdate(DotInfo.TargetRef.ArrayIndex, .ClientEffectTypeId, DotInfo.UniqueId, .TickTime * TargetTicks, .TickTime * TargetTicks, .buffType)
End If
End With
End Sub
Expand All @@ -87,6 +91,10 @@ Public Property Get IBaseEffectOverTime_CasterArrayIndex() As Integer
IBaseEffectOverTime_CasterArrayIndex = Source.ArrayIndex
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(DotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_CasterRefType() As e_ReferenceType
IBaseEffectOverTime_CasterRefType = Source.RefType
End Property
Expand Down Expand Up @@ -139,9 +147,18 @@ End Property
Public Function IBaseEffectOverTime_Reset(ByVal SourceUserId As Integer, ByVal SourceType As e_ReferenceType, ByVal NewEffectId As Integer) As Boolean
IBaseEffectOverTime_Reset = True
TickCount = 0
If DotInfo.TargetRef.RefType = eUser And EffectOverTime(DotInfo.EotId).ClientEffectTypeId > 0 Then
Call WriteSendSkillCdUpdate(DotInfo.TargetRef.ArrayIndex, EffectOverTime(DotInfo.EotId).ClientEffectTypeId, _
DotInfo.UniqueId, (TickTime * TargetTicks) - TimeSinceLastTick, TickTime * TargetTicks, EffectOverTime(DotInfo.EotId).buffType)
If NewEffectId <> DotInfo.EotId Then
DotInfo.EotId = NewEffectId
If DotInfo.TargetRef.RefType = eUser And EffectOverTime(DotInfo.EotId).ClientEffectTypeId > 0 Then
Call WriteSendSkillCdUpdate(DotInfo.TargetRef.ArrayIndex, EffectOverTime(DotInfo.EotId).ClientEffectTypeId, DotInfo.UniqueId, _
0, 0, EffectOverTime(DotInfo.EotId).buffType)
End If
Call ConfigEffect
Else
If DotInfo.TargetRef.RefType = eUser And EffectOverTime(DotInfo.EotId).ClientEffectTypeId > 0 Then
Call WriteSendSkillCdUpdate(DotInfo.TargetRef.ArrayIndex, EffectOverTime(DotInfo.EotId).ClientEffectTypeId, _
DotInfo.UniqueId, (TickTime * TargetTicks) - TimeSinceLastTick, TickTime * TargetTicks, EffectOverTime(DotInfo.EotId).buffType)
End If
End If
End Function

Expand Down Expand Up @@ -202,8 +219,8 @@ Public Property Get IBaseEffectOverTime_KeepAfterDead() As Boolean
End Property

Public Sub PerformAction()
Dim TickMana As Long
TickMana = RandomNumber(DotManaMin, DotManaMax)
Dim TickMana As Single
TickMana = RandomRange(DotManaMin, DotManaMax)
If DotInfo.TargetRef.RefType = e_ReferenceType.eUser Then
With UserList(DotInfo.TargetRef.ArrayIndex)
Dim CurrentMana, MaxMana As Long
Expand Down
4 changes: 4 additions & 0 deletions Codigo/clsTrap.cls
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ Public Property Get IBaseEffectOverTime_TypeId() As Integer
IBaseEffectOverTime_TypeId = e_EffectOverTimeType.eTrap
End Property

Public Property Get IBaseEffectOverTime_SharedTypeId() As Integer
IBaseEffectOverTime_SharedTypeId = EffectOverTime(mDotInfo.EotId).SharedTypeId
End Property

Public Property Get IBaseEffectOverTime_UniqueId() As Long
IBaseEffectOverTime_UniqueId = mDotInfo.UniqueId
End Property
Expand Down

0 comments on commit 48b3188

Please sign in to comment.