From 53b6e99c8d8e27bfb1d7d22ed32013005b4c7469 Mon Sep 17 00:00:00 2001 From: skotlex Date: Fri, 2 Jun 2006 02:51:34 +0000 Subject: - 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 --- src/map/pc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/map/pc.c') 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) -- cgit v1.2.3-60-g2f50