Skip to content

Commit

Permalink
Merge pull request #388 from ao-org/prevent-stun-on-inmo-targets
Browse files Browse the repository at this point in the history
Prevent stun on inmo targets
  • Loading branch information
RecoX authored Sep 16, 2023
2 parents 36e3fa7 + 71bbc2a commit 613a3b0
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 23 deletions.
3 changes: 2 additions & 1 deletion Codigo/Declares.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ Public Enum e_DamageResult
eDead
End Enum

Public Const MAX_PACKET_COUNTERS As Long = 15
Public Const MAX_PACKET_COUNTERS As Long = 16

Public Enum PacketNames
CastSpell = 1
Expand All @@ -1201,6 +1201,7 @@ Public Enum PacketNames
GuildMessage
QuestionGM
ChangeHeading
Hide
End Enum

Public Type t_UserOBJ
Expand Down
1 change: 1 addition & 0 deletions Codigo/FileIO.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,7 @@ Public Sub CargarMapaFormatoCSM(ByVal map As Long, ByVal MAPFl As String)
383 MapInfo(map).DropItems = True
MapInfo(map).FriendlyFire = True
MapInfo(Map).KeepInviOnAttack = val(GetVar(DatPath & "Map.dat", "KeepInviOnAttack", Map)) <> 0
MapInfo(Map).ForceUpdate = val(GetVar(DatPath & "Map.dat", "ForceUpdateAi", Map)) <> 0

384 If LenB(MapDat.Salida) <> 0 Then
Dim Fields() As String
Expand Down
2 changes: 2 additions & 0 deletions Codigo/GameLogic.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,8 @@ Public Function PacketIdToString(ByVal PacketId As Long) As String
Exit Function
Case 15
PacketIdToString = "ChangeHeading"
Case 16
PacketIdToString = "Hide"
Exit Function
End Select

