diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-05-12 11:30:59 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-05-12 11:30:59 +0200 |
commit | ef78ed124fad1ac770183b7bcd816d416e4d11b0 (patch) | |
tree | d2e8c93bae9339c75c7165b5d0f5ca34e0583bf6 /example/scripts/abilities.lua | |
parent | 2ac89cae8f19dc2ca8e5211974df18359e3f9536 (diff) | |
download | manaserv-abilities.tar.gz manaserv-abilities.tar.xz manaserv-abilities.zip |
Readded Entity:damage as lua functionabilities
Diffstat (limited to 'example/scripts/abilities.lua')
-rw-r--r-- | example/scripts/abilities.lua | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/example/scripts/abilities.lua b/example/scripts/abilities.lua index ce617ee..0dee281 100644 --- a/example/scripts/abilities.lua +++ b/example/scripts/abilities.lua @@ -25,13 +25,12 @@ spell1:on_use(function(user, x, y, abilityId) local affected_beings = get_beings_in_circle(target_x, target_y, TILESIZE) for _, being in ipairs(affected_beings) do if being ~= user then - local old_hp = being:base_attribute(ATTR_HP) - local new_hp = math.max(old_hp - 5, 0) - being:set_base_attribute(ATTR_HP, new_hp) - local diff = old_hp - new_hp - if diff > 0 then - being:add_hit_taken(diff) - end + local damage = { + base = 10, + delta = 5, + chance_to_hit = user:modified_attribute(ATTR_STR), + } + being:damage(user, damage) end end end) |