Mirage Engine
problem With critical Hits - Printable Version

+- Mirage Engine (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Programming (https://mirage-engine.uk/forums/forumdisplay.php?fid=24)
+----- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=27)
+----- Thread: problem With critical Hits (/showthread.php?tid=3264)



problem With critical Hits - jsventor - 30-10-2009

Code:
If CanPlayerCriticalHit(Index) = False Then
                        Damage = GetPlayerDamage(Index) - Int(Npc(MapNpc(GetPlayerMap(Index), i).num).DEF / 2) + (Rnd * 5) - 2
                        'Call SendDataToMap(GetPlayerMap(Index), SOUND_CHAR & SEP_CHAR & "Blow" & Int(Rnd * 7) + 1 & END_CHAR)
                        Call SendSound(Index, ATTACK_SOUND, SDTM)
                    Else
                    Agi = GetPlayerAgil(Index)
Spd = GetPlayerSPEED(Index)
lvl = GetPlayerLevel(Index)
STR = GetPlayerSTR(Index)

Num1 = (500 + lvl) / (Agi + Spd) + (lvl / 90)

Rand = Random(1, Num1 + (Num1 * 2))


                        N = GetPlayerDamage(Index)
                        'Damage = N + (Random((str + ((str / 2) + Num1)), ((str + ((str / 2) + Num1))) * 2)) - Int(Npc(MapNpc(GetPlayerMap(index), i).num).DEF / 2) + (Rnd * 5) - 2
                        Damage = N + (Random((STR + ((STR / 2) + Num1)), ((STR + ((STR / 2) + Num1))) * 2))
                        Call BattleMsg(Index, "You feel a surge of energy upon swinging!", BrightCyan, 0)

The CanPlayerCriticalHit Function is

[code]Function CanPlayerCriticalHit(ByVal Index As Long) As Boolean
Dim i As Long, N As Long
Dim Num1 As Long
Dim Agi As Long
Dim Spd As Long
Dim lvl As Long
Dim STR As Long

Dim Rand As Long

CanPlayerCriticalHit = False


Agi = GetPlayerAgil(Index)
Spd = GetPlayerSPEED(Index)
lvl = GetPlayerLevel(Index)
STR = GetPlayerSTR(Index)

Num1 = (500 + lvl) / (Agi + Spd) + (lvl / 90)

Rand = Random(1, Num1 + (Num1 * 2))



If GetPlayerWeaponSlot(Index) > 0 Then
N = Rand

If N > 6 Then
CanPlayerCriticalHit = False

If N