diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-23 23:36:09 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-08-26 22:56:46 +0200 |
commit | c2f00b2f3ba920cb25333d19a1d37d251342caf8 (patch) | |
tree | 5d782446b6679c9f74661d64a3c6d9f778136717 /example | |
parent | 10c33df8e5a13e7e7b4a3ea203516536582b2f4b (diff) | |
download | manaserv-c2f00b2f3ba920cb25333d19a1d37d251342caf8.tar.gz manaserv-c2f00b2f3ba920cb25333d19a1d37d251342caf8.tar.bz2 manaserv-c2f00b2f3ba920cb25333d19a1d37d251342caf8.tar.xz manaserv-c2f00b2f3ba920cb25333d19a1d37d251342caf8.zip |
[Abilities] Added support for a global cooldown
Each ability can now define a cooldown that prevents the player from
using other abilities for a while. The time of this cooldown can be set
to any attribute. The modified value of the attribute is the value of
the cooldown in game ticks. The cooldown will be automatically started
if the ability has `autoconsume` set to true. Otherwise a script has to
call entity:cooldown_ability(ability).
Diffstat (limited to 'example')
-rw-r--r-- | example/abilities.xml | 1 | ||||
-rw-r--r-- | example/attributes.xml | 6 | ||||
-rw-r--r-- | example/scripts/attributes.lua | 5 |
3 files changed, 11 insertions, 1 deletions
diff --git a/example/abilities.xml b/example/abilities.xml index 6d1c3233..50a9ba08 100644 --- a/example/abilities.xml +++ b/example/abilities.xml @@ -7,6 +7,7 @@ rechargeable="true" needed="100" rechargeattribute="6" + cooldownattribute="20" target="point" /> </ability-category> diff --git a/example/attributes.xml b/example/attributes.xml index e0e8829c..425dd961 100644 --- a/example/attributes.xml +++ b/example/attributes.xml @@ -172,5 +172,11 @@ player-info="max-weight" > <modifier stacktype="stackable" modtype="additive" tag="cap1" effect="Capacity %+.2f" /> </attribute> + <attribute id="20" name="Global ability cooldown" + desc="The time in ticks until any ability can be used again after one was used" + modifiable="false" + scope="being" + minimum="0" + maximum="100" /> <!-- End of core-attributes definition --> </attributes> diff --git a/example/scripts/attributes.lua b/example/scripts/attributes.lua index 2096da92..37d642d9 100644 --- a/example/scripts/attributes.lua +++ b/example/scripts/attributes.lua @@ -46,6 +46,9 @@ local function recalculate_base_attribute(being, attribute) elseif attribute == ATTR_INV_CAPACITY then -- Provisional new_base = 2000 + being:modified_attribute(ATTR_STR) * 180 + elseif attribute == ATTR_ABILITY_COOLDOWN then + -- Provisional + new_base = 100 - being:modified_attribute(ATTR_WIL) end if new_base ~= old_base then @@ -66,7 +69,7 @@ local function update_derived_attributes(being, attribute) elseif attribute == ATTR_INT then -- unimplemented elseif attribute == ATTR_WIL then - -- unimplemented + recalculate_base_attribute(being, ATTR_ABILITY_COOLDOWN) end end |