summaryrefslogtreecommitdiff
path: root/example/scripts/monster
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-05-12 11:30:59 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-08-26 22:56:47 +0200
commite3a1e9c89e102dbf961c624435c495c759776312 (patch)
treec76e09b7661a61eebd042b8d49502fcbcb6d0066 /example/scripts/monster
parent4d46079cd147e05513473860cb2e92fec0c31b8f (diff)
downloadmanaserv-e3a1e9c89e102dbf961c624435c495c759776312.tar.gz
manaserv-e3a1e9c89e102dbf961c624435c495c759776312.tar.bz2
manaserv-e3a1e9c89e102dbf961c624435c495c759776312.tar.xz
manaserv-e3a1e9c89e102dbf961c624435c495c759776312.zip
Readded Entity:damage as lua function
Diffstat (limited to 'example/scripts/monster')
-rw-r--r--example/scripts/monster/basic_ai.lua8
-rw-r--r--example/scripts/monster/settings.lua6
2 files changed, 6 insertions, 8 deletions
diff --git a/example/scripts/monster/basic_ai.lua b/example/scripts/monster/basic_ai.lua
index 385099cc..17ffa74a 100644
--- a/example/scripts/monster/basic_ai.lua
+++ b/example/scripts/monster/basic_ai.lua
@@ -144,14 +144,8 @@ local function update(mob, tick)
end
local function mob_attack(mob, target, ability_id)
- local hp = target:base_attribute(ATTR_HP)
local config = mob_config[mob:name()]
- local dealt_damage = math.min(hp, config.damage)
- if dealt_damage > 0 then
- local v = hp - dealt_damage
- target:set_base_attribute(ATTR_HP, hp - dealt_damage)
- target:add_hit_taken(dealt_damage)
- end
+ target:damage(mob, config.damage)
end
local function mob_recharged(mob, ability_id)
diff --git a/example/scripts/monster/settings.lua b/example/scripts/monster/settings.lua
index b095a2d7..f2b6741b 100644
--- a/example/scripts/monster/settings.lua
+++ b/example/scripts/monster/settings.lua
@@ -17,7 +17,11 @@ return {
trackrange = 5 * TILESIZE,
attack_distance = TILESIZE,
ability_id = 2,
- damage = 1,
+ damage = {
+ base = 2,
+ delta = 5,
+ chance_to_hit = 20,
+ },
},
["Green Slime"] = {
strollrange = TILESIZE,