summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c48
-rw-r--r--src/map/battle.h36
-rw-r--r--src/map/clif.c13
-rw-r--r--src/map/clif.h6
-rw-r--r--src/map/skill.c5
-rw-r--r--src/map/skill.h2
-rw-r--r--src/map/status.c73
-rw-r--r--src/map/status.h25
-rw-r--r--src/map/unit.c2
-rw-r--r--src/map/unit.h2
10 files changed, 109 insertions, 103 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index f72bdce06..f56488713 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -203,7 +203,7 @@ struct block_list* battle_getenemyarea(struct block_list *src, int x, int y, int
struct delay_damage {
int src_id;
int target_id;
- int damage;
+ int64 damage;
int delay;
unsigned short distance;
uint16 skill_lv;
@@ -261,7 +261,7 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) {
return 0;
}
-int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects)
+int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects)
{
struct delay_damage *dat;
struct status_change *sc;
@@ -323,7 +323,7 @@ int battle_attr_ratio(int atk_elem,int def_type, int def_lv)
* Added passing of the chars so that the status changes can affect it. [Skotlex]
* Note: Passing src/target == NULL is perfectly valid, it skips SC_ checks.
*------------------------------------------*/
-int battle_attr_fix(struct block_list *src, struct block_list *target, int damage,int atk_elem,int def_type, int def_lv)
+int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 damage,int atk_elem,int def_type, int def_lv)
{
struct status_change *sc=NULL, *tsc=NULL;
int ratio;
@@ -427,8 +427,8 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag
return damage*ratio/100;
}
#ifdef RENEWAL
-int battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, struct weapon_atk *watk, int nk, bool n_ele, short s_ele, short s_ele_, int size, int type, int flag, int flag2){ // [malufett]
- int damage, eatk = 0;
+int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, struct weapon_atk *watk, int nk, bool n_ele, short s_ele, short s_ele_, int size, int type, int flag, int flag2){ // [malufett]
+ int64 damage, eatk = 0;
struct status_change *sc;
struct map_session_data *sd;
@@ -501,9 +501,9 @@ int battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uin
*&16: Arrow attack but BOW, REVOLVER, RIFLE, SHOTGUN, GATLING or GRENADE type weapon not equipped (i.e. shuriken, kunai and venom knives not affected by DEX)
*/
#ifdef RENEWAL
-int battle_calc_base_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2)
+int64 battle_calc_base_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2)
{
- int damage, batk;
+ int64 damage, batk;
struct status_data *status = iStatus->get_status_data(src);
batk = battle->calc_elefix(src, bl, skill_id, skill_lv, iStatus->calc_batk(bl, iStatus->get_sc(src), status->batk, false), nk, n_ele, ELE_NEUTRAL, ELE_NEUTRAL, false, flag);
@@ -513,11 +513,11 @@ int battle_calc_base_damage(struct block_list *src, struct block_list *bl, uint1
else
damage = (batk << 1) + battle->calc_weapon_damage(src, bl, skill_id, skill_lv, &status->rhw, nk, n_ele, s_ele, s_ele_, status_get_size(bl), type, flag, flag2);
#else
-static int battle_calc_base_damage(struct status_data *status, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag)
+static int64 battle_calc_base_damage(struct status_data *status, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag)
{
unsigned int atkmin=0, atkmax=0;
short type = 0;
- int damage = 0;
+ int64 damage = 0;
if (!sd) { //Mobs/Pets
if(flag&4) {
@@ -594,7 +594,7 @@ static int battle_calc_base_damage(struct status_data *status, struct weapon_atk
return damage;
}
-int battle_calc_sizefix(struct map_session_data *sd, int damage, int type, int size, bool ignore){
+int64 battle_calc_sizefix(struct map_session_data *sd, int64 damage, int type, int size, bool ignore){
//SizeFix only for players
if (!(sd->special_state.no_sizefix || (ignore)))
damage = damage * ( type == EQI_HAND_L ? sd->left_weapon.atkmods[size] : sd->right_weapon.atkmods[size] ) / 100;
@@ -604,9 +604,9 @@ int battle_calc_sizefix(struct map_session_data *sd, int damage, int type, int s
/*==========================================
* Passive skill damages increases
*------------------------------------------*/
-int battle_addmastery(struct map_session_data *sd,struct block_list *target,int dmg,int type)
+int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,int64 dmg,int type)
{
- int damage,skill;
+ int64 damage,skill;
struct status_data *status = iStatus->get_status_data(target);
int weapon;
damage = dmg;
@@ -716,7 +716,7 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int
/*==========================================
* Calculates ATK masteries.
*------------------------------------------*/
-int battle_calc_masteryfix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int damage, int div, bool left, bool weapon){
+int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int div, bool left, bool weapon){
int skill, i;
struct status_change *sc;
struct map_session_data *sd;
@@ -842,7 +842,7 @@ int battle_calc_masteryfix(struct block_list *src, struct block_list *target, ui
/*==========================================
* Elemental attribute fix.
*------------------------------------------*/
-int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int damage, int nk, int n_ele, int s_ele, int s_ele_, bool left, int flag){
+int64 battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int nk, int n_ele, int s_ele, int s_ele_, bool left, int flag){
struct status_data *tstatus;
nullpo_ret(src);
@@ -891,7 +891,7 @@ int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16
* &1 - calc for left hand.
* &2 - atker side cardfix(BF_WEAPON) otherwise target side(BF_WEAPON).
*------------------------------------------*/
-int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int damage, int cflag, int wflag){
+int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int64 damage, int cflag, int wflag){
struct map_session_data *sd, *tsd;
short cardfix = 1000, t_class, s_class, s_race2, t_race2;
struct status_data *sstatus, *tstatus;
@@ -1194,7 +1194,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li
* &2 - pdef(Pierce defense)
* &4 - tdef(Total defense reduction)
*------------------------------------------*/
-int battle_calc_defense(int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int damage, int flag, int pdef){
+int battle_calc_defense(int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int flag, int pdef){
struct status_data *sstatus, *tstatus;
struct map_session_data *sd, *tsd;
struct status_change *sc, *tsc;
@@ -2525,7 +2525,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
* ATK may be MISS, BLOCKED FAIL, reduc, increase, end status...
* After this we apply bg/gvg reduction
*------------------------------------------*/
-int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int damage,uint16 skill_id,uint16 skill_lv)
+int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int64 damage,uint16 skill_id,uint16 skill_lv)
{
struct map_session_data *sd = NULL;
struct status_change *sc;
@@ -3065,7 +3065,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
/*==========================================
* Calculates BG related damage adjustments.
*------------------------------------------*/
-int battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int damage, int div_, uint16 skill_id, uint16 skill_lv, int flag)
+int64 battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int64 damage, int div_, uint16 skill_id, uint16 skill_lv, int flag)
{
if( !damage )
return 0;
@@ -3083,7 +3083,7 @@ int battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int dam
/*==========================================
* Calculates GVG related damage adjustments.
*------------------------------------------*/
-int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,uint16 skill_id,uint16 skill_lv,int flag)
+int64 battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int64 damage,int div_,uint16 skill_id,uint16 skill_lv,int flag)
{
struct mob_data* md = BL_CAST(BL_MOB, bl);
int class_ = iStatus->get_class(bl);
@@ -3136,7 +3136,7 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama
/*==========================================
* HP/SP drain calculation
*------------------------------------------*/
-int battle_calc_drain(int damage, int rate, int per) {
+int battle_calc_drain(int64 damage, int rate, int per) {
int diff = 0;
if (per && rnd()%1000 < rate) {
@@ -5027,7 +5027,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if( wd.damage + wd.damage2 )
{ //There is a total damage value
- int damage = wd.damage + wd.damage2, rdamage = 0, rdelay = 0;
+ int64 damage = wd.damage + wd.damage2, rdamage = 0, rdelay = 0;
if( src != target &&
(!skill_id || skill_id ||
@@ -5172,8 +5172,8 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl
}
//Calculates BF_WEAPON returned damage.
-int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int *dmg, int flag, uint16 skill_id, int *delay){
- int rdamage = 0, damage = *dmg, trdamage = 0;
+int64 battle_calc_return_damage(struct block_list* bl, struct block_list *src, int64 *dmg, int flag, uint16 skill_id, int64 *delay){
+ int64 rdamage = 0, damage = *dmg, trdamage = 0;
struct map_session_data* sd;
struct status_change* sc;
#ifdef RENEWAL
@@ -5342,7 +5342,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
struct map_session_data *sd = NULL, *tsd = NULL;
struct status_data *sstatus, *tstatus;
struct status_change *sc, *tsc;
- int damage;
+ int64 damage;
int skillv;
struct Damage wd;
diff --git a/src/map/battle.h b/src/map/battle.h
index 9d1e3276d..f52084b41 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -5,6 +5,8 @@
#ifndef _BATTLE_H_
#define _BATTLE_H_
+#include "../common/cbasetypes.h"
+
/**
* Declarations
**/
@@ -76,7 +78,7 @@ enum e_battle_check_target { //New definitions [Skotlex]
// dammage structure
struct Damage {
- int damage,damage2; //right, left dmg
+ int64 damage,damage2; //right, left dmg
int type,div_; //chk clif_damage for type @TODO add an enum ? ; nb of hit
int amotion,dmotion;
int blewcount; //nb of knockback
@@ -476,41 +478,41 @@ struct battle_interface {
/* damage calculation */
struct Damage (*calc_attack) (int attack_type, struct block_list *bl, struct block_list *target, uint16 skill_id, uint16 skill_lv, int count);
/* generic final damage calculation */
- int (*calc_damage) (struct block_list *src, struct block_list *bl, struct Damage *d, int damage, uint16 skill_id, uint16 skill_lv);
+ int64 (*calc_damage) (struct block_list *src, struct block_list *bl, struct Damage *d, int64 damage, uint16 skill_id, uint16 skill_lv);
/* gvg final damage calculation */
- int (*calc_gvg_damage) (struct block_list *src, struct block_list *bl, int damage, int div_, uint16 skill_id, uint16 skill_lv, int flag);
+ int64 (*calc_gvg_damage) (struct block_list *src, struct block_list *bl, int64 damage, int div_, uint16 skill_id, uint16 skill_lv, int flag);
/* battlegrounds final damage calculation */
- int (*calc_bg_damage) (struct block_list *src, struct block_list *bl, int damage, int div_, uint16 skill_id, uint16 skill_lv, int flag);
+ int64 (*calc_bg_damage) (struct block_list *src, struct block_list *bl, int64 damage, int div_, uint16 skill_id, uint16 skill_lv, int flag);
/* normal weapon attack */
enum damage_lv (*weapon_attack) (struct block_list *bl, struct block_list *target, unsigned int tick, int flag);
/* calculate weapon attack */
struct Damage (*calc_weapon_attack) (struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int wflag);
/* delays damage or skills by a timer */
- int (*delay_damage) (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects);
+ int (*delay_damage) (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects);
/* drain damage */
void (*drain) (struct map_session_data *sd, struct block_list *tbl, int rdamage, int ldamage, int race, int boss);
/* damage return/reflect */
- int (*calc_return_damage) (struct block_list *bl, struct block_list *src, int *, int flag, uint16 skill_id, int*);
+ int64 (*calc_return_damage) (struct block_list *bl, struct block_list *src, int64 *, int flag, uint16 skill_id, int64 *);
/* attribute rate */
int (*attr_ratio) (int atk_elem, int def_type, int def_lv);
/* applies attribute modifiers */
- int (*attr_fix) (struct block_list *src, struct block_list *target, int damage, int atk_elem, int def_type, int def_lv);
+ int64 (*attr_fix) (struct block_list *src, struct block_list *target, int64 damage, int atk_elem, int def_type, int def_lv);
/* applies card modifiers */
- int (*calc_cardfix) (int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int damage, int left, int flag);
+ int64 (*calc_cardfix) (int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int64 damage, int left, int flag);
/* applies element modifiers */
- int (*calc_elefix) (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int damage, int nk, int n_ele, int s_ele, int s_ele_, bool left, int flag);
+ int64 (*calc_elefix) (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int nk, int n_ele, int s_ele, int s_ele_, bool left, int flag);
/* applies mastery modifiers */
- int (*calc_masteryfix) (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int damage, int div, bool left, bool weapon);
- /* applies skill modifiers */
+ int64 (*calc_masteryfix) (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int div, bool left, bool weapon);
+ /* applies skill modifiers */
int (*calc_skillratio) (int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int skillratio, int flag);
/* applies size modifiers */
- int (*calc_sizefix) (struct map_session_data *sd, int damage, int type, int size, bool ignore);
+ int64 (*calc_sizefix) (struct map_session_data *sd, int64 damage, int type, int size, bool ignore);
#ifdef RENEWAL
/* get weapon damage */
- int (*calc_weapon_damage) (struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, struct weapon_atk *watk, int nk, bool n_ele, short s_ele, short s_ele_, int size, int type, int flag, int flag2);
+ int64 (*calc_weapon_damage) (struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, struct weapon_atk *watk, int nk, bool n_ele, short s_ele, short s_ele_, int size, int type, int flag, int flag2);
#endif
/* applies defense reductions */
- int (*calc_defense) (int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int damage, int flag, int pdef);
+ int (*calc_defense) (int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int flag, int pdef);
/* get master (who does this unit respond to?) */
struct block_list *(*get_master) (struct block_list *src);
/* returns a random unit who is targeting this unit */
@@ -536,7 +538,7 @@ struct battle_interface {
int (*blewcount_bonus) (struct map_session_data *sd, uint16 skill_id);
/* skill range criteria */
int (*range_type) (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv);
- int (*calc_base_damage)
+ int64 (*calc_base_damage)
#ifdef RENEWAL
(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2);
#else
@@ -545,8 +547,8 @@ struct battle_interface {
struct Damage (*calc_misc_attack) (struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag);
struct Damage (*calc_magic_attack) (struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag);
int (*adjust_skill_damage) (int m, unsigned short skill_id);
- int (*add_mastery) (struct map_session_data *sd,struct block_list *target,int dmg,int type);
- int (*calc_drain) (int damage, int rate, int per);
+ int64 (*add_mastery) (struct map_session_data *sd,struct block_list *target,int64 dmg,int type);
+ int (*calc_drain) (int64 damage, int rate, int per);
/* - battle_config */
int (*config_read) (const char *cfgName);
void (*config_set_defaults) (void);
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) {
diff --git a/src/map/clif.h b/src/map/clif.h
index 1161b3b6a..58230ce85 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -532,7 +532,7 @@ struct clif_interface {
void (*set_unit_idle2) (struct block_list* bl, struct map_session_data *tsd, enum send_target target);
#endif
void (*set_unit_walking) (struct block_list* bl, struct map_session_data *tsd,struct unit_data* ud, enum send_target target);
- int (*calc_walkdelay) (struct block_list *bl,int delay, int type, int damage, int div_);
+ int (*calc_walkdelay) (struct block_list *bl,int delay, int type, int64 damage, int div_);
void (*getareachar_skillunit) (struct map_session_data *sd, struct skill_unit *unit);
void (*getareachar_unit) (struct map_session_data* sd,struct block_list *bl);
void (*clearchar_skillunit) (struct skill_unit *unit, int fd);
@@ -570,7 +570,7 @@ struct clif_interface {
void (*scriptclear) (struct map_session_data *sd, int npcid);
/* client-user-interface-related */
void (*viewpoint) (struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color);
- int (*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 (*damage) (struct block_list* src, struct block_list* dst, unsigned int tick, int sdelay, int ddelay, int64 damage, int div, int type, int64 damage2);
void (*sitting) (struct block_list* bl);
void (*standing) (struct block_list* bl);
void (*arrow_create_list) (struct map_session_data *sd);
@@ -667,7 +667,7 @@ struct clif_interface {
void (*wedding_effect) (struct block_list *bl);
void (*divorced) (struct map_session_data* sd, const char* name);
void (*callpartner) (struct map_session_data *sd);
- int (*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 (*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);
int (*skill_nodamage) (struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail);
void (*skill_poseffect) (struct block_list *src,uint16 skill_id,int val,int x,int y,int tick);
void (*skill_estimation) (struct map_session_data *sd,struct block_list *dst);
diff --git a/src/map/skill.c b/src/map/skill.c
index 1b732baaa..9befc1d32 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2156,7 +2156,8 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
struct status_data *sstatus, *tstatus;
struct status_change *sc;
struct map_session_data *sd, *tsd;
- int type,damage;
+ int type;
+ int64 damage;
int8 rmdamage=0;//magic reflected
bool additional_effects = true;
@@ -12118,7 +12119,7 @@ int skill_unit_effect (struct block_list* bl, va_list ap) {
/*==========================================
*
*------------------------------------------*/
-int skill_unit_ondamaged (struct skill_unit *src, struct block_list *bl, int damage, unsigned int tick)
+int skill_unit_ondamaged (struct skill_unit *src, struct block_list *bl, int64 damage, unsigned int tick)
{
struct skill_unit_group *sg;
diff --git a/src/map/skill.h b/src/map/skill.h
index f9dbd0f1a..995874de4 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -1826,7 +1826,7 @@ struct skill_interface {
int (*clear_unitgroup) (struct block_list *src);
int (*clear_group) (struct block_list *bl, int flag);
int (*unit_onplace) (struct skill_unit *src, struct block_list *bl, unsigned int tick);
- int (*unit_ondamaged) (struct skill_unit *src,struct block_list *bl,int damage,unsigned int tick);
+ int (*unit_ondamaged) (struct skill_unit *src,struct block_list *bl,int64 damage,unsigned int tick);
int (*cast_fix) ( struct block_list *bl, uint16 skill_id, uint16 skill_lv);
int (*cast_fix_sc) ( struct block_list *bl, int time);
#ifdef RENEWAL_CAST
diff --git a/src/map/status.c b/src/map/status.c
index e7c3eaece..c79fff44e 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1120,10 +1120,10 @@ int status_set_sp(struct block_list *bl, unsigned int sp, int flag)
return status_zap(bl, 0, status->sp - sp);
}
-int status_charge(struct block_list* bl, int hp, int sp)
+int status_charge(struct block_list* bl, int64 hp, int64 sp)
{
if(!(bl->type&BL_CONSUME))
- return hp+sp; //Assume all was charged so there are no 'not enough' fails.
+ return (int)(hp+sp); //Assume all was charged so there are no 'not enough' fails.
return iStatus->damage(NULL, bl, hp, sp, 0, 3);
}
@@ -1132,11 +1132,14 @@ int status_charge(struct block_list* bl, int hp, int sp)
//If flag&2, fail if target does not has enough to substract.
//If flag&4, if killed, mob must not give exp/loot.
//flag will be set to &8 when damaging sp of a dead character
-int status_damage(struct block_list *src,struct block_list *target,int hp, int sp, int walkdelay, int flag)
-{
+int status_damage(struct block_list *src,struct block_list *target,int64 hp, int64 sp, int walkdelay, int flag) {
struct status_data *status;
struct status_change *sc;
+ /* here onwards we consider it a 32-type, the client does not support higher and from here onwards the value doesn't get thru percentage modifiers */
+ hp = cap_value(hp,INT_MIN,INT_MAX);
+ sp = cap_value(sp,INT_MIN,INT_MAX);
+
if(sp && !(target->type&BL_CONSUME))
sp = 0; //Not a valid SP target.
@@ -1254,7 +1257,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
{ //Still lives or has been dead before this damage.
if (walkdelay)
unit_set_walkdelay(target, iTimer->gettick(), walkdelay, 0);
- return hp+sp;
+ return (int)(hp+sp);
}
status->hp = 1; //To let the dead function cast skills and all that.
@@ -1275,7 +1278,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
}
if(!flag) //Death cancelled.
- return hp+sp;
+ return (int)(hp+sp);
//Normal death
status->hp = 0;
@@ -1310,7 +1313,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
if( target->type == BL_MOB )
((TBL_MOB*)target)->state.rebirth = 1;
- return hp+sp;
+ return (int)(hp+sp);
}
if(target->type == BL_PC){
TBL_PC *sd = BL_CAST(BL_PC,target);
@@ -1319,7 +1322,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
clif->skillcasting(&hd->bl, hd->bl.id, target->id, 0,0, MH_LIGHT_OF_REGENE, skill->get_ele(MH_LIGHT_OF_REGENE, 1), 10); //just to display usage
clif->skill_nodamage(&sd->bl, target, ALL_RESURRECTION, 1, iStatus->revive(&sd->bl,10*hd->sc.data[SC_LIGHT_OF_REGENE]->val1,0));
status_change_end(&sd->hd->bl,SC_LIGHT_OF_REGENE,INVALID_TIMER);
- return hp + sp;
+ return (int)(hp + sp);
}
}
if (target->type == BL_MOB && sc && sc->data[SC_REBIRTH] && !((TBL_MOB*) target)->state.rebirth) {// Ensure the monster has not already rebirthed before doing so.
@@ -1327,32 +1330,30 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
iStatus->change_clear(target,0);
((TBL_MOB*)target)->state.rebirth = 1;
- return hp+sp;
+ return (int)(hp+sp);
}
iStatus->change_clear(target,0);
if(flag&4) //Delete from memory. (also invokes map removal code)
unit_free(target,CLR_DEAD);
- else
- if(flag&2) //remove from map
- unit_remove_map(target,CLR_DEAD);
- else
- { //Some death states that would normally be handled by unit_remove_map
- unit_stop_attack(target);
- unit_stop_walking(target,1);
- unit_skillcastcancel(target,0);
- clif->clearunit_area(target,CLR_DEAD);
- skill->unit_move(target,iTimer->gettick(),4);
- skill->cleartimerskill(target);
- }
-
- return hp+sp;
+ else if(flag&2) //remove from map
+ unit_remove_map(target,CLR_DEAD);
+ else { //Some death states that would normally be handled by unit_remove_map
+ unit_stop_attack(target);
+ unit_stop_walking(target,1);
+ unit_skillcastcancel(target,0);
+ clif->clearunit_area(target,CLR_DEAD);
+ skill->unit_move(target,iTimer->gettick(),4);
+ skill->cleartimerskill(target);
+ }
+
+ return (int)(hp+sp);
}
//Heals a character. If flag&1, this is forced healing (otherwise stuff like Berserk can block it)
//If flag&2, when the player is healed, show the HP/SP heal effect.
-int status_heal(struct block_list *bl,int hp,int sp, int flag)
+int status_heal(struct block_list *bl,int64 hp,int64 sp, int flag)
{
struct status_data *status;
struct status_change *sc;
@@ -1362,6 +1363,10 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag)
if (status == &dummy_status || !status->hp)
return 0;
+ /* here onwards we consider it a 32-type, the client does not support higher and from here onwards the value doesn't get thru percentage modifiers */
+ hp = cap_value(hp,INT_MIN,INT_MAX);
+ sp = cap_value(sp,INT_MIN,INT_MAX);
+
sc = iStatus->get_sc(bl);
if (sc && !sc->count)
sc = NULL;
@@ -1410,14 +1415,14 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag)
// send hp update to client
switch(bl->type) {
- case BL_PC: pc->heal((TBL_PC*)bl,hp,sp,flag&2?1:0); break;
- case BL_MOB: mob_heal((TBL_MOB*)bl,hp); break;
- case BL_HOM: homun->healed((TBL_HOM*)bl); break;
- case BL_MER: mercenary->heal((TBL_MER*)bl,hp,sp); break;
- case BL_ELEM: elemental->heal((TBL_ELEM*)bl,hp,sp); break;
+ case BL_PC: pc->heal((TBL_PC*)bl,hp,sp,flag&2?1:0); break;
+ case BL_MOB: mob_heal((TBL_MOB*)bl,hp); break;
+ case BL_HOM: homun->healed((TBL_HOM*)bl); break;
+ case BL_MER: mercenary->heal((TBL_MER*)bl,hp,sp); break;
+ case BL_ELEM: elemental->heal((TBL_ELEM*)bl,hp,sp); break;
}
- return hp+sp;
+ return (int)(hp+sp);
}
//Does percentual non-flinching damage/heal. If mob is killed this way,
@@ -1513,11 +1518,13 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per
if (bl->prev) //Animation only if character is already on a map.
clif->resurrection(bl, 1);
+
switch (bl->type) {
- case BL_PC: pc->revive((TBL_PC*)bl, hp, sp); break;
- case BL_MOB: mob_revive((TBL_MOB*)bl, hp); break;
- case BL_HOM: homun->revive((TBL_HOM*)bl, hp, sp); break;
+ case BL_PC: pc->revive((TBL_PC*)bl, hp, sp); break;
+ case BL_MOB: mob_revive((TBL_MOB*)bl, hp); break;
+ case BL_HOM: homun->revive((TBL_HOM*)bl, hp, sp); break;
}
+
return 1;
}
diff --git a/src/map/status.h b/src/map/status.h
index 5f8a515f6..cae91849e 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -2,12 +2,14 @@
// For more information, see LICENCE in the main folder
#ifndef _STATUS_H_
#define _STATUS_H_
+
struct block_list;
struct mob_data;
struct pet_data;
struct homun_data;
struct mercenary_data;
struct status_change;
+
/**
* Max Refine available to your server
* Changing this limit requires edits to refine_db.txt
@@ -17,6 +19,7 @@ struct status_change;
#else
#define MAX_REFINE 10
#endif
+
enum refine_type {
REFINE_TYPE_ARMOR = 0,
REFINE_TYPE_WEAPON1 = 1,
@@ -25,6 +28,7 @@ enum refine_type {
REFINE_TYPE_WEAPON4 = 4,
REFINE_TYPE_MAX = 5
};
+
typedef enum sc_conf_type {
SC_NO_REM_DEATH = 0x1,
SC_NO_SAVE = 0x2,
@@ -34,7 +38,8 @@ typedef enum sc_conf_type {
SC_DEBUFF = 0x20,
SC_MADO_NO_RESET = 0x40
} sc_conf_type;
-// Status changes listing. These code are for use by the server.
+
+// Status changes listing. These code are for use by the server.
typedef enum sc_type {
SC_NONE = -1,
//First we enumerate common status ailments which are often used around.
@@ -1759,8 +1764,6 @@ struct status_change {
#define status_get_size(bl) iStatus->get_status_data(bl)->size
#define status_get_mode(bl) iStatus->get_status_data(bl)->mode
-
-
//Short version, receives rate in 1->100 range, and does not uses a flag setting.
#define sc_start(bl, type, rate, val1, tick) iStatus->change_start(bl,type,100*(rate),val1,0,0,0,tick,0)
#define sc_start2(bl, type, rate, val1, val2, tick) iStatus->change_start(bl,type,100*(rate),val1,val2,0,0,tick,0)
@@ -1777,16 +1780,6 @@ struct status_change {
#define status_calc_elemental(ed, first) iStatus->calc_bl_(&(ed)->bl, SCB_ALL, first)
#define status_calc_npc(nd, first) iStatus->calc_bl_(&(nd)->bl, SCB_ALL, first)
-
-
-
-
-
-#ifdef RENEWAL
-#endif
-
-
-
/*=====================================
* Interface : status.h
* Generated by HerculesInterfaceMaker
@@ -1809,14 +1802,14 @@ struct status_interface {
int (*type2relevant_bl_types) (int type);
int (*get_sc_type) (sc_type idx);
- int (*damage) (struct block_list *src,struct block_list *target,int hp,int sp, int walkdelay, int flag);
+ int (*damage) (struct block_list *src,struct block_list *target,int64 hp,int64 sp, int walkdelay, int flag);
//Define for standard HP/SP skill-related cost triggers (mobs require no HP/SP to use skills)
- int (*charge) (struct block_list* bl, int hp, int sp);
+ int (*charge) (struct block_list* bl, int64 hp, int64 sp);
int (*percent_change) (struct block_list *src,struct block_list *target,signed char hp_rate, signed char sp_rate, int flag);
//Used to set the hp/sp of an object to an absolute value (can't kill)
int (*set_hp) (struct block_list *bl, unsigned int hp, int flag);
int (*set_sp) (struct block_list *bl, unsigned int sp, int flag);
- int (*heal) (struct block_list *bl,int hp,int sp, int flag);
+ int (*heal) (struct block_list *bl,int64 hp,int64 sp, int flag);
int (*revive) (struct block_list *bl, unsigned char per_hp, unsigned char per_sp);
struct regen_data * (*get_regen_data) (struct block_list *bl);
diff --git a/src/map/unit.c b/src/map/unit.c
index 41d661169..22c7165e4 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2023,7 +2023,7 @@ int unit_counttargeted(struct block_list* bl)
/*==========================================
*
*------------------------------------------*/
-int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int tick,int sdelay,int ddelay,int damage,int div,int type,int damage2)
+int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int tick,int sdelay,int ddelay,int64 damage,int div,int type,int64 damage2)
{
nullpo_ret(target);
diff --git a/src/map/unit.h b/src/map/unit.h
index a4c7fc0cc..b743fc8cb 100644
--- a/src/map/unit.h
+++ b/src/map/unit.h
@@ -121,7 +121,7 @@ int unit_set_target(struct unit_data* ud, int target_id);
// unit_data の初期化処理
void unit_dataset(struct block_list *bl);
-int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int tick,int sdelay,int ddelay,int damage,int div,int type,int damage2);
+int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int tick,int sdelay,int ddelay,int64 damage,int div,int type,int64 damage2);
// その他
struct unit_data* unit_bl2ud(struct block_list *bl);
struct unit_data* unit_bl2ud2(struct block_list *bl);