summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-09-14 21:47:33 -0300
committerJesusaves <cpntb1@ymail.com>2019-09-14 21:47:33 -0300
commitc693c134062fc2518967d423ae97b4b7de232c04 (patch)
tree1f8cf461507c6cc078d21fc17c0798b0ce4cf1a4
parent9214290c4141782f76f1f454f32c936513d2a66d (diff)
downloadevol-hercules-c693c134062fc2518967d423ae97b4b7de232c04.tar.gz
evol-hercules-c693c134062fc2518967d423ae97b4b7de232c04.tar.bz2
evol-hercules-c693c134062fc2518967d423ae97b4b7de232c04.tar.xz
evol-hercules-c693c134062fc2518967d423ae97b4b7de232c04.zip
Well, this looks like a nice code (except missing declations)
-rw-r--r--src/emap/init.c4
-rw-r--r--src/emap/status.c57
2 files changed, 61 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index d5d8571..0daa53c 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -371,6 +371,7 @@ HPExport void plugin_init (void)
// TMW2 Custom Pre Hooks
//addHookPre(battle, calc_weapon_attack, ebattle_calc_weapon_attack_pre);
addHookPre(pc, bonus, epc_bonus_preHook);
+ addHookPre(status, calc_pc_, estatus_calc_pc_preHook);
addHookPost(battle, calc_weapon_attack, ebattle_calc_weapon_attack_post);
addHookPost(battle, calc_magic_attack, ebattle_calc_weapon_attack_post);
@@ -416,6 +417,9 @@ HPExport void plugin_init (void)
addHookPost(pc, can_insert_card_into, epc_can_insert_card_into_post);
addHookPost(pc, insert_card, epc_insert_card_post);
+ // TMW2 Custom Post Hooks
+ addHookPost(status, calc_homunculus_, estatus_calc_homunculus_postHook);
+
skill->castend_nodamage_id_unknown = eskill_castend_nodamage_id_unknown;
skill->additional_effect_unknown = eskill_additional_effect_unknown;
skill->counter_additional_effect_unknown = eskill_counter_additional_effect_unknown;
diff --git a/src/emap/status.c b/src/emap/status.c
index 2d2a884..2e83d46 100644
--- a/src/emap/status.c
+++ b/src/emap/status.c
@@ -259,3 +259,60 @@ void estatus_calc_pc_recover_hp_pre(struct map_session_data **sdPtr __attribute_
bstatus->hp = APPLY_RATE(bstatus->max_hp, battle->bc->restart_hp_rate);
hookStop();
}
+
+// Reset any custom active bonus to default values
+int estatus_calc_pc_preHook(struct map_session_data **sd, enum e_status_calc_opt *opt)
+{
+ struct s_homunculus_atk *hdatk;
+ struct s_homunculus_def *hddef;
+ struct s_homunculus_maxhp *hdmaxhp;
+
+ if ((hdatk = getFromMSD(*sd,0)) != NULL) {
+ hdatk->rate = 0; // default
+ }
+
+ if ((hddef = getFromMSD(*sd,0)) != NULL) {
+ hddef->rate = 0; // default
+ }
+
+ if ((hdmaxhp = getFromMSD(*sd,0)) != NULL) {
+ hdmaxhp->rate = 0; // default
+ }
+
+ return 1;/* doesn't matter */
+}
+
+// This effectively makes homunculus armor
+int estatus_calc_homunculus_postHook(int retVal, struct homun_data *hd, enum e_status_calc_opt opt)
+{
+ // Load SD so we can get the bonus data
+ struct map_session_data *sd;
+ sd = hd->master;
+
+ // Error
+ if (!sd)
+ return retVal;
+
+ // See also: status_calc_misc() for more info
+
+ // Bonus (not capped, BEWARE)
+ const struct s_homunculus_atk *hdatk;
+ const struct s_homunculus_def *hddef;
+ const struct s_homunculus_maxhp *hdmaxhp;
+
+ if ((hdatk = getFromMSD(*sd,0)) != NULL) {
+ hd->battle_status->rhw.atk+=hdatk->rate;
+ }
+
+ if ((hddef = getFromMSD(*sd,0)) != NULL) {
+ hd->battle_status->def+=hddef->rate;
+ }
+
+ if ((hdmaxhp = getFromMSD(*sd,0)) != NULL) {
+ hd->battle_status->max_hp+=hdmaxhp->rate;
+ }
+
+ // We're done
+ return retVal;
+}
+