diff options
| author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-27 18:11:13 +0200 |
|---|---|---|
| committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-05-08 14:02:51 +0200 |
| commit | 0a1332f04b841bc32e09552665e5cd611fa23ca8 (patch) | |
| tree | c0afc18cff01a6dbd028692fc3170d88bc47533b /example/scripts | |
| parent | 06027d423e179ea3b479284c466725ed4c76ca7a (diff) | |
| download | manaserv-0a1332f04b841bc32e09552665e5cd611fa23ca8.tar.gz manaserv-0a1332f04b841bc32e09552665e5cd611fa23ca8.tar.xz manaserv-0a1332f04b841bc32e09552665e5cd611fa23ca8.zip | |
[Abilities] Added a add_hit_taken bind
This allows to display hit messages in the client for abilities
Diffstat (limited to 'example/scripts')
| -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 7c25eb0..ce617ee 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) |
