From edb398dad252824611e65ae7dc0516ac9c7ce581 Mon Sep 17 00:00:00 2001 From: matiascalegaris Date: Mon, 28 Aug 2023 22:11:21 -0300 Subject: [PATCH] fix pirate bug with cannon and arpon --- Codigo/Declares.bas | 2 ++ Codigo/FileIO.bas | 2 +- Codigo/InvUsuario.bas | 67 ++++++++++++++++++------------------- Codigo/UpdateHpOverTime.cls | 3 ++ Codigo/modHechizos.bas | 16 ++++----- 5 files changed, 46 insertions(+), 44 deletions(-) diff --git a/Codigo/Declares.bas b/Codigo/Declares.bas index 1bb7e600..8ab1ca89 100644 --- a/Codigo/Declares.bas +++ b/Codigo/Declares.bas @@ -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 @@ -1961,6 +1962,7 @@ Public Type t_UserFlags TargetObjInvIndex As Integer TargetObjInvSlot As Integer + UsingItemSlot As Integer AtacadoPorNpc As t_NpcReference AtacadoPorUser As Integer diff --git a/Codigo/FileIO.bas b/Codigo/FileIO.bas index 78c6275b..3c8a8a88 100644 --- a/Codigo/FileIO.bas +++ b/Codigo/FileIO.bas @@ -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 diff --git a/Codigo/InvUsuario.bas b/Codigo/InvUsuario.bas index 094c730c..c2e932a9 100644 --- a/Codigo/InvUsuario.bas +++ b/Codigo/InvUsuario.bas @@ -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 @@ -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 @@ -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 @@ -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: @@ -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) @@ -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 @@ -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) @@ -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 diff --git a/Codigo/UpdateHpOverTime.cls b/Codigo/UpdateHpOverTime.cls index c1a6029e..7ea659ab 100644 --- a/Codigo/UpdateHpOverTime.cls +++ b/Codigo/UpdateHpOverTime.cls @@ -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 @@ -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 @@ -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 diff --git a/Codigo/modHechizos.bas b/Codigo/modHechizos.bas index 0bc0c6cd..06ca28e8 100644 --- a/Codigo/modHechizos.bas +++ b/Codigo/modHechizos.bas @@ -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