summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-02 02:51:34 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-02 02:51:34 +0000
commit53b6e99c8d8e27bfb1d7d22ed32013005b4c7469 (patch)
treeb6c348130ebe8b104188fcfd2d432347962f0445 /src/map/pc.c
parent396001e8663d1fa0f8476f0bad7243317f70ab9d (diff)
downloadhercules-53b6e99c8d8e27bfb1d7d22ed32013005b4c7469.tar.gz
hercules-53b6e99c8d8e27bfb1d7d22ed32013005b4c7469.tar.bz2
hercules-53b6e99c8d8e27bfb1d7d22ed32013005b4c7469.tar.xz
hercules-53b6e99c8d8e27bfb1d7d22ed32013005b4c7469.zip
- Altered status_calc_pc so that equipment scripts are ran before card-scripts.
- Fixed pc_bonus to not underflow/overflow when adjusting def/mdef. - These two together, should fix Tao Gunka Card. - npc_debug_warps() will now be invoked if warp_point_debug is set. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6925 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 9c42dee1c..cca92aff5 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1245,8 +1245,14 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
}
break;
case SP_DEF1:
- if(sd->state.lr_flag != 2)
- status->def+=val;
+ if(sd->state.lr_flag != 2) {
+ if (val < 0 && status->def < -val)
+ status->def = 0;
+ else if (val > 0 && val > UCHAR_MAX - status->def)
+ status->def = UCHAR_MAX;
+ else
+ status->def+=val;
+ }
break;
case SP_DEF2:
if(sd->state.lr_flag != 2)
@@ -1257,8 +1263,14 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
status->mdef+=val;
break;
case SP_MDEF2:
- if(sd->state.lr_flag != 2)
- status->mdef+=val;
+ if(sd->state.lr_flag != 2) {
+ if (val < 0 && status->mdef < -val)
+ status->mdef = 0;
+ else if (val > 0 && val > UCHAR_MAX - status->mdef)
+ status->mdef = UCHAR_MAX;
+ else
+ status->mdef+=val;
+ }
break;
case SP_HIT:
if(sd->state.lr_flag != 2)