summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-04-25 17:26:24 +0200
committerGitHub <noreply@github.com>2018-04-25 17:26:24 +0200
commita4df55e940057e2882a4b01dd1471c73af70e2bd (patch)
treec4fba2860de8dd7dc59c98fee61c2213478d95d6 /src/map/status.c
parent611c7db42af28fad06a2b2e56c327403d9af3d6f (diff)
parent296eb152a9b870a7615c3c7dbeb2ebe48551d1ce (diff)
downloadhercules-a4df55e940057e2882a4b01dd1471c73af70e2bd.tar.gz
hercules-a4df55e940057e2882a4b01dd1471c73af70e2bd.tar.bz2
hercules-a4df55e940057e2882a4b01dd1471c73af70e2bd.tar.xz
hercules-a4df55e940057e2882a4b01dd1471c73af70e2bd.zip
Merge pull request #2022 from 4144/extend
Refactor some functions to move MAPID_* related code into separate functions.
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/map/status.c b/src/map/status.c
index a39449b11..972d1eca9 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2333,6 +2333,18 @@ void status_calc_pc_additional(struct map_session_data* sd, enum e_status_calc_o
return;
}
+void status_calc_pc_recover_hp(struct map_session_data* sd, struct status_data *bstatus)
+{
+ nullpo_retv(sd);
+ nullpo_retv(bstatus);
+
+ if ((sd->job & MAPID_BASEMASK) == MAPID_NOVICE && (sd->job & JOBL_2) == 0
+ && battle_config.restart_hp_rate < 50)
+ bstatus->hp = bstatus->max_hp>>1;
+ else
+ bstatus->hp = APPLY_RATE(bstatus->max_hp, battle_config.restart_hp_rate);
+}
+
//Calculates player data from scratch without counting SC adjustments.
//Should be invoked whenever players raise stats, learn passive skills or change equipment.
int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
@@ -2874,11 +2886,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
bstatus->hp = bstatus->max_hp;
bstatus->sp = bstatus->max_sp;
} else {
- if ((sd->job & MAPID_BASEMASK) == MAPID_NOVICE && (sd->job & JOBL_2) == 0
- && battle_config.restart_hp_rate < 50)
- bstatus->hp = bstatus->max_hp>>1;
- else
- bstatus->hp = APPLY_RATE(bstatus->max_hp, battle_config.restart_hp_rate);
+ status->calc_pc_recover_hp(sd, bstatus);
if(!bstatus->hp)
bstatus->hp = 1;
@@ -13658,6 +13666,7 @@ void status_defaults(void)
status->calc_pet_ = status_calc_pet_;
status->calc_pc_ = status_calc_pc_;
status->calc_pc_additional = status_calc_pc_additional;
+ status->calc_pc_recover_hp = status_calc_pc_recover_hp;
status->calc_homunculus_ = status_calc_homunculus_;
status->calc_mercenary_ = status_calc_mercenary_;
status->calc_elemental_ = status_calc_elemental_;