summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-05 19:17:44 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-05 19:17:44 +0000
commit4bc74ed1e4119ab962652308df1044fba44376e6 (patch)
tree118981ef47bd7e9a3cd808b9db188cc847fa26a9 /src/map/pc.c
parentbe333fef8f4e91bebd76d0fb1c6ca714915d5dbb (diff)
downloadhercules-4bc74ed1e4119ab962652308df1044fba44376e6.tar.gz
hercules-4bc74ed1e4119ab962652308df1044fba44376e6.tar.bz2
hercules-4bc74ed1e4119ab962652308df1044fba44376e6.tar.xz
hercules-4bc74ed1e4119ab962652308df1044fba44376e6.zip
- Cleaned up code for SC_MINDBREAKER.
- Changed hit, flee, cri, flee2, def2 and mdef2 to signed short, def, mdef to signed char to correctly account for cards with penalties in said stats. - Added cap_value checks in all of the status_calc_* return paths to make sure no stat is invalid. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6986 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 60d6ae749..f07e34b2a 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1248,50 +1248,50 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
case SP_DEF1:
if(sd->state.lr_flag != 2) {
bonus = status->def + val;
- status->def = cap_value(bonus, 0, UCHAR_MAX);
+ status->def = cap_value(bonus, CHAR_MIN, CHAR_MAX);
}
break;
case SP_DEF2:
if(sd->state.lr_flag != 2) {
bonus = status->def2 + val;
- status->def2 = cap_value(bonus, 0, USHRT_MAX);
+ status->def2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_MDEF1:
if(sd->state.lr_flag != 2) {
bonus = status->mdef + val;
- status->mdef = cap_value(bonus, 0, UCHAR_MAX);
+ status->mdef = cap_value(bonus, CHAR_MIN, CHAR_MAX);
}
break;
case SP_MDEF2:
if(sd->state.lr_flag != 2) {
bonus = status->mdef2 + val;
- status->mdef2 = cap_value(bonus, 0, USHRT_MAX);
+ status->mdef2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_HIT:
if(sd->state.lr_flag != 2) {
bonus = status->hit + val;
- status->hit = cap_value(bonus, 0, USHRT_MAX);
+ status->hit = cap_value(bonus, SHRT_MIN, SHRT_MAX);
} else
sd->arrow_hit+=val;
break;
case SP_FLEE1:
if(sd->state.lr_flag != 2) {
bonus = status->flee + val;
- status->flee = cap_value(bonus, 0, USHRT_MAX);
+ status->flee = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_FLEE2:
if(sd->state.lr_flag != 2) {
bonus = status->flee2 + val*10;
- status->flee2 = cap_value(bonus, 0, USHRT_MAX);
+ status->flee2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_CRITICAL:
if(sd->state.lr_flag != 2) {
bonus = status->cri + val*10;
- status->cri = cap_value(bonus, 0, USHRT_MAX);
+ status->cri = cap_value(bonus, SHRT_MIN, SHRT_MAX);
} else
sd->arrow_cri += val*10;
break;