summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-08-22 16:59:09 -0300
committershennetsind <ind@henn.et>2013-08-22 16:59:09 -0300
commit7f9f6e1b84061a7d393debf37395c8b4a2667db1 (patch)
tree8bc09c3f8bc0ca5f7fa0ecaed9f3fa42829f67b5 /src/map/clif.c
parent02251a52a5f62122a54434399638dd7f66ea67d4 (diff)
downloadhercules-7f9f6e1b84061a7d393debf37395c8b4a2667db1.tar.gz
hercules-7f9f6e1b84061a7d393debf37395c8b4a2667db1.tar.bz2
hercules-7f9f6e1b84061a7d393debf37395c8b4a2667db1.tar.xz
hercules-7f9f6e1b84061a7d393debf37395c8b4a2667db1.zip
Fixed Bug #7652
damage storage has been changed from int32 to int64 within areas where it could otherwise modified beyond the limit and get screwed up, this solves all related problems within any skills, not only asura. http://hercules.ws/board/tracker/issue-7652-asura-strike-overdamage/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 2275f7bfe..2ab379e31 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4380,7 +4380,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
//Modifies the type of damage according to status changes [Skotlex]
//Aegis data specifies that: 4 endure against single hit sources, 9 against multi-hit.
-static inline int clif_calc_delay(int type, int div, int damage, int delay)
+static inline int clif_calc_delay(int type, int div, int64 damage, int delay)
{
return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type;
}
@@ -4388,7 +4388,7 @@ static inline int clif_calc_delay(int type, int div, int damage, int delay)
/*==========================================
* Estimates walk delay based on the damage criteria. [Skotlex]
*------------------------------------------*/
-int clif_calc_walkdelay(struct block_list *bl,int delay, int type, int damage, int div_) {
+int clif_calc_walkdelay(struct block_list *bl,int delay, int type, int64 damage, int div_) {
if (type == 4 || type == 9 || damage <=0)
return 0;
@@ -4423,7 +4423,7 @@ int clif_calc_walkdelay(struct block_list *bl,int delay, int type, int damage, i
/// 10 = critical hit
/// 11 = lucky dodge
/// 12 = (touch skill?)
-int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tick, int sdelay, int ddelay, int damage, int div, int type, int damage2)
+int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tick, int sdelay, int ddelay, int64 damage, int div, int type, int64 damage2)
{
unsigned char buf[33];
struct status_change *sc;
@@ -4435,7 +4435,9 @@ int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tic
nullpo_ret(src);
nullpo_ret(dst);
-
+
+ damage = cap_value(damage,INT_MIN,INT_MAX);
+ damage2 = cap_value(damage2,INT_MIN,INT_MAX);
type = clif_calc_delay(type,div,damage+damage2,ddelay);
sc = iStatus->get_sc(dst);
if(sc && sc->count) {
@@ -5106,7 +5108,7 @@ void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned
/// Skill attack effect and damage.
/// 0114 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.W <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL)
/// 01de <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.L <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL2)
-int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,int type)
+int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int64 damage,int div,uint16 skill_id,uint16 skill_lv,int type)
{
unsigned char buf[64];
struct status_change *sc;
@@ -5114,6 +5116,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int
nullpo_ret(src);
nullpo_ret(dst);
+ damage = cap_value(damage,INT_MIN,INT_MAX);
type = clif_calc_delay(type,div,damage,ddelay);
sc = iStatus->get_sc(dst);
if(sc && sc->count) {