summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-28 13:13:42 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-28 13:13:42 +0000
commit42920b57960ba73431fc71de217058a64c6a3871 (patch)
tree99ba2f6e76d284a43cd13ac94fdc00d317f5df5b /src/map/status.c
parent83a75b6e94e5092edbdce71ddf2cba16a747e4fc (diff)
downloadhercules-42920b57960ba73431fc71de217058a64c6a3871.tar.gz
hercules-42920b57960ba73431fc71de217058a64c6a3871.tar.bz2
hercules-42920b57960ba73431fc71de217058a64c6a3871.tar.xz
hercules-42920b57960ba73431fc71de217058a64c6a3871.zip
- Applied the required changes to handle def as a signed char (allows for negative def)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11837 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/map/status.c b/src/map/status.c
index b7e13f870..68579b059 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -3577,7 +3577,7 @@ static signed short status_calc_flee2(struct block_list *bl, struct status_chang
static signed char status_calc_def(struct block_list *bl, struct status_change *sc, int def)
{
if(!sc || !sc->count)
- return cap_value(def,0,CHAR_MAX);
+ return (signed char)cap_value(def,CHAR_MIN,CHAR_MAX);
if(sc->data[SC_BERSERK])
return 0;
@@ -3616,7 +3616,7 @@ static signed char status_calc_def(struct block_list *bl, struct status_change *
if (sc->data[SC_FLING])
def -= def * (sc->data[SC_FLING]->val2)/100;
- return (char)cap_value(def,0,CHAR_MAX);
+ return (signed char)cap_value(def,CHAR_MIN,CHAR_MAX);
}
static signed short status_calc_def2(struct block_list *bl, struct status_change *sc, int def2)
@@ -3656,7 +3656,7 @@ static signed short status_calc_def2(struct block_list *bl, struct status_change
static signed char status_calc_mdef(struct block_list *bl, struct status_change *sc, int mdef)
{
if(!sc || !sc->count)
- return cap_value(mdef,0,CHAR_MAX);
+ return (signed char)cap_value(mdef,CHAR_MIN,CHAR_MAX);
if(sc->data[SC_BERSERK])
return 0;
@@ -3677,7 +3677,7 @@ static signed char status_calc_mdef(struct block_list *bl, struct status_change
if(sc->data[SC_INCMDEFRATE])
mdef += mdef * sc->data[SC_INCMDEFRATE]->val1/100;
- return (char)cap_value(mdef,0,CHAR_MAX);
+ return (signed char)cap_value(mdef,CHAR_MIN,CHAR_MAX);
}
static signed short status_calc_mdef2(struct block_list *bl, struct status_change *sc, int mdef2)
@@ -4111,7 +4111,7 @@ unsigned short status_get_lwatk2(struct block_list *bl)
return status->lhw?status->lhw->atk2:0;
}
-unsigned char status_get_def(struct block_list *bl)
+signed char status_get_def(struct block_list *bl)
{
struct unit_data *ud;
struct status_data *status = status_get_status_data(bl);
@@ -4119,8 +4119,7 @@ unsigned char status_get_def(struct block_list *bl)
ud = unit_bl2ud(bl);
if (ud && ud->skilltimer != -1)
def -= def * skill_get_castdef(ud->skillid)/100;
- if(def < 0) def = 0;
- return def;
+ return cap_value(def, CHAR_MIN, CHAR_MAX);
}
unsigned short status_get_speed(struct block_list *bl)