diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-27 18:11:13 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-08-26 22:56:46 +0200 |
commit | 960d40d819afb65387469591bdb02e6819d72294 (patch) | |
tree | 773a697bdd12ae28a717bf6087c3109fbfc1fb35 /example | |
parent | 163c438e4f373989a8a82e47f38ac67d70b5a1bf (diff) | |
download | manaserv-960d40d819afb65387469591bdb02e6819d72294.tar.gz manaserv-960d40d819afb65387469591bdb02e6819d72294.tar.bz2 manaserv-960d40d819afb65387469591bdb02e6819d72294.tar.xz manaserv-960d40d819afb65387469591bdb02e6819d72294.zip |
[Abilities] Added a add_hit_taken bind
This allows to display hit messages in the client for abilities
Diffstat (limited to 'example')
-rw-r--r-- | example/scripts/abilities.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/example/scripts/abilities.lua b/example/scripts/abilities.lua index 7c25eb09..ce617ee1 100644 --- a/example/scripts/abilities.lua +++ b/example/scripts/abilities.lua @@ -28,6 +28,10 @@ spell1:on_use(function(user, x, y, abilityId) 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 end end end) |