summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-08-07 22:08:29 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-08-26 22:56:47 +0200
commitba573fcc38580a01985172b9bc864c97ce855af3 (patch)
treeebcdbcf9a86cd35d5a8ab3bb004faa5c490c16d4 /example
parent7dc001eb32ae5345905e108741984258ee2f1813 (diff)
downloadmanaserv-ba573fcc38580a01985172b9bc864c97ce855af3.tar.gz
manaserv-ba573fcc38580a01985172b9bc864c97ce855af3.tar.bz2
manaserv-ba573fcc38580a01985172b9bc864c97ce855af3.tar.xz
manaserv-ba573fcc38580a01985172b9bc864c97ce855af3.zip
Made cooldowns of abilities scriptable
- Removed hardcoded using of attributes - Simply introduced lua functions to set global and ability cooldowns - Requires database update - Bumps the protocol
Diffstat (limited to 'example')
-rw-r--r--example/abilities.xml11
-rw-r--r--example/scripts/abilities.lua1
-rw-r--r--example/scripts/monster/basic_ai.lua1
3 files changed, 2 insertions, 11 deletions
diff --git a/example/abilities.xml b/example/abilities.xml
index 27a4b65d..71330dd0 100644
--- a/example/abilities.xml
+++ b/example/abilities.xml
@@ -4,10 +4,6 @@
<ability
id="1"
name="Test Spell 1"
- rechargeable="true"
- needed="100"
- rechargeattribute="6"
- cooldownattribute="20"
target="point"
useaction="attack"
/>
@@ -16,9 +12,6 @@
<ability
id="2"
name="Basic Monster strike"
- rechargeable="true"
- needed="100"
- rechargeattribute="21"
target="being"
useaction="attack"
/>
@@ -27,10 +20,6 @@
<ability
id="3"
name="debug"
- rechargeable="true"
- needed="1"
- rechargeattribute="20"
- cooldownattribute="20"
target="point"
/>
</ability-category>
diff --git a/example/scripts/abilities.lua b/example/scripts/abilities.lua
index deed0c52..3878815a 100644
--- a/example/scripts/abilities.lua
+++ b/example/scripts/abilities.lua
@@ -34,6 +34,7 @@ spell1:on_use(function(user, x, y, abilityId)
being:say("OUCH")
end
end
+ users:set_ability_cooldown(abilityId, 10)
end)
--spell1:on_recharged(function(ch) ch:say("Hoooooooo...") end)
diff --git a/example/scripts/monster/basic_ai.lua b/example/scripts/monster/basic_ai.lua
index c75ca300..b1dba32c 100644
--- a/example/scripts/monster/basic_ai.lua
+++ b/example/scripts/monster/basic_ai.lua
@@ -164,6 +164,7 @@ end
local function mob_attack(mob, target, ability_id)
local config = mob_config[mob:name()]
target:damage(mob, config.damage)
+ mob:set_ability_cooldown(ability_id, 10)
end
local function mob_recharged(mob, ability_id)