Expand Down
10 changes: 6 additions & 4 deletions Codigo/Modulo_UsUaRiOs.bas
Original file line number Diff line number Diff line change
Expand Up @@ -3140,12 +3140,14 @@ Public Function CanMove(ByRef flags As t_UserFlags, ByRef Counters As t_UserCoun
CanMove = flags.Paralizado = 0 And flags.Inmovilizado = 0 And Not IsStun(flags, Counters) And Not flags.TranslationActive
End Function

Public Function StunPlayer(ByRef counter As t_UserCounters) As Boolean
Public Function StunPlayer(ByVal UserIndex As Integer, ByRef Counters As t_UserCounters) As Boolean
Dim currTime As Long
StunPlayer = False
If Not CanMove(UserList(UserIndex).flags, Counters) Then Exit Function
If IsSet(UserList(UserIndex).flags.StatusMask, eCCInmunity) Then Exit Function
currTime = GetTickCount()
If currTime > counter.StunEndTime + PlayerInmuneTime Then
counter.StunEndTime = GetTickCount() + PlayerStunTime
If CurrTime > Counters.StunEndTime + PlayerInmuneTime Then
Counters.StunEndTime = GetTickCount() + PlayerStunTime
StunPlayer = True
End If
End Function
Expand Down Expand Up @@ -3514,7 +3516,7 @@ Public Function Inmovilize(ByVal SourceIndex As Integer, ByVal TargetIndex As In
Call WriteLocaleMsg(SourceIndex, MsgCCInunity, e_FontTypeNames.FONTTYPE_FIGHT)
Exit Function
End If
144 If UserList(TargetIndex).flags.Inmovilizado = 0 Then
144 If Not CanMove(UserList(TargetIndex).flags, UserList(TargetIndex).Counters) Then
146 UserList(TargetIndex).Counters.Inmovilizado = Time
148 UserList(TargetIndex).flags.Inmovilizado = 1
150 Call SendData(SendTarget.ToPCAliveArea, TargetIndex, PrepareMessageCreateFX(UserList(TargetIndex).Char.charindex, Fx, 0, UserList(TargetIndex).pos.x, UserList(TargetIndex).pos.y))
Expand Down
2 changes: 1 addition & 1 deletion Codigo/SistemaCombate.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2204,7 +2204,7 @@ Private Sub UserDañoEspecial(ByVal AtacanteIndex As Integer, ByVal VictimaIndex
If rangeStun And IsFeatureEnabled("enable_stun") And Not IsSet(UserList(VictimaIndex).flags.StatusMask, eCCInmunity) Then
If (RandomNumber(1, 100) < stunChance) Then
With UserList(VictimaIndex)
If StunPlayer(.Counters) Then
If StunPlayer(VictimaIndex, .Counters) Then
Call WriteStunStart(VictimaIndex, PlayerStunTime)
Call WritePosUpdate(VictimaIndex)
178 Call SendData(SendTarget.ToPCAliveArea, VictimaIndex, PrepareMessageCreateFX(.Char.charindex, 142, 1))
Expand Down
7 changes: 2 additions & 5 deletions Codigo/Trabajo.bas
Original file line number Diff line number Diff line change
Expand Up @@ -3193,11 +3193,8 @@ On Error GoTo ThrowNetToTarget_Err:
Call WriteLocaleMsg(UserIndex, MsgCCInunity, e_FontTypeNames.FONTTYPE_FIGHT)
Exit Sub
End If
132 If UserList(tU).flags.Paralizado = 1 Then
134 Call WriteConsoleMsg(UserIndex, UserList(tU).Name & " ya está paralizado.", e_FontTypeNames.FONTTYPE_FIGHT)
Exit Sub
136 ElseIf UserList(tU).flags.Inmovilizado = 1 Then
138 Call WriteConsoleMsg(UserIndex, UserList(tU).Name & " ya está inmovilizado.", e_FontTypeNames.FONTTYPE_FIGHT)
If Not UserMod.CanMove(UserList(tU).flags, UserList(tU).Counters) Then
136 Call WriteConsoleMsg(UserIndex, "No podes inmovilizar un objetivo que no puede moverse.", e_FontTypeNames.FONTTYPE_FIGHT)
Exit Sub
End If

Expand Down
16 changes: 4 additions & 12 deletions Codigo/modHechizos.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2072,12 +2072,8 @@ Sub HechizoEstadoUsuario(ByVal UserIndex As Integer, ByRef b As Boolean)
Call WriteConsoleMsg(UserIndex, UserList(tU).Name & " no puede volver a ser paralizado tan rápido.", e_FontTypeNames.FONTTYPE_FIGHT)
Exit Sub
End If

If UserList(tU).flags.Paralizado = 1 Then
Call WriteConsoleMsg(UserIndex, UserList(tU).Name & " ya está paralizado.", e_FontTypeNames.FONTTYPE_FIGHT)
Exit Sub
ElseIf UserList(tU).flags.Inmovilizado = 1 Then
Call WriteConsoleMsg(UserIndex, UserList(tU).Name & " ya está inmovilizado.", e_FontTypeNames.FONTTYPE_FIGHT)
If Not UserMod.CanMove(UserList(tU).flags, UserList(tU).Counters) Then
428 Call WriteConsoleMsg(UserIndex, "No podes inmovilizar un objetivo que no puede moverse.", e_FontTypeNames.FONTTYPE_FIGHT)
Exit Sub
End If
If IsSet(UserList(tU).flags.StatusMask, eCCInmunity) Then
Expand Down Expand Up @@ -2182,12 +2178,8 @@ Sub HechizoEstadoUsuario(ByVal UserIndex As Integer, ByRef b As Boolean)
506 Call WriteLocaleMsg(UserIndex, "380", e_FontTypeNames.FONTTYPE_FIGHT)
Exit Sub
End If

508 If UserList(tU).flags.Paralizado = 1 Then
510 Call WriteConsoleMsg(UserIndex, UserList(tU).Name & " ya está paralizado.", e_FontTypeNames.FONTTYPE_FIGHT)
Exit Sub
512 ElseIf UserList(tU).flags.Inmovilizado = 1 Then
514 Call WriteConsoleMsg(UserIndex, UserList(tU).Name & " ya está inmovilizado.", e_FontTypeNames.FONTTYPE_FIGHT)
If Not UserMod.CanMove(UserList(tU).flags, UserList(tU).Counters) Then
510 Call WriteConsoleMsg(UserIndex, "No podes inmovilizar un objetivo que no puede moverse.", e_FontTypeNames.FONTTYPE_FIGHT)
Exit Sub
End If

Expand Down
4 changes: 4 additions & 0 deletions PacketRatePolicy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,9 @@ Iterations=2
Limit=80
Iterations=10

[Hide]
Limit=150
Iterations=7



0 comments on commit 613a3b0

Please sign in to comment.