summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-28 10:50:31 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-28 10:50:31 +0000
commita85ac18efdbf3d53b5b46a66d0f36f7490a52a5b (patch)
tree68c1c14f46f54309f37328e51f19b23c8fc03691 /src/map/status.c
parent522b376587fbf5793183c41d2916dec1232f762d (diff)
downloadhercules-a85ac18efdbf3d53b5b46a66d0f36f7490a52a5b.tar.gz
hercules-a85ac18efdbf3d53b5b46a66d0f36f7490a52a5b.tar.bz2
hercules-a85ac18efdbf3d53b5b46a66d0f36f7490a52a5b.tar.xz
hercules-a85ac18efdbf3d53b5b46a66d0f36f7490a52a5b.zip
- Reverted the position of the max_hp/max_sp basic setting, modified the max_hp/max_sp bonuses to use casting in order to work correctly with negative bonuses.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11832 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/map/status.c b/src/map/status.c
index fdcf1c2a3..b7e13f870 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1715,10 +1715,6 @@ int status_calc_pc(struct map_session_data* sd,int first)
status->aspd_rate = 1000;
status->ele_lv = 1;
status->race = RC_DEMIHUMAN;
- //Set base Max-Hp/Sp (required here for negative Hp/Sp bonuses to work properly)
- //We hold the standard Max HP here to make it faster to recalculate on vit changes.
- sd->status.max_hp = status->max_hp = status_base_pc_maxhp(sd,status);
- sd->status.max_sp = status->max_sp = status_base_pc_maxsp(sd,status);
//zero up structures...
memset(&sd->autospell,0,sizeof(sd->autospell)
@@ -2036,6 +2032,13 @@ int status_calc_pc(struct map_session_data* sd,int first)
// ----- HP MAX CALCULATION -----
+ // Basic MaxHP value
+ //We hold the standard Max HP here to make it faster to recalculate on vit changes.
+ sd->status.max_hp = status_base_pc_maxhp(sd,status);
+ //This is done to handle underflows from negative Max HP bonuses
+ i = sd->status.max_hp + (int)status->max_hp;
+ status->max_hp = cap_value(i, 0, INT_MAX);
+
// Absolute modifiers from passive skills
if((skill=pc_checkskill(sd,CR_TRUST))>0)
status->max_hp += skill*200;
@@ -2055,6 +2058,12 @@ int status_calc_pc(struct map_session_data* sd,int first)
// ----- SP MAX CALCULATION -----
+ // Basic MaxSP value
+ sd->status.max_sp = status_base_pc_maxsp(sd,status);
+ //This is done to handle underflows from negative Max SP bonuses
+ i = sd->status.max_sp + (int)status->max_sp;
+ status->max_sp = cap_value(i, 0, INT_MAX);
+
// Absolute modifiers from passive skills
if((skill=pc_checkskill(sd,SL_KAINA))>0)
status->max_sp += 30*skill;