diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-19 15:36:18 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-05-08 14:02:51 +0200 |
commit | ec473d0d76e89e606122187ceab61df8a0ab17cf (patch) | |
tree | b873b90f233025aaacbb327614779df05e139e6b /src/scripting | |
parent | 7b289c333a6c5735dffa504c8482aee3b648b6cd (diff) | |
download | manaserv-ec473d0d76e89e606122187ceab61df8a0ab17cf.tar.gz manaserv-ec473d0d76e89e606122187ceab61df8a0ab17cf.tar.xz manaserv-ec473d0d76e89e606122187ceab61df8a0ab17cf.zip |
[Abilities] Made the rechargespeed depending on attributes
This allows a lot more flexibility and makes stuff like magical items a
lot easier to implement. We will also use this for the attack system in
the future. So a attack (abilitiy) would simply depend on some value
like Agility (or a derived attribute from it). Which sets the recharge
speed.
The recharge speed is the modified value of the attribute per game tick.
Diffstat (limited to 'src/scripting')
-rw-r--r-- | src/scripting/lua.cpp | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index d5831d6..1f9c1cf 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -1278,61 +1278,6 @@ static int chr_set_quest(lua_State *s) return 0; } -/** LUA entity:set_ability_recharge_speed (being) - * entity:set_ability_recharge_speed(int abilityid, int new_speed) - * entity:set_ability_recharge_speed(string abilityname, int new_speed) - ** - * Valid only for character entities. - * - * Sets the recharge speed of the ability to a new value for the character. - * - * **Note:** When passing the ''abilityname'' as parameter make sure that it is - * formatted in this way: <setname>_<abilityname> (for eg. "Magic_Healingspell"). - */ -static int entity_set_ability_recharge_speed(lua_State *s) -{ - Entity *c = checkCharacter(s, 1); - const int ability = checkAbility(s, 2); - const int speed = luaL_checkint(s, 3); - - if (!c->getComponent<CharacterComponent>() - ->setAbilityRechargeSpeed(ability, speed)) - { - luaL_error(s, - "set_ability_recharge_speed called with ability " - "that is not owned by character."); - } - return 0; -} - -/** LUA entity:ability_recharge_speed (being) - * entity:ability_recharge_speed(int abilityid) - * entity:ability_recharge_speed(string abilityname) - ** - * Valid only for character entities. - * - * **Return value:** The current recharge speed of the ability that is owned by - * the character. - * - * **Note:** When passing the ''abilityname'' as parameter make sure that it is - * formatted in this way: <setname>_<abilityname> (for eg. "Magic_Healingspell"). - */ -static int entity_get_ability_recharge_speed(lua_State *s) -{ - Entity *c = checkCharacter(s, 1); - const int ability = checkAbility(s, 2); - - auto *characterComponent = c->getComponent<CharacterComponent>(); - - AbilityMap::iterator it = characterComponent->findAbility(ability); - - luaL_argcheck(s, it != characterComponent->getAbilitiesEnd(), 2, - "character does not have ability"); - - lua_pushinteger(s, it->second.rechargeSpeed); - return 1; -} - /** LUA entity:set_ability_mana (being) * entity:set_ability_mana(int abilityid, int new_mana) * entity:set_ability_mana(string abilityname, int new_mana) @@ -3738,8 +3683,6 @@ LuaScript::LuaScript(): { "equip_item", entity_equip_item }, { "unequip_slot", entity_unequip_slot }, { "unequip_item", entity_unequip_item }, - { "set_ability_recharge_speed", entity_set_ability_recharge_speed }, - { "ability_recharge_speed", entity_get_ability_recharge_speed }, { "set_ability_mana", entity_set_ability_mana }, { "ability_mana", entity_get_ability_mana }, { "walk", entity_walk }, |