diff options
Diffstat (limited to 'src/emap/skill.c')
-rw-r--r-- | src/emap/skill.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/emap/skill.c b/src/emap/skill.c index 20e4a82..2cf45cc 100644 --- a/src/emap/skill.c +++ b/src/emap/skill.c @@ -19,6 +19,7 @@ #include "map/pc.h" #include "map/npc.h" #include "map/script.h" +#include "map/skill.h" #include "emap/skill.h" #include "emap/skill_const.h" @@ -259,3 +260,79 @@ void eskill_validate_additional_fields(struct config_setting_t *conf, skilld->miscEffects[1] = i32; } } + +int eskill_calc_heal_post(int retVal, + struct block_list *src, + struct block_list *target, + uint16 skill_id, + uint16 skill_lv __attribute__ ((unused)), + bool heal __attribute__ ((unused))) { + + // Rebuild some data I need + int hp = 0; + int skill2_lv, tmp, tmp1; + struct map_session_data *sd = BL_CAST(BL_PC, src); + struct map_session_data *tsd = BL_CAST(BL_PC, target); + + // Only affects healing + if (sd && tsd && skill_id == AL_HEAL) { + ShowDebug("Skill is healing and SD is set. ACC ID %d.\n", sd->login_id2); + // Only if self-target + if (sd->login_id2 == tsd->login_id2) { + // Recalculate everything with VIT instead + hp = (status->get_lv(src) + status_get_vit(src)) / 5 * 30 * skill_lv / 10; + // Skill bonuses + if (sd && (skill2_lv = pc->skillheal_bonus(sd, skill_id)) != 0) + hp += hp*skill2_lv/100; + + if (tsd && (skill2_lv = pc->skillheal2_bonus(tsd, skill_id)) != 0) + hp += hp*skill2_lv/100; + + // Preprare the possible healing bonus + tmp = status->get_total_def(src)*2; + tmp1 = status->get_matk(src, 3); + // Use the highest from both + if (tmp > tmp1) + hp+=tmp; + else + hp+=tmp1; + ShowDebug("Redefined (idx=%d original %d)\n", hp, retVal); + ShowDebug("TMP %d TMP1 %d Won %d)\n", tmp, tmp1, hp); + } + } + if (hp) + return hp; + else + return retVal; +} + +int eskill_consume_requirement_post(int retVal, + struct map_session_data *sd, + uint16 skill_id, uint16 skill_lv, short type) +{ + int i, n; + struct skill_condition req; + + if (!sd) + return retVal; + + //ShowInfo("crpost, Skill %d Level %d and type %d\n", skill_id, skill_lv, type); + + req = skill->get_requirement(sd,skill_id,skill_lv); + + // TODO We need more checks than only this + if (type == 1 && skill_id > EVOL_FIRST_SKILL) { + // Delete the items + for( i = 0; i < MAX_SKILL_ITEM_REQUIRE; ++i ) + { + if( !req.itemid[i] ) + continue; + + if ((n = pc->search_inventory(sd,req.itemid[i])) != INDEX_NOT_FOUND) + pc->delitem(sd, n, req.amount[i], 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + } + } + return retVal; +} + + |