summaryrefslogtreecommitdiff
path: root/src/emap/status.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emap/status.c')
-rw-r--r--src/emap/status.c57
1 files changed, 57 insertions, 0 deletions
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;
+}
+