From f7d71e54c0b5fdaa9e8aa1e69e615b9f80d124e4 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Mon, 4 Feb 2013 16:19:21 +0100 Subject: Moved attribute (re)calculation to the scripts This introduces two callbacks: - on_update_derived_attribute -> Called to recalculate other derived attributes. - on_recalculate_base_attribute -> Called to recalculate a base attribute (only called for characters. However the function passed as callback can be useful for recalculating the derived attributes as well) Monsters no longer block recalculation of attributes except HP and Speed. I saw no sense to keep this. Fixed constant value in libmana-constants.lua Dropped bool type of the recalculation functions. It would be difficult to keep it while pushing all to the script engine and it was unused anyway. All in all this adds a LOT more flexibillity to projects since they can now adapt all attributes in the way they want. --- scripts/lua/libmana-constants.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/lua/libmana-constants.lua b/scripts/lua/libmana-constants.lua index 9638588..a07df4c 100644 --- a/scripts/lua/libmana-constants.lua +++ b/scripts/lua/libmana-constants.lua @@ -55,6 +55,8 @@ ELEMENT_METAL = 6; ELEMENT_WOOD = 7; ELEMENT_ICE = 8; +TICKS_PER_HP_REGENERATION = 100 + -- Core attributes Id ATTR_STR = 1; ATTR_AGI = 2; @@ -64,7 +66,7 @@ ATTR_DEX = 5; ATTR_WIL = 6; -- Derived attributes Id -ATTR_ACCURACY = 6; +ATTR_ACCURACY = 7; ATTR_DEFENSE = 8; ATTR_DODGE = 9; -- cgit