• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

simDamage (level, attackSkill, attackValue, attackFactor)

Zysen

=)
Joined
Sep 18, 2010
Messages
2,270
Reaction score
170
Location
Bosnia & Herzegovina
Name: simDamage (level, attackSkill, attackValue, attackFactor)
Author: Lpz
Type: LUA Function


Works on TFS 0.4_DEV.

To install this feature on your server, open the 050-functions.lua located in data/lib and at the end of the file, paste this:

Lua:
function simDamage(level, attackSkill, attackValue, attackFactor)
        factor = {
                [0] = 0.5,
                [1] = 0.75,
                [2] = 1
        }
        attackFactor = factor[attackFactor] or 0.75
        return math.ceil((2 * (attackValue * (attackSkill + 5.8) / 25 + (level - 1) / 10)) * attackFactor)
end

The use of the function is very simple, if I want to, for example, simulate the damage of a player with level 100, sword skill 60, ​​Magic Sword and Full Attack, then I'll do this:

Lua:
simDamage(100, 60, 48, 2)

IDs : 0 for Full Defence, 1 for Balanced and 2 for Full Attack.


Yours,
Zysen.
 
Last edited:
hah nice, i allready made it many time ago, but im not shared because most people won't use this function, but it's nice :)
 
This would better be described as the unadjusted mean damage. There is no account of target's armor and defence ratings or random roll.

Still, thank you, the formula is a useful reference.
 
Back
Top