summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-13 13:55:58 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-13 13:55:58 +0000
commitae767a27120e38599f9e8efc4ada221e9840b6cb (patch)
tree04ae8335b606f2269ce8521431df03bfbc337c27 /src/map/pc.c
parentf73f7e4fe1814ab75145ee3984082c3a0b5ad116 (diff)
downloadhercules-ae767a27120e38599f9e8efc4ada221e9840b6cb.tar.gz
hercules-ae767a27120e38599f9e8efc4ada221e9840b6cb.tar.bz2
hercules-ae767a27120e38599f9e8efc4ada221e9840b6cb.tar.xz
hercules-ae767a27120e38599f9e8efc4ada221e9840b6cb.zip
- Fixed the value range checks added by Zido on pc_bonus (some of them were even redundant...)
- Fixed script command "recovery". git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7654 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c66
1 files changed, 28 insertions, 38 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 8402c1fa8..ebe80b90c 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1267,80 +1267,72 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
break;
case SP_ATK1:
if(!sd->state.lr_flag) {
- if(!(val<0 && ((val-val-val)>status->rhw.atk)))
- status->rhw.atk+=val;
+ bonus = status->rhw.atk + val;
+ status->rhw.atk = cap_value(bonus, 0, USHRT_MAX);
}
else if(sd->state.lr_flag == 1) {
- if(!(val<0 && ((val-val-val)>status->lhw->atk)))
- status->lhw->atk+=val;
+ bonus = status->lhw->atk + val;
+ status->lhw->atk = cap_value(bonus, 0, USHRT_MAX);
}
break;
case SP_ATK2:
if(!sd->state.lr_flag) {
- if(!(val<0 && ((val-val-val)>status->rhw.atk2)))
- status->rhw.atk2+=val;
+ bonus = status->rhw.atk2 + val;
+ status->rhw.atk2 = cap_value(bonus, 0, USHRT_MAX);
}
else if(sd->state.lr_flag == 1) {
- if(!(val<0 && ((val-val-val)>status->lhw->atk2)))
- status->lhw->atk2+=val;
+ bonus = status->lhw->atk2 + val;
+ status->lhw->atk2 = cap_value(bonus, 0, USHRT_MAX);
}
break;
case SP_BASE_ATK:
if(sd->state.lr_flag != 2) {
- if(!(val<0 && ((val-val-val)>status->batk)))
- status->batk+=val;
+ bonus = status->batk + val;
+ status->batk = cap_value(bonus, 0, USHRT_MAX);
}
break;
case SP_MATK1:
if(sd->state.lr_flag != 2) {
- if(!(val<0 && ((val-val-val)>status->matk_max)))
- status->matk_max += val;
+ bonus = status->matk_max + val;
+ status->matk_max = cap_value(bonus, 0, USHRT_MAX);
}
break;
case SP_MATK2:
if(sd->state.lr_flag != 2) {
- if(!(val<0 && ((val-val-val)>status->matk_min)))
- status->matk_min += val;
+ bonus = status->matk_min + val;
+ status->matk_min = cap_value(bonus, 0, USHRT_MAX);
}
break;
case SP_MATK:
if(sd->state.lr_flag != 2) {
- if(!(val<0 && ((val-val-val)>status->matk_max)))
- status->matk_max += val;
- if(!(val<0 && ((val-val-val)>status->matk_min)))
- status->matk_min += val;
+ bonus = status->matk_max + val;
+ status->matk_max = cap_value(bonus, 0, USHRT_MAX);
+ bonus = status->matk_min + val;
+ status->matk_min = cap_value(bonus, 0, USHRT_MAX);
}
break;
case SP_DEF1:
if(sd->state.lr_flag != 2) {
- if(!(val<0 && ((val-val-val)>status->def))) {
- bonus = status->def + val;
- status->def = cap_value(bonus, CHAR_MIN, CHAR_MAX);
- }
+ bonus = status->def + val;
+ status->def = cap_value(bonus, CHAR_MIN, CHAR_MAX);
}
break;
case SP_DEF2:
if(sd->state.lr_flag != 2) {
- if(!(val<0 && ((val-val-val)>status->def2))) {
- bonus = status->def2 + val;
- status->def2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
- }
+ bonus = status->def2 + val;
+ status->def2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_MDEF1:
if(sd->state.lr_flag != 2) {
- if(!(val<0 && ((val-val-val)>status->mdef))) {
- bonus = status->mdef + val;
- status->mdef = cap_value(bonus, CHAR_MIN, CHAR_MAX);
- }
+ bonus = status->mdef + val;
+ status->mdef = cap_value(bonus, CHAR_MIN, CHAR_MAX);
}
break;
case SP_MDEF2:
if(sd->state.lr_flag != 2) {
- if(!(val<0 && ((val-val-val)>status->mdef2))) {
- bonus = status->mdef2 + val;
- status->mdef2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
- }
+ bonus = status->mdef2 + val;
+ status->mdef2 = cap_value(bonus, SHRT_MIN, SHRT_MAX);
}
break;
case SP_HIT:
@@ -1692,14 +1684,12 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
}
break;
case SP_PERFECT_HIDE: // [Valaris]
- if(sd->state.lr_flag!=2) {
+ if(sd->state.lr_flag!=2)
sd->state.perfect_hiding=1;
- }
break;
case SP_UNBREAKABLE:
- if(sd->state.lr_flag!=2) {
+ if(sd->state.lr_flag!=2)
sd->unbreakable += val;
- }
break;
case SP_UNBREAKABLE_WEAPON:
if(sd->state.lr_flag != 2)