diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/emap/init.c | 1 | ||||
-rw-r--r-- | src/emap/skill.c | 48 | ||||
-rw-r--r-- | src/emap/skill.h | 7 |
3 files changed, 56 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c index 57f2e35..aa928c3 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -393,6 +393,7 @@ HPExport void plugin_init (void) addHookPost(mob, spawn_dataset, emob_spawn_dataset_post); addHookPost(skill, check_condition_castend, eskill_check_condition_castend_post); addHookPost(skill, get_index, eskill_get_index_post); + addHookPost(skill, calc_heal, eskill_calc_heal_post); addHookPost(pc, additem, epc_additem_post); addHookPost(pc, isequip, epc_isequip_post); addHookPost(pc, isUseitem, epc_isequip_post); diff --git a/src/emap/skill.c b/src/emap/skill.c index 20e4a82..30614b7 100644 --- a/src/emap/skill.c +++ b/src/emap/skill.c @@ -259,3 +259,51 @@ 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; +} + + + diff --git a/src/emap/skill.h b/src/emap/skill.h index 51d7224..4ae9b27 100644 --- a/src/emap/skill.h +++ b/src/emap/skill.h @@ -98,4 +98,11 @@ bool eskill_lookup_const(const struct config_setting_t *it, const char *name, int *value); +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))); + #endif // EVOL_MAP_SKILL |