Skip to content

Commit

Permalink
fix pirate bug with cannon and arpon (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
matiascalegaris authored Aug 29, 2023
1 parent b4fffa8 commit e36bcaa
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 44 deletions.
2 changes: 2 additions & 0 deletions Codigo/Declares.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,7 @@ Public Type t_EffectOverTime
RequireWeaponType As Integer
npcId As Integer
ApplyStatusMask As Long
SecondaryTargetModifier As Single
End Type

Public Enum e_DamageResult
Expand Down Expand Up @@ -1961,6 +1962,7 @@ Public Type t_UserFlags

TargetObjInvIndex As Integer
TargetObjInvSlot As Integer
UsingItemSlot As Integer

AtacadoPorNpc As t_NpcReference
AtacadoPorUser As Integer
Expand Down
2 changes: 1 addition & 1 deletion Codigo/FileIO.bas
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ On Error GoTo ErrHandler
If val(Leer.GetValue("EOT" & i, "RequireFist")) > 0 Then Call SetIntMask(EffectOverTime(i).RequireWeaponType, ShiftLeft(1, eFist))
If val(Leer.GetValue("EOT" & i, "RequireSpear")) > 0 Then Call SetIntMask(EffectOverTime(i).RequireWeaponType, ShiftLeft(1, eSpear))
If val(Leer.GetValue("EOT" & i, "RequireGunpowder")) > 0 Then Call SetIntMask(EffectOverTime(i).RequireWeaponType, ShiftLeft(1, eGunPowder))

EffectOverTime(i).SecondaryTargetModifier = val(Leer.GetValue("EOT" & i, "SecondaryTargetModifier"))
Next i

Call InitializePools
Expand Down
67 changes: 32 additions & 35 deletions Codigo/InvUsuario.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1812,8 +1812,7 @@ Sub UseInvItem(ByVal UserIndex As Integer, ByVal Slot As Byte, ByVal ByClick As
Case e_OBJType.otUseOnce

142 If .flags.Muerto = 1 Then
144 Call WriteLocaleMsg(UserIndex, "77", e_FontTypeNames.FONTTYPE_INFO)
' Call WriteConsoleMsg(UserIndex, "¡¡Estas muerto!! Solo podes usar items cuando estas vivo. ", e_FontTypeNames.FONTTYPE_INFO)
144 Call WriteLocaleMsg(UserIndex, 77, e_FontTypeNames.FONTTYPE_INFO)
Exit Sub

End If
Expand Down Expand Up @@ -1883,13 +1882,8 @@ Sub UseInvItem(ByVal UserIndex As Integer, ByVal Slot As Byte, ByVal ByClick As

End If

'REVISAR LADDER
'Solo si es herramienta ;) (en realidad si no es ni proyectil ni daga)
198 If .Invent.Object(Slot).Equipped = 0 Then
'Call WriteConsoleMsg(UserIndex, "Antes de usar la herramienta deberias equipartela.", e_FontTypeNames.FONTTYPE_INFO)
'Call WriteLocaleMsg(UserIndex, "376", e_FontTypeNames.FONTTYPE_INFO)
Exit Sub

End If

200 Case e_OBJType.otHerramientas
Expand Down Expand Up @@ -3140,6 +3134,7 @@ Sub UseInvItem(ByVal UserIndex As Integer, ByVal Slot As Byte, ByVal ByClick As
Call AddOrResetEffect(UserIndex, ObjData(ObjIndex).ApplyEffectId)
End Select
Case e_OBJType.otUsableOntarget
.flags.UsingItemSlot = .flags.TargetObjInvSlot
Call WriteWorkRequestTarget(UserIndex, e_Skill.TargetableItem)
End Select
End With
Expand Down Expand Up @@ -3398,31 +3393,33 @@ End Function
Public Sub UserTargetableItem(ByVal UserIndex As Integer, ByVal TileX As Integer, ByVal TileY As Integer)
On Error GoTo UserTargetableItem_Err
With UserList(UserIndex)
If IsItemInCooldown(UserList(UserIndex), .invent.Object(.flags.TargetObjInvSlot)) Then
If IsItemInCooldown(UserList(UserIndex), .invent.Object(.flags.UsingItemSlot)) Then
Exit Sub
End If
If .flags.UsingItemSlot = 0 Then Exit Sub
Dim objIndex As Integer
objIndex = .invent.Object(.flags.TargetObjInvSlot).objIndex
End With
With ObjData(objIndex)
If .MinHp > UserList(UserIndex).Stats.MinHp Then
Call WriteLocaleMsg(UserIndex, MsgRequiresMoreHealth, e_FontTypeNames.FONTTYPE_INFO)
Exit Sub
End If
If .MinSta > UserList(UserIndex).Stats.MinSta Then
Call WriteLocaleMsg(UserIndex, MsgTiredToPerformAction, e_FontTypeNames.FONTTYPE_INFO)
Exit Sub
End If
Select Case .Subtipo
Case e_UssableOnTarget.eRessurectionItem
Call ResurrectWithItem(UserIndex)
Case e_UssableOnTarget.eTrap
Call PlaceTrap(UserIndex, TileX, TileY)
Case e_UssableOnTarget.eArpon
Call UseArpon(UserIndex)
Case e_UssableOnTarget.eHandCannon
Call UseHandCannon(UserIndex, TileX, TileY)
End Select
ObjIndex = .invent.Object(.flags.UsingItemSlot).ObjIndex
With ObjData(ObjIndex)
If .MinHp > UserList(UserIndex).Stats.MinHp Then
Call WriteLocaleMsg(UserIndex, MsgRequiresMoreHealth, e_FontTypeNames.FONTTYPE_INFO)
Exit Sub
End If
If .MinSta > UserList(UserIndex).Stats.MinSta Then
Call WriteLocaleMsg(UserIndex, MsgTiredToPerformAction, e_FontTypeNames.FONTTYPE_INFO)
Exit Sub
End If
Select Case .Subtipo
Case e_UssableOnTarget.eRessurectionItem
Call ResurrectWithItem(UserIndex)
Case e_UssableOnTarget.eTrap
Call PlaceTrap(UserIndex, TileX, TileY)
Case e_UssableOnTarget.eArpon
Call UseArpon(UserIndex)
Case e_UssableOnTarget.eHandCannon
Call UseHandCannon(UserIndex, TileX, TileY)
End Select
End With
.flags.UsingItemSlot = 0
End With
Exit Sub
UserTargetableItem_Err:
Expand Down Expand Up @@ -3463,9 +3460,9 @@ On Error GoTo ResurrectWithItem_Err
122 Call UserMod.ModifyHealth(UserIndex, -costoVidaResu, 1)
124 Call ModifyStamina(UserIndex, -UserList(UserIndex).Stats.MinSta, False, 0)
Dim objIndex As Integer
126 objIndex = .invent.Object(.flags.TargetObjInvSlot).objIndex
126 ObjIndex = .invent.Object(.flags.UsingItemSlot).ObjIndex
128 Call UpdateCd(UserIndex, ObjData(objIndex).cdType)
192 Call RemoveItemFromInventory(UserIndex, UserList(UserIndex).flags.TargetObjInvSlot)
192 Call RemoveItemFromInventory(UserIndex, UserList(UserIndex).flags.UsingItemSlot)
196 Call ResurrectUser(TargetUser)
If IsFeatureEnabled("remove-inv-on-attack") Then
Call RemoveUserInvisibility(UserIndex)
Expand Down Expand Up @@ -3512,10 +3509,10 @@ Public Sub PlaceTrap(ByVal UserIndex As Integer, ByVal TileX As Integer, ByVal T
Call Trap.Disable
End If
Dim objIndex As Integer
objIndex = UserList(UserIndex).invent.Object(UserList(UserIndex).flags.TargetObjInvSlot).objIndex
ObjIndex = UserList(UserIndex).invent.Object(UserList(UserIndex).flags.UsingItemSlot).ObjIndex
Call UpdateCd(UserIndex, ObjData(objIndex).cdType)
Call EffectsOverTime.CreateTrap(UserIndex, eUser, .pos.map, TileX, TileY, ObjData(objIndex).EfectoMagico)
Call RemoveItemFromInventory(UserIndex, UserList(UserIndex).flags.TargetObjInvSlot)
Call RemoveItemFromInventory(UserIndex, UserList(UserIndex).flags.UsingItemSlot)
End With
End Sub

Expand Down Expand Up @@ -3548,7 +3545,7 @@ Public Sub UseArpon(ByVal UserIndex As Integer)
Exit Sub
End If
Dim ObjIndex As Integer
ObjIndex = .invent.Object(.flags.TargetObjInvSlot).ObjIndex
ObjIndex = .invent.Object(.flags.UsingItemSlot).ObjIndex
Call UpdateCd(UserIndex, ObjData(ObjIndex).cdType)
Dim Damage As Integer
Damage = GetUserDamageWithItem(UserIndex, ObjIndex, 0)
Expand Down Expand Up @@ -3582,7 +3579,7 @@ Public Sub UseHandCannon(ByVal UserIndex As Integer, ByVal TileX As Integer, ByV
Exit Sub
End If
Dim ObjIndex As Integer
ObjIndex = .invent.Object(.flags.TargetObjInvSlot).ObjIndex
ObjIndex = .invent.Object(.flags.UsingItemSlot).ObjIndex
Call UpdateCd(UserIndex, ObjData(ObjIndex).cdType)
Dim Particula As Integer
Dim Tiempo As Long
Expand Down
3 changes: 3 additions & 0 deletions Codigo/UpdateHpOverTime.cls
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Dim TimeSinceLastTick As Long
Dim TickEffect As Integer
Dim Modifiers As Integer
Dim EffectBonus As Single
Dim SecondTargetModifier As Single

Private DotInfo As t_BaseDotInfo
Private source As t_AnyReference
Expand All @@ -68,6 +69,7 @@ Public Sub Setup(ByVal sourceIndex As Integer, ByVal sourceType As e_ReferenceTy
TickTime = .TickTime
TickEffect = .TickFX
Modifiers = .EffectModifiers
SecondTargetModifier = 1 - .SecondaryTargetModifier
If DotInfo.TargetRef.RefType = eUser And EffectOverTime(DotInfo.EotId).ClientEffectTypeId > 0 Then Call WriteSendSkillCdUpdate(TargetIndex, .ClientEffectTypeId, ID, .TickTime * TargetTicks, .TickTime * TargetTicks, .buffType)
End With
EffectBonus = 1
Expand Down Expand Up @@ -261,6 +263,7 @@ Public Sub PerformAction()
If IsSet(Modifiers, e_ModifierTypes.SelfHealingBonus) Then
TickHP = TickHP * NPCs.GetSelfHealingBonus(NpcList(DotInfo.TargetRef.ArrayIndex))
End If
TickHP = TickHP * SecondTargetModifier
If IsValidRef(source) Then
Call NPCs.DoDamageOrHeal(DotInfo.TargetRef.ArrayIndex, Source.ArrayIndex, Source.RefType, TickHP, e_dot, DotInfo.EotId)
Else
Expand Down
16 changes: 8 additions & 8 deletions Codigo/modHechizos.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1312,14 +1312,14 @@ Function HandlePhysicalSkill(ByVal SourceIndex As Integer, ByVal SourceType As e
Dim ObjectIndex As Integer
Dim Proyectile As Integer
If SourceType = eUser Then
With UserList(SourceIndex)
If .invent.MunicionEqpObjIndex = 0 Then
Exit Function
End If
Damage = GetUserDamageWithItem(SourceIndex, .invent.WeaponEqpObjIndex, .invent.MunicionEqpObjIndex)
ObjectIndex = .invent.WeaponEqpObjIndex
Proyectile = ObjData(.invent.MunicionEqpObjIndex).ProjectileType
End With
With UserList(SourceIndex)
If .invent.MunicionEqpObjIndex = 0 Then
Exit Function
End If
Damage = GetUserDamageWithItem(SourceIndex, .invent.WeaponEqpObjIndex, .invent.MunicionEqpObjIndex) / 2
objectIndex = .invent.WeaponEqpObjIndex
Proyectile = ObjData(.invent.MunicionEqpObjIndex).ProjectileType
End With
Else
Damage = RandomNumber(NpcList(SourceIndex).Stats.MinHIT, NpcList(SourceIndex).Stats.MaxHit)
ObjectIndex = -1
Expand Down

0 comments on commit e36bcaa

Please sign in to comment.