summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-17 22:36:02 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-17 22:36:02 +0000
commitdb231e817c5f6d6783b07d91e1d8b0d1243829dd (patch)
tree853852da1f15559d5b43004476241a193c12ae44 /src/map/status.c
parent472eb3bd0d8598c2230fc1d8959fcc7e0a450cac (diff)
downloadhercules-db231e817c5f6d6783b07d91e1d8b0d1243829dd.tar.gz
hercules-db231e817c5f6d6783b07d91e1d8b0d1243829dd.tar.bz2
hercules-db231e817c5f6d6783b07d91e1d8b0d1243829dd.tar.xz
hercules-db231e817c5f6d6783b07d91e1d8b0d1243829dd.zip
- Updated Eye of Hellion to use the new format of the input command.
- corrected login_fd/char_fd being uninitialized in the char servers. - Changed a bit around how status_base_atk works to avoid overflows. - Added a check to prevent using consume-delay items when you cannot use skills, since that opens an exploit if the item also has non-skill-casting components to its script. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12214 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/map/status.c b/src/map/status.c
index 015ce1ddf..d4836919f 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1226,7 +1226,7 @@ int status_base_amotion_pc(struct map_session_data* sd, struct status_data* stat
return amotion;
}
-static int status_base_atk(struct block_list *bl, struct status_data *status)
+static unsigned short status_base_atk(struct block_list *bl, struct status_data *status)
{
int flag = 0, str, dex, dstr;
@@ -1259,7 +1259,7 @@ static int status_base_atk(struct block_list *bl, struct status_data *status)
str += dstr*dstr;
if (bl->type == BL_PC)
str+= dex/5 + status->luk/5;
- return str;
+ return cap_value(str, 0, USHRT_MAX);
}
#define status_base_matk_max(status) (status->int_+(status->int_/5)*(status->int_/5))
@@ -1293,7 +1293,11 @@ void status_calc_misc(struct block_list *bl, struct status_data *status, int lev
else
status->flee2 = 0;
- status->batk += status_base_atk(bl, status);
+ if (status->batk) {
+ int temp = status->batk + status_base_atk(bl, status);
+ status->batk = cap_value(temp, 0, USHRT_MAX);
+ } else
+ status->batk = status_base_atk(bl, status);
if (status->cri)
switch (bl->type) {
case BL_MOB:
@@ -3004,7 +3008,10 @@ void status_calc_bl(struct block_list *bl, unsigned long flag)
status->batk = status_base_atk(bl,status);
temp = b_status->batk - status_base_atk(bl,b_status);
if (temp)
- status->batk += temp;
+ {
+ temp += status->batk;
+ status->batk = cap_value(temp, 0, USHRT_MAX);
+ }
status->batk = status_calc_batk(bl, sc, status->batk);
}