summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c17
-rw-r--r--src/map/atcommand.h6
-rw-r--r--src/map/battle.c246
-rw-r--r--src/map/battle.h4
-rw-r--r--src/map/clif.c213
-rw-r--r--src/map/clif.h15
-rw-r--r--src/map/mob.c20
-rw-r--r--src/map/packets_struct.h39
-rw-r--r--src/map/script.c5
-rw-r--r--src/map/skill.c22
-rw-r--r--src/map/status.c16
-rw-r--r--src/map/unit.c4
-rw-r--r--src/map/unit.h2
13 files changed, 400 insertions, 209 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 5c31155b1..c355f6bbd 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -72,8 +72,7 @@ struct atcmd_binding_data* get_atcommandbind_byname(const char* name) {
//-----------------------------------------------------------
// Return the message string of the specified number by [Yor]
//-----------------------------------------------------------
-const char* msg_txt(int msg_number)
-{
+const char* atcommand_msg(int msg_number) {
if (msg_number >= 0 && msg_number < MAX_MSG &&
atcommand->msg_table[msg_number] != NULL && atcommand->msg_table[msg_number][0] != '\0')
return atcommand->msg_table[msg_number];
@@ -1053,7 +1052,7 @@ ACMD(heal)
if ( hp < 0 && sp <= 0 ) {
status->damage(NULL, &sd->bl, -hp, -sp, 0, 0);
- clif->damage(&sd->bl,&sd->bl, timer->gettick(), 0, 0, -hp, 0, 4, 0);
+ clif->damage(&sd->bl,&sd->bl, 0, 0, -hp, 0, 4, 0);
clif->message(fd, msg_txt(156)); // HP or/and SP modified.
return true;
}
@@ -1064,7 +1063,7 @@ ACMD(heal)
status->heal(&sd->bl, hp, 0, 0);
else {
status->damage(NULL, &sd->bl, -hp, 0, 0, 0);
- clif->damage(&sd->bl,&sd->bl, timer->gettick(), 0, 0, -hp, 0, 4, 0);
+ clif->damage(&sd->bl,&sd->bl, 0, 0, -hp, 0, 4, 0);
}
}
@@ -1927,12 +1926,7 @@ ACMD(monster)
clif->message(fd, msg_txt(40)); // Invalid monster ID or name.
return false;
}
-
- if (mob_id == MOBID_EMPERIUM) {
- clif->message(fd, msg_txt(83)); // Monster 'Emperium' cannot be spawned.
- return false;
- }
-
+
if (number <= 0)
number = 1;
@@ -1957,7 +1951,7 @@ ACMD(monster)
range = (int)sqrt((float)number) +2; // calculation of an odd number (+ 4 area around)
for (i = 0; i < number; i++) {
map->search_freecell(&sd->bl, 0, &mx, &my, range, range, 0);
- k = mob->once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, eventname, size, AI_NONE);
+ k = mob->once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, eventname, size, AI_NONE|(mob_id == MOBID_EMPERIUM?0x200:0x0));
count += (k != 0) ? 1 : 0;
}
@@ -10240,4 +10234,5 @@ void atcommand_defaults(void) {
atcommand->doload = atcommand_doload;
atcommand->base_commands = atcommand_basecommands;
atcommand->add = atcommand_add;
+ atcommand->msg = atcommand_msg;
}
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index d01f00d8e..ab48b2ca6 100644
--- a/src/map/atcommand.h
+++ b/src/map/atcommand.h
@@ -21,7 +21,7 @@ struct block_list;
**/
#define ATCOMMAND_LENGTH 50
#define MAX_MSG 1500
-
+#define msg_txt(idx) atcommand->msg(idx)
/**
* Enumerations
**/
@@ -111,13 +111,11 @@ struct atcommand_interface {
void (*doload) (void);
void (*base_commands) (void);
bool (*add) (char *name, AtCommandFunc func, bool replace);
+ const char* (*msg) (int msg_number);
};
struct atcommand_interface *atcommand;
-/* will remain outside for a while, we have plans for this little fellow */
-const char* msg_txt(int msg_number);
-
void atcommand_defaults(void);
/* stay here */
diff --git a/src/map/battle.c b/src/map/battle.c
index 5666e37fa..d65bb910f 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -2602,16 +2602,15 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
struct skill_unit_group* group = skill->id2group(sc->data[SC_SAFETYWALL]->val3);
uint16 skill_id = sc->data[SC_SAFETYWALL]->val2;
if (group) {
+ d->dmg_lv = ATK_BLOCK;
if(skill_id == MH_STEINWAND){
if (--group->val2<=0)
skill->del_unitgroup(group,ALC_MARK);
- d->dmg_lv = ATK_BLOCK;
return 0;
}
/**
* in RE, SW possesses a lifetime equal to 3 times the caster's health
**/
- d->dmg_lv = ATK_BLOCK;
#ifdef RENEWAL
if ( ( group->val2 - damage) > 0 ) {
group->val2 -= (int)cap_value(damage,INT_MIN,INT_MAX);
@@ -4994,11 +4993,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
- int64 rdamage = 0;
-
- if( src != target ) { // Don't reflect your own damage (Grand Cross)
- rdamage = battle->calc_return_damage(target, src, wd.damage + wd.damage2, wd.flag, skill_id);
- }
+ int64 damage = wd.damage + wd.damage2;
if(!wd.damage2) {
wd.damage = battle->calc_damage(src,target,&wd,wd.damage,skill_id,skill_lv);
@@ -5031,35 +5026,22 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
#endif
}
- if( rdamage && wd.dmg_lv >= ATK_BLOCK ) {/* yes block still applies, somehow gravity thinks it makes sense. */
-
- if( tsc && tsc->data[SC_DEATHBOUND] ) {
- wd.damage = wd.damage + wd.damage2;
+ if( src != target ) { // Don't reflect your own damage (Grand Cross)
+
+ if( wd.dmg_lv == ATK_MISS || wd.dmg_lv == ATK_BLOCK ) {
+ int64 prev1 = wd.damage, prev2 = wd.damage2;
+
+ wd.damage = damage;
wd.damage2 = 0;
- status_change_end(target,SC_DEATHBOUND,INVALID_TIMER);
- }
-
- if( tsc && tsc->data[SC_LG_REFLECTDAMAGE] ) {
- bool change = false;
- if( sd && !sd->state.autocast )
- change = true;
- if( change )
- sd->state.autocast = 1;
- map->foreachinshootrange(battle->damage_area,target,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,timer->gettick(),target,wd.amotion,sstatus->dmotion,rdamage,tstatus->race);
- if( change )
- sd->state.autocast = 0;
- } else {
- int rdelay;
-
- rdelay = clif->damage(src, src, timer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4, 0);
-
- //Use Reflect Shield to signal this kind of skill trigger. [Skotlex]
- if( tsd )
- battle->drain(tsd, src, rdamage, rdamage, sstatus->race, is_boss(src));
- battle->delay_damage(timer->gettick(), wd.amotion,target,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
- skill->additional_effect(target, src, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,timer->gettick());
- }
-
+
+ battle->reflect_damage(target, src, &wd, skill_id);
+
+ wd.damage = prev1;
+ wd.damage2 = prev2;
+
+ } else
+ battle->reflect_damage(target, src, &wd, skill_id);
+
}
}
@@ -5073,7 +5055,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
rnd()%100 < tsc->data[SC_SWORDREJECT]->val2
) {
ATK_RATER(50);
- status_fix_damage(target,src,wd.damage,clif->damage(target,src,timer->gettick(),0,0,wd.damage,0,0,0));
+ status_fix_damage(target,src,wd.damage,clif->damage(target,src,0,0,wd.damage,0,0,0));
clif->skill_nodamage(target,target,ST_REJECTSWORD,tsc->data[SC_SWORDREJECT]->val1,1);
if( --(tsc->data[SC_SWORDREJECT]->val3) <= 0 )
status_change_end(target, SC_SWORDREJECT, INVALID_TIMER);
@@ -5134,20 +5116,24 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl
d.dmg_lv = ATK_DEF;
return d;
}
-
-//Calculates BF_WEAPON returned damage.
-int64 battle_calc_return_damage(struct block_list *target, struct block_list *src, int64 damage, int flag, uint16 skill_id){
- int64 rdamage = 0, trdamage = 0;
- struct map_session_data* sd;
- struct status_change* sc;
+//Performs reflect damage (magic (maya) is performed over skill.c).
+void battle_reflect_damage(struct block_list *target, struct block_list *src, struct Damage *wd,uint16 skill_id) {
+ int64 damage = wd->damage + wd->damage2, rdamage = 0, trdamage = 0;
+ struct map_session_data *sd, *tsd;
+ struct status_change *sc;
+ int64 tick = timer->gettick();
+ int delay = 50, rdelay = 0;
#ifdef RENEWAL
int max_reflect_damage;
-
+
max_reflect_damage = max(status_get_max_hp(target), status_get_max_hp(target) * status->get_lv(target) / 100);
#endif
- sd = BL_CAST(BL_PC, target);
+
+ sd = BL_CAST(BL_PC, src);
+
+ tsd = BL_CAST(BL_PC, target);
sc = status->get_sc(target);
-
+
#ifdef RENEWAL
#define NORMALIZE_RDAMAGE(d) ( trdamage += rdamage = max(1, min(max_reflect_damage, (d))) )
#else
@@ -5158,82 +5144,138 @@ int64 battle_calc_return_damage(struct block_list *target, struct block_list *sr
sc = NULL;
if( sc ) {
-
+
if( sc->data[SC_CRESCENTELBOW] && !is_boss(src) && rnd()%100 < sc->data[SC_CRESCENTELBOW]->val2 ){
//ATK [{(Target HP / 100) x Skill Level} x Caster Base Level / 125] % + [Received damage x {1 + (Skill Level x 0.2)}]
int ratio = (status_get_hp(src) / 100) * sc->data[SC_CRESCENTELBOW]->val1 * status->get_lv(target) / 125;
if (ratio > 5000) ratio = 5000; // Maximum of 5000% ATK
rdamage = rdamage * ratio / 100 + (damage) * (10 + sc->data[SC_CRESCENTELBOW]->val1 * 20 / 10) / 10;
skill->blown(target, src, skill->get_blewcount(SR_CRESCENTELBOW_AUTOSPELL, sc->data[SC_CRESCENTELBOW]->val1), unit->getdir(src), 0);
- clif->skill_damage(target, src, timer->gettick(), status_get_amotion(src), 0, rdamage,
- 1, SR_CRESCENTELBOW_AUTOSPELL, sc->data[SC_CRESCENTELBOW]->val1, 6); // This is how official does
- clif->damage(src, target, timer->gettick(), status_get_amotion(src)+1000, 0, rdamage/10, 1, 0, 0);
+ clif->skill_damage(target, src, tick, status_get_amotion(src), 0, rdamage,
+ 1, SR_CRESCENTELBOW_AUTOSPELL, sc->data[SC_CRESCENTELBOW]->val1, 6); // This is how official does
+ clif->delay_damage(tick + delay, src, target,status_get_amotion(src)+1000,0, rdamage/10, 1, 0);
status->damage(src, target, status->damage(target, src, rdamage, 0, 0, 1)/10, 0, 0, 1);
status_change_end(target, SC_CRESCENTELBOW, INVALID_TIMER);
- return 0; // Just put here to minimize redundancy
+ /* shouldn't this trigger skill->additional_effect? */
+ return; // Just put here to minimize redundancy
}
-
- if( sc->data[SC_KYOMU] && !sc->data[SC_DEATHBOUND] ){
- // Nullify reflecting ability
- return 0;
- }
-
- }
-
- if( flag & BF_SHORT) {//Bounces back part of the damage.
- if ( sd && sd->bonus.short_weapon_damage_return ) {
- NORMALIZE_RDAMAGE(damage * sd->bonus.short_weapon_damage_return / 100);
- }
- if( sc ) {
- if( sc->data[SC_REFLECTSHIELD] && skill_id != WS_CARTTERMINATION ){
- int64 t = damage * sc->data[SC_REFLECTSHIELD]->val2 / 100;
-
- if (flag & BF_SKILL) {
- if (flag&BF_WEAPON)
- t = t * map->list[src->m].weapon_damage_rate / 100;
- if (flag&BF_MISC)
- t = t * map->list[src->m].misc_damage_rate / 100;
- } else {
- if (flag & BF_SHORT)
- t = t * map->list[src->m].short_damage_rate / 100;
- }
-
- NORMALIZE_RDAMAGE(t);
- }
- if( sc->data[SC_LG_REFLECTDAMAGE] && rand()%100 < (30 + 10*sc->data[SC_LG_REFLECTDAMAGE]->val1) ) {
- NORMALIZE_RDAMAGE(damage * sc->data[SC_LG_REFLECTDAMAGE]->val2 / 100);
- }
-
+
+ if( wd->flag & BF_SHORT ) {
if( !is_boss(src) ) {
-
if( sc->data[SC_DEATHBOUND] && skill_id != WS_CARTTERMINATION ) {
uint8 dir = map->calc_dir(target,src->x,src->y),
- t_dir = unit->getdir(target);
-
+ t_dir = unit->getdir(target);
+
if( !map->check_dir(dir,t_dir) ) {
int64 rd1 = damage * sc->data[SC_DEATHBOUND]->val2 / 100; // Amplify damage.
+
trdamage += rdamage = rd1 - (damage = rd1 * 30 / 100); // not normalized as intended.
- clif->skill_damage(src, target, timer->gettick(), status_get_amotion(src), 0, -3000, 1, RK_DEATHBOUND, sc->data[SC_DEATHBOUND]->val1, 6);
+ rdelay = clif->skill_damage(src, target, tick, status_get_amotion(src), status_get_dmotion(src), -3000, 1, RK_DEATHBOUND, sc->data[SC_DEATHBOUND]->val1, 6);
skill->blown(target, src, skill->get_blewcount(RK_DEATHBOUND, sc->data[SC_DEATHBOUND]->val1), unit->getdir(src), 0);
+
+ if( tsd ) /* is this right? rdamage as both left and right? */
+ battle->drain(tsd, src, rdamage, rdamage, status_get_race(src), 0);
+ battle->delay_damage(tick, wd->amotion,target,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
+
+ delay += 100;/* gradual increase so the numbers don't clip in the client */
}
+ wd->damage = wd->damage + wd->damage2;
+ wd->damage2 = 0;
+ status_change_end(target,SC_DEATHBOUND,INVALID_TIMER);
}
+ }
+ }
+
+ if( sc->data[SC_KYOMU] ){
+ // Nullify reflecting ability of the conditions onwards
+ return;
+ }
+
+ }
+
+ if( wd->flag & BF_SHORT ) {
+ if ( tsd && tsd->bonus.short_weapon_damage_return ) {
+ NORMALIZE_RDAMAGE(damage * tsd->bonus.short_weapon_damage_return / 100);
+
+ rdelay = clif->delay_damage(tick+delay,src, src, status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4);
+
+ /* is this right? rdamage as both left and right? */
+ battle->drain(tsd, src, rdamage, rdamage, status_get_race(src), 0);
+ battle->delay_damage(tick, wd->amotion,target,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
+
+ delay += 100;/* gradual increase so the numbers don't clip in the client */
+ }
+
+ if( sc && wd->dmg_lv >= ATK_BLOCK ) {/* yes block still applies, somehow gravity thinks it makes sense. */
+ if( sc->data[SC_REFLECTSHIELD] && skill_id != WS_CARTTERMINATION ) {
+ NORMALIZE_RDAMAGE(damage * sc->data[SC_REFLECTSHIELD]->val2 / 100);
+
+#ifndef RENEWAL
+ rdelay = clif->delay_damage(tick+delay,src, src, status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4);
+#else
+ rdelay = clif->skill_damage(src, src, tick, delay, status_get_dmotion(src), rdamage, 1, CR_REFLECTSHIELD, 1, 4);
+#endif
+ /* is this right? rdamage as both left and right? */
+ if( tsd )
+ battle->drain(tsd, src, rdamage, rdamage, status_get_race(src), 0);
+ battle->delay_damage(tick, wd->amotion,target,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
+
+ delay += 100;/* gradual increase so the numbers don't clip in the client */
+ }
+ if( sc->data[SC_LG_REFLECTDAMAGE] && rand()%100 < (30 + 10*sc->data[SC_LG_REFLECTDAMAGE]->val1) ) {
+ bool change = false;
+
+ NORMALIZE_RDAMAGE(damage * sc->data[SC_LG_REFLECTDAMAGE]->val2 / 100);
- if( sc->data[SC_SHIELDSPELL_DEF] && sc->data[SC_SHIELDSPELL_DEF]->val1 == 2 ){
- NORMALIZE_RDAMAGE(damage * sc->data[SC_SHIELDSPELL_DEF]->val2 / 100);
+ trdamage -= rdamage;/* wont count towards total */
+
+ if( sd && !sd->state.autocast ) {
+ change = true;
+ sd->state.autocast = 1;
}
+ map->foreachinshootrange(battle->damage_area,target,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,target,delay,wd->dmotion,rdamage,status_get_race(target));
+
+ if( change )
+ sd->state.autocast = 0;
+
+ delay += 150;/* gradual increase so the numbers don't clip in the client */
+ }
+ if( sc->data[SC_SHIELDSPELL_DEF] && sc->data[SC_SHIELDSPELL_DEF]->val1 == 2 ){
+ NORMALIZE_RDAMAGE(damage * sc->data[SC_SHIELDSPELL_DEF]->val2 / 100);
+
+ rdelay = clif->delay_damage(tick+delay,src, src, status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4);
+
+ /* is this right? rdamage as both left and right? */
+ if( tsd )
+ battle->drain(tsd, src, rdamage, rdamage, status_get_race(src), 0);
+ battle->delay_damage(tick, wd->amotion,target,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
+
+ delay += 100;/* gradual increase so the numbers don't clip in the client */
}
}
- } else {
- if (sd && sd->bonus.long_weapon_damage_return){
- NORMALIZE_RDAMAGE(damage * sd->bonus.long_weapon_damage_return / 100);
+ } else {/* long */
+ if ( tsd && tsd->bonus.long_weapon_damage_return ) {
+ NORMALIZE_RDAMAGE(damage * tsd->bonus.long_weapon_damage_return / 100);
+
+ rdelay = clif->delay_damage(tick+delay,src, src, status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4);
+
+ /* is this right? rdamage as both left and right? */
+ battle->drain(tsd, src, rdamage, rdamage, status_get_race(src), 0);
+ battle->delay_damage(tick, wd->amotion,target,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
+
+ delay += 100;/* gradual increase so the numbers don't clip in the client */
}
}
-
- return max(0, trdamage);
+
+ /* something caused reflect */
+ if( trdamage ) {
+ skill->additional_effect(target, src, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick);
+ }
+
+ return;
#undef NORMALIZE_RDAMAGE
}
-
void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int boss)
{
struct weapon_data *wd;
@@ -5308,7 +5350,7 @@ int battle_damage_area(struct block_list *bl, va_list ap) {
battle->delay_damage(tick, amotion,src,bl,0,CR_REFLECTSHIELD,0,damage,ATK_DEF,0,true);
else
status_fix_damage(src,bl,damage,0);
- clif->damage(bl,bl,tick,amotion,dmotion,damage,1,ATK_BLOCK,0);
+ clif->damage(bl,bl,amotion,dmotion,damage,1,ATK_BLOCK,0);
if( !(src && src->type == BL_PC && ((TBL_PC*)src)->state.autocast) )
skill->additional_effect(src, bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick);
map->freeblock_unlock();
@@ -5397,7 +5439,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
if(dist <= 0 || (!map->check_dir(dir,t_dir) && dist <= tstatus->rhw.range+1)) {
uint16 skill_lv = tsc->data[SC_AUTOCOUNTER]->val1;
clif->skillcastcancel(target); //Remove the casting bar. [Skotlex]
- clif->damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
+ clif->damage(src, target, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
status_change_end(target, SC_AUTOCOUNTER, INVALID_TIMER);
skill->attack(BF_WEAPON,target,target,src,KN_AUTOCOUNTER,skill_lv,tick,0);
return ATK_BLOCK;
@@ -5411,7 +5453,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
status_change_end(target, SC_BLADESTOP_WAIT, INVALID_TIMER);
if(sc_start4(src, SC_BLADESTOP, 100, sd?pc->checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration)) {
//Target locked.
- clif->damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
+ clif->damage(src, target, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
clif->bladestop(target, src->id, 1);
sc_start4(target, SC_BLADESTOP, 100, skill_lv, 0, 0, src->id, duration);
return ATK_BLOCK;
@@ -5518,7 +5560,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
}
}
- wd.dmotion = clif->damage(src, target, tick, wd.amotion, wd.dmotion, wd.damage, wd.div_ , wd.type, wd.damage2);
+ wd.dmotion = clif->damage(src, target, wd.amotion, wd.dmotion, wd.damage, wd.div_ , wd.type, wd.damage2);
if (sd && sd->bonus.splash_range > 0 && damage > 0)
skill->castend_damage_id(src, target, 0, 1, tick, 0);
@@ -5546,7 +5588,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
(d_bl->type == BL_PC && ((TBL_PC*)d_bl)->devotion[sce->val2] == target->id)
) && check_distance_bl(target, d_bl, sce->val3) )
{
- clif->damage(d_bl, d_bl, timer->gettick(), 0, 0, damage, 0, 0, 0);
+ clif->damage(d_bl, d_bl, 0, 0, damage, 0, 0, 0);
status_fix_damage(NULL, d_bl, damage, 0);
}
else
@@ -5560,10 +5602,10 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
} else if( tsc->data[SC_WATER_SCREEN_OPTION] && tsc->data[SC_WATER_SCREEN_OPTION]->val1 ) {
struct block_list *e_bl = map->id2bl(tsc->data[SC_WATER_SCREEN_OPTION]->val1);
if( e_bl && !status->isdead(e_bl) ) {
- clif->damage(e_bl,e_bl,tick,wd.amotion,wd.dmotion,damage,wd.div_,wd.type,wd.damage2);
+ clif->damage(e_bl,e_bl,wd.amotion,wd.dmotion,damage,wd.div_,wd.type,wd.damage2);
status->damage(target,e_bl,damage,0,0,0);
// Just show damage in target.
- clif->damage(src, target, tick, wd.amotion, wd.dmotion, damage, wd.div_, wd.type, wd.damage2 );
+ clif->damage(src, target, wd.amotion, wd.dmotion, damage, wd.div_, wd.type, wd.damage2 );
map->freeblock_unlock();
return ATK_NONE;
}
@@ -6825,7 +6867,7 @@ void battle_defaults(void) {
battle->calc_weapon_attack = battle_calc_weapon_attack;
battle->delay_damage = battle_delay_damage;
battle->drain = battle_drain;
- battle->calc_return_damage = battle_calc_return_damage;
+ battle->reflect_damage = battle_reflect_damage;
battle->attr_ratio = battle_attr_ratio;
battle->attr_fix = battle_attr_fix;
battle->calc_cardfix = battle_calc_cardfix;
diff --git a/src/map/battle.h b/src/map/battle.h
index 645b1761f..4d4508742 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -526,8 +526,8 @@ struct battle_interface {
int (*delay_damage) (int64 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, int64 rdamage, int64 ldamage, int race, int boss);
- /* damage return/reflect */
- int64 (*calc_return_damage) (struct block_list *target, struct block_list *src, int64 damage, int flag, uint16 skill_id);
+ /* damage reflect */
+ void (*reflect_damage) (struct block_list *target, struct block_list *src, struct Damage *wd,uint16 skill_id);
/* attribute rate */
int (*attr_ratio) (int atk_elem, int def_type, int def_lv);
/* applies attribute modifiers */
diff --git a/src/map/clif.c b/src/map/clif.c
index 2135adff8..a383617b5 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -45,7 +45,6 @@
#include "clif.h"
#include "mail.h"
#include "quest.h"
-#include "packets_struct.h"
#include "irc-bot.h"
#include <stdio.h>
@@ -4363,78 +4362,68 @@ 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, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, int type, int64 in_damage2) {
- unsigned char buf[33];
+int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) {
+ struct packet_damage p;
struct status_change *sc;
- int damage,damage2;
#if PACKETVER < 20071113
- const int cmd = 0x8a;
+ short damage,damage2;
#else
- const int cmd = 0x2e1;
+ int damage,damage2;
#endif
nullpo_ret(src);
nullpo_ret(dst);
-
- damage = (int)cap_value(in_damage,INT_MIN,INT_MAX);
- damage2 = (int)cap_value(in_damage2,INT_MIN,INT_MAX);
-
- type = clif_calc_delay(type,div,damage+damage2,ddelay);
+
sc = status->get_sc(dst);
- if(sc && sc->count) {
- if(sc->data[SC_ILLUSION]) {
- if(damage) damage = damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100;
- if(damage2) damage2 = damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100;
- }
+
+ if(sc && sc->count && sc->data[SC_ILLUSION]) {
+ if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100;
+ if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100;
}
-
- WBUFW(buf,0)=cmd;
- WBUFL(buf,2)=src->id;
- WBUFL(buf,6)=dst->id;
- WBUFL(buf,10)=(uint32)tick;
- WBUFL(buf,14)=sdelay;
- WBUFL(buf,18)=ddelay;
+
#if PACKETVER < 20071113
- if (battle_config.hide_woe_damage && map_flag_gvg2(src->m)) {
- WBUFW(buf,22)=damage?div:0;
- WBUFW(buf,27)=damage2?div:0;
- } else {
- WBUFW(buf,22)=min(damage, INT16_MAX);
- WBUFW(buf,27)=damage2;
- }
- WBUFW(buf,24)=div;
- WBUFB(buf,26)=type;
+ damage = (short)min(in_damage,INT16_MAX);
+ damage2 = (short)min(in_damage2,INT16_MAX);
#else
- if (battle_config.hide_woe_damage && map_flag_gvg2(src->m)) {
- WBUFL(buf,22)=damage?div:0;
- WBUFL(buf,29)=damage2?div:0;
- } else {
- WBUFL(buf,22)=damage;
- WBUFL(buf,29)=damage2;
- }
- WBUFW(buf,26)=div;
- WBUFB(buf,28)=type;
+ damage = (int)min(in_damage,INT_MAX);
+ damage2 = (int)min(in_damage2,INT_MAX);
#endif
+ type = clif_calc_delay(type,div,damage+damage2,ddelay);
+
+ p.PacketType = damageType;
+ p.GID = src->id;
+ p.targetGID = dst->id;
+ p.startTime = (uint32)timer->gettick();
+ p.attackMT = sdelay;
+ p.attackedMT = ddelay;
+ p.count = div;
+ p.action = type;
+
+ if( battle_config.hide_woe_damage && map_flag_gvg2(src->m) ) {
+ p.damage = damage?div:0;
+ p.leftDamage = damage2?div:0;
+ } else {
+ p.damage = damage;
+ p.leftDamage = damage2;
+ }
+
if(disguised(dst)) {
- clif->send(buf,packet_len(cmd),dst,AREA_WOS);
- WBUFL(buf,6) = -dst->id;
- clif->send(buf,packet_len(cmd),dst,SELF);
+ clif->send(&p,sizeof(p),dst,AREA_WOS);
+ p.targetGID = -dst->id;
+ clif->send(&p,sizeof(p),dst,SELF);
} else
- clif->send(buf,packet_len(cmd),dst,AREA);
+ clif->send(&p,sizeof(p),dst,AREA);
if(disguised(src)) {
- WBUFL(buf,2) = -src->id;
+ p.GID = -src->id;
if (disguised(dst))
- WBUFL(buf,6) = dst->id;
-#if PACKETVER < 20071113
- if(damage > 0) WBUFW(buf,22) = -1;
- if(damage2 > 0) WBUFW(buf,27) = -1;
-#else
- if(damage > 0) WBUFL(buf,22) = -1;
- if(damage2 > 0) WBUFL(buf,29) = -1;
-#endif
- clif->send(buf,packet_len(cmd),src,SELF);
+ p.targetGID = dst->id;
+
+ if(damage > 0) p.damage = -1;
+ if(damage2 > 0) p.leftDamage = -1;
+
+ clif->send(&p,sizeof(p),src,SELF);
}
if(src == dst) {
@@ -4450,7 +4439,7 @@ int clif_damage(struct block_list* src, struct block_list* dst, int64 tick, int
*------------------------------------------*/
void clif_takeitem(struct block_list* src, struct block_list* dst)
{
- //clif->damage(src,dst,0,0,0,0,0,1,0);
+ //clif->damage(src,dst,0,0,0,0,1,0);
unsigned char buf[32];
nullpo_retv(src);
@@ -17776,6 +17765,21 @@ void clif_package_item_announce(struct map_session_data *sd, unsigned short name
clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT);
}
+/* Made Possible Thanks to Yommy! */
+void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) {
+ struct packet_item_drop_announce p;
+
+ p.PacketType = item_drop_announceType;
+ p.PacketLength = sizeof(p);
+ p.type = 0x1;
+ p.ItemID = nameid;
+ p.len = NAME_LENGTH;
+ safestrncpy(p.Name, sd->status.name, sizeof(p.Name));
+ p.monsterNameLen = NAME_LENGTH;
+ safestrncpy(p.monsterName, monsterName, sizeof(p.monsterName));
+
+ clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT);
+}
/* [Ind/Hercules] special thanks to Yommy~! */
void clif_skill_cooldown_list(int fd, struct skill_cd* cd) {
#if PACKETVER >= 20120604
@@ -17917,7 +17921,9 @@ void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) {
clif->send(&p,sizeof(p), &sd->bl, SELF);
}
-/* (GM) right click -> 'remove all equipment' */
+/**
+ * Parses the (GM) right click option 'remove all equipment'
+ **/
void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) {
struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2));
int i;
@@ -17931,6 +17937,90 @@ void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) {
pc->unequipitem( tsd , tsd->equip_index[ i ] , 2 );
}
}
+/**
+ * clif_delay_damage timer, sends the stored data and clears the memory afterwards
+ **/
+int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) {
+ struct cdelayed_damage *dd = (struct cdelayed_damage *)data;
+
+ clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS);
+
+ ers_free(clif->delayed_damage_ers,dd);
+
+ return 0;
+}
+/**
+ * Delays sending a damage packet in order to avoid the visual display to overlap
+ *
+ * @param tick when to trigger the timer (e.g. timer->gettick() + 500)
+ * @param src block_list pointer of the src
+ * @param dst block_list pointer of the damage source
+ * @param sdelay attack motion usually status_get_amotion()
+ * @param ddelay damage motion usually status_get_dmotion()
+ * @param in_damage total damage to be sent
+ * @param div amount of hits
+ * @param type action type
+ *
+ * @return clif->calc_walkdelay used in further processing
+ **/
+int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) {
+ struct cdelayed_damage *dd;
+ struct status_change *sc;
+#if PACKETVER < 20071113
+ short damage;
+#else
+ int damage;
+#endif
+
+ nullpo_ret(src);
+ nullpo_ret(dst);
+
+ sc = status->get_sc(dst);
+
+ if(sc && sc->count && sc->data[SC_ILLUSION]) {
+ if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100;
+ }
+
+#if PACKETVER < 20071113
+ damage = (short)min(in_damage,INT16_MAX);
+#else
+ damage = (int)min(in_damage,INT_MAX);
+#endif
+
+ type = clif_calc_delay(type,div,damage,ddelay);
+
+ dd = ers_alloc(clif->delayed_damage_ers, struct cdelayed_damage);
+
+ dd->p.PacketType = damageType;
+ dd->p.GID = src->id;
+ dd->p.targetGID = dst->id;
+ dd->p.startTime = (uint32)timer->gettick();
+ dd->p.attackMT = sdelay;
+ dd->p.attackedMT = ddelay;
+ dd->p.count = div;
+ dd->p.action = type;
+ dd->p.leftDamage = 0;
+
+ if( battle_config.hide_woe_damage && map_flag_gvg2(src->m) )
+ dd->p.damage = damage?div:0;
+ else
+ dd->p.damage = damage;
+
+ dd->bl.m = dst->m;
+ dd->bl.x = dst->x;
+ dd->bl.y = dst->y;
+ dd->bl.type = BL_NUL;
+
+ if( tick > timer->gettick() )
+ timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd);
+ else {
+ clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS);
+
+ ers_free(clif->delayed_damage_ers,dd);
+ }
+
+ return clif->calc_walkdelay(dst,ddelay,type,damage,div);
+}
/* */
unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) {
@@ -18206,7 +18296,8 @@ int do_init_clif(bool minimal) {
timer->add_func_list(clif->delayquit, "clif_delayquit");
clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR);
-
+ clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR);
+
clif->channel_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, HCHSYS_NAME_LENGTH);
hChSys.ally = hChSys.local = hChSys.irc = hChSys.ally_autojoin = hChSys.local_autojoin = false;
clif->chann_config_read();
@@ -18236,6 +18327,7 @@ void do_final_clif(void) {
db_destroy(clif->channel_db);
ers_destroy(clif->delay_clearunit_ers);
+ ers_destroy(clif->delayed_damage_ers);
for(i = 0; i < CASHSHOP_TAB_MAX; i++) {
int k;
@@ -18252,6 +18344,7 @@ void clif_defaults(void) {
clif->bind_ip = INADDR_ANY;
clif->map_port = 5121;
clif->ally_only = false;
+ clif->delayed_damage_ers = NULL;
/* core */
clif->init = do_init_clif;
clif->final = do_final_clif;
@@ -18291,6 +18384,7 @@ void clif_defaults(void) {
clif->cart_additem_ack = clif_cart_additem_ack;
clif->cashshop_load = clif_cashshop_db;
clif->package_announce = clif_package_item_announce;
+ clif->item_drop_announce = clif_item_drop_announce;
/* unit-related */
clif->clearunit_single = clif_clearunit_single;
clif->clearunit_area = clif_clearunit_area;
@@ -18738,6 +18832,9 @@ void clif_defaults(void) {
clif->show_modifiers = clif_show_modifiers;
/* */
clif->notify_bounditem = clif_notify_bounditem;
+ /* */
+ clif->delay_damage = clif_delay_damage;
+ clif->delay_damage_sub = clif_delay_damage_sub;
/*------------------------
*- Parse Incoming Packet
*------------------------*/
diff --git a/src/map/clif.h b/src/map/clif.h
index 47ee383e3..8b78f27e9 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -9,6 +9,8 @@
#include "../common/db.h"
#include "../common/mmo.h"
#include "../common/socket.h"
+#include "../map/map.h"
+#include "../map/packets_struct.h"
#include <stdarg.h>
/**
@@ -505,6 +507,11 @@ struct hCSData {
unsigned int price;
};
+struct cdelayed_damage {
+ struct packet_damage p;
+ struct block_list bl;
+};
+
/**
* Vars
**/
@@ -533,6 +540,8 @@ struct clif_interface {
unsigned int cryptKey[3];
/* */
bool ally_only;
+ /* */
+ struct eri *delayed_damage_ers;
/* core */
int (*init) (bool minimal);
void (*final) (void);
@@ -572,6 +581,7 @@ struct clif_interface {
void (*cart_additem_ack) (struct map_session_data *sd, int flag);
void (*cashshop_load) (void);
void (*package_announce) (struct map_session_data *sd, unsigned short nameid, unsigned short containerid);
+ void (*item_drop_announce) (struct map_session_data *sd, unsigned short nameid, char *monsterName);
/* unit-related */
void (*clearunit_single) (int id, clr_type type, int fd);
void (*clearunit_area) (struct block_list* bl, clr_type type);
@@ -633,7 +643,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, int64 tick, int sdelay, int ddelay, int64 damage, int div, int type, int64 damage2);
+ int (*damage) (struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 damage, short div, unsigned char type, int64 damage2);
void (*sitting) (struct block_list* bl);
void (*standing) (struct block_list* bl);
void (*arrow_create_list) (struct map_session_data *sd);
@@ -1020,6 +1030,9 @@ struct clif_interface {
void (*show_modifiers) (struct map_session_data *sd);
/* */
void (*notify_bounditem) (struct map_session_data *sd, unsigned short index);
+ /* */
+ int (*delay_damage) (int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type);
+ int (*delay_damage_sub) (int tid, int64 tick, int id, intptr_t data);
/*------------------------
*- Parse Incoming Packet
*------------------------*/
diff --git a/src/map/mob.c b/src/map/mob.c
index 35c9ed1aa..777518d87 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -459,6 +459,12 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int
int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai) {
struct mob_data* md = NULL;
int count, lv;
+ bool no_guardian_data = false;
+
+ if( ai && ai&0x200 ) {
+ no_guardian_data = true;
+ ai &=~ 0x200;
+ }
if (m < 0 || amount <= 0)
return 0; // invalid input
@@ -472,7 +478,7 @@ int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const
if (!md)
continue;
- if (class_ == MOBID_EMPERIUM) {
+ if (class_ == MOBID_EMPERIUM && !no_guardian_data) {
struct guild_castle* gc = guild->mapindex2gc(map_id2index(m));
struct guild* g = (gc) ? guild->search(gc->guild_id) : NULL;
if (gc) {
@@ -581,7 +587,7 @@ int mob_spawn_guardian_sub(int tid, int64 tick, int id, intptr_t data) {
if (g == NULL)
{ //Liberate castle, if the guild is not found this is an error! [Skotlex]
ShowError("mob_spawn_guardian_sub: Couldn't load guild %d!\n", (int)data);
- if (md->class_ == MOBID_EMPERIUM)
+ if (md->class_ == MOBID_EMPERIUM && md->guardian_data)
{ //Not sure this is the best way, but otherwise we'd be invoking this for ALL guardians spawned later on.
md->guardian_data->guild_id = 0;
if (md->guardian_data->castle->guild_id) //Free castle up.
@@ -2356,6 +2362,14 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
intif->broadcast(message, strlen(message)+1, BC_DEFAULT);
}
+
+ /* heres the thing we got the feature set up however we're still discussing how to best define the ids,
+ * so while we discuss, for a small period of time, the list is hardcoded (yes officially only those 2 use it,
+ * thus why we're unsure on how to best place the setting) */
+ /* temp, will not be hardcoded for long thudu. */
+ if( it->nameid == 7782 || it->nameid == 7783 ) /* for when not hardcoded: add a check on mvp bonus drop as well */
+ clif->item_drop_announce(mvp_sd, it->nameid, md->name);
+
// Announce first, or else ditem will be freed. [Lance]
// By popular demand, use base drop rate for autoloot code. [Skotlex]
mob->item_drop(md, dlist, ditem, 0, md->db->dropitem[i].p, homkillonly);
@@ -2512,7 +2526,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
logs->mvpdrop(mvp_sd, md->class_, log_mvp);
}
- if (type&2 && !sd && md->class_ == MOBID_EMPERIUM)
+ if (type&2 && !sd && md->class_ == MOBID_EMPERIUM && md->guardian_data)
//Emperium destroyed by script. Discard mvp character. [Skotlex]
mvp_sd = NULL;
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 882c2fe24..df90b35a4 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -54,6 +54,11 @@ enum packet_headers {
spawn_unit2Type = 0x7c,
idle_unit2Type = 0x78,
#endif
+#if PACKETVER < 20071113
+ damageType = 0x8a,
+#else
+ damageType = 0x2e1,
+#endif
#if PACKETVER < 4
spawn_unitType = 0x79,
#elif PACKETVER < 7
@@ -76,6 +81,7 @@ enum packet_headers {
#endif
script_clearType = 0x8d6,
package_item_announceType = 0x7fd,
+ item_drop_announceType = 0x7fd,
#if PACKETVER < 4
unit_walkingType = 0x7b,
#elif PACKETVER < 7
@@ -696,6 +702,18 @@ struct packet_package_item_announce {
unsigned short BoxItemID;
} __attribute__((packed));
+/* made possible thanks to Yommy!! */
+struct packet_item_drop_announce {
+ short PacketType;
+ short PacketLength;
+ unsigned char type;
+ unsigned short ItemID;
+ char len;
+ char Name[NAME_LENGTH];
+ char monsterNameLen;
+ char monsterName[NAME_LENGTH];
+} __attribute__((packed));
+
struct packet_cart_additem_ack {
short PacketType;
char result;
@@ -856,6 +874,27 @@ struct packet_graffiti_entry {
char msg[80];
} __attribute__((packed));
+struct packet_damage {
+ short PacketType;
+ unsigned int GID;
+ unsigned int targetGID;
+ unsigned int startTime;
+ int attackMT;
+ int attackedMT;
+#if PACKETVER < 20071113
+ short damage;
+#else
+ int damage;
+#endif
+ short count;
+ unsigned char action;
+#if PACKETVER < 20071113
+ short leftDamage;
+#else
+ int leftDamage;
+#endif
+} __attribute__((packed));
+
#pragma pack(pop)
#endif /* _PACKETS_STRUCT_H_ */
diff --git a/src/map/script.c b/src/map/script.c
index 007a3a3d3..107a921f0 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -17377,11 +17377,6 @@ BUILDIN(montransform) {
return false;
}
- if(mob_id == MOBID_EMPERIUM) {
- ShowWarning("buildin_montransform: Monster 'Emperium' cannot be used.\n");
- return false;
- }
-
if( !(type > SC_NONE && type < SC_MAX) ){
ShowWarning("buildin_montransform: Unsupported status change id %d\n", type);
return false;
diff --git a/src/map/skill.c b/src/map/skill.c
index 698252d18..45d06c97a 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2380,7 +2380,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
case NPC_CRITICALSLASH:
case TF_DOUBLE:
case GS_CHAINACTION:
- dmg.dmotion = clif->damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,dmg.type,dmg.damage2);
+ dmg.dmotion = clif->damage(src,bl,dmg.amotion,dmg.dmotion,damage,dmg.div_,dmg.type,dmg.damage2);
break;
case AS_SPLASHER:
@@ -2680,12 +2680,12 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
) && check_distance_bl(bl, d_bl, sce->val3) )
{
if(!rmdamage){
- clif->damage(d_bl,d_bl, timer->gettick(), 0, 0, damage, 0, 0, 0);
+ clif->damage(d_bl,d_bl, 0, 0, damage, 0, 0, 0);
status_fix_damage(NULL,d_bl, damage, 0);
} else{ //Reflected magics are done directly on the target not on paladin
//This check is only for magical skill.
//For BF_WEAPON skills types track var rdamage and function battle_calc_return_damage
- clif->damage(bl,bl, timer->gettick(), 0, 0, damage, 0, 0, 0);
+ clif->damage(bl,bl, 0, 0, damage, 0, 0, 0);
status_fix_damage(bl,bl, damage, 0);
}
}
@@ -3866,7 +3866,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1
break;
case CH_PALMSTRIKE: // Palm Strike takes effect 1sec after casting. [Skotlex]
// clif->skill_nodamage(src,bl,skill_id,skill_lv,0); //Can't make this one display the correct attack animation delay :/
- clif->damage(src,bl,tick,status_get_amotion(src),0,-1,1,4,0); //Display an absorbed damage attack.
+ clif->damage(src,bl,status_get_amotion(src),0,-1,1,4,0); //Display an absorbed damage attack.
skill->addtimerskill(src, tick + (1000+status_get_amotion(src)), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag);
break;
@@ -7307,7 +7307,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
case 3: // 1000 damage, random armor destroyed
{
status_fix_damage(src, bl, 1000, 0);
- clif->damage(src,bl,tick,0,0,1000,0,0,0);
+ clif->damage(src,bl,0,0,1000,0,0,0);
if( !status->isdead(bl) ) {
int where[] = { EQP_ARMOR, EQP_SHIELD, EQP_HELM, EQP_SHOES, EQP_GARMENT };
skill->break_equip(bl, where[rnd()%5], 10000, BCT_ENEMY);
@@ -7344,14 +7344,14 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
break;
case 10: // 6666 damage, atk matk halved, cursed
status_fix_damage(src, bl, 6666, 0);
- clif->damage(src,bl,tick,0,0,6666,0,0,0);
+ clif->damage(src,bl,0,0,6666,0,0,0);
sc_start(bl,SC_INCATKRATE,100,-50,skill->get_time2(skill_id,skill_lv));
sc_start(bl,SC_INCMATKRATE,100,-50,skill->get_time2(skill_id,skill_lv));
sc_start(bl,SC_CURSE,skill_lv,100,skill->get_time2(skill_id,skill_lv));
break;
case 11: // 4444 damage
status_fix_damage(src, bl, 4444, 0);
- clif->damage(src,bl,tick,0,0,4444,0,0,0);
+ clif->damage(src,bl,0,0,4444,0,0,0);
break;
case 12: // stun
sc_start(bl,SC_STUN,100,skill_lv,5000);
@@ -8690,7 +8690,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
sc_start(bl, type, 100, skill_lv,skill->get_time(skill_id, skill_lv));
} else if( flag&2 ) {
if( src->id != bl->id && battle->check_target(src,bl,BCT_ENEMY) > 0 )
- status_fix_damage(src,bl,9999,clif->damage(src,bl,tick,0,0,9999,0,0,0));
+ status_fix_damage(src,bl,9999,clif->damage(src,bl,0,0,9999,0,0,0));
} else if( sd ) {
short chance = sstatus->int_/6 + sd->status.job_level/5 + skill_lv*4;
if( !sd->status.party_id || (rnd()%100 > chance)) {
@@ -8706,7 +8706,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
clif->skill_nodamage(src, bl, skill_id, skill_lv,
sc_start(src,SC_STOP,100,skill_lv,skill->get_time2(skill_id,skill_lv)));
if( flag&2 ) // Dealed here to prevent conflicts
- status_fix_damage(src,bl,9999,clif->damage(src,bl,tick,0,0,9999,0,0,0));
+ status_fix_damage(src,bl,9999,clif->damage(src,bl,0,0,9999,0,0,0));
}
break;
@@ -12930,7 +12930,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
if (map->foreachinrange(mob->count_sub, &sd->bl, skill->get_splash(skill_id, skill_lv), BL_MOB,
MOBID_EMPERIUM, MOBID_GUARIDAN_STONE1, MOBID_GUARIDAN_STONE2)) {
char output[128];
- sprintf(output, "You're too close to a stone or emperium to do this skill");
+ sprintf(output, "You're too close to a stone or emperium to do this skill"); /* TODO official response? or message.conf it */
clif->colormes(sd->fd, COLOR_RED, output);
return 0;
}
@@ -15114,7 +15114,7 @@ bool skill_check_shadowform(struct block_list *bl, int64 damage, int hit){
return false;
}
- status->damage(bl, src, damage, 0, clif->damage(src, src, timer->gettick(), 500, 500, damage, hit, (hit > 1 ? 8 : 0), 0), 0);
+ status->damage(bl, src, damage, 0, clif->damage(src, src, 500, 500, damage, hit, (hit > 1 ? 8 : 0), 0), 0);
if( (--sc->data[SC__SHADOWFORM]->val3) <= 0 ) {
status_change_end(bl, SC__SHADOWFORM, INVALID_TIMER);
if( src->type == BL_PC )
diff --git a/src/map/status.c b/src/map/status.c
index d4e1d1b31..29a1689a1 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2022,8 +2022,6 @@ int status_calc_mob_(struct mob_data* md, enum e_status_calc_opt opt) {
if (md->guardian_data && md->guardian_data->guardup_lv)
flag|=4;
- if (md->class_ == MOBID_EMPERIUM)
- flag|=4;
if (battle_config.slaves_inherit_speed && md->master_id)
flag|=8;
@@ -9631,7 +9629,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
struct block_list* src = map->id2bl(sce->val2);
if( tid == -1 || !src)
break; // Terminated by Damage
- status_fix_damage(src,bl,400*sce->val1,clif->damage(bl,bl,timer->gettick(),0,0,400*sce->val1,0,0,0));
+ status_fix_damage(src,bl,400*sce->val1,clif->damage(bl,bl,0,0,400*sce->val1,0,0,0));
}
break;
case SC_WUGDASH:
@@ -10327,7 +10325,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
case SC_PYREXIA:
if( --(sce->val4) > 0 ) {
map->freeblock_lock();
- clif->damage(bl,bl,tick,status_get_amotion(bl),status_get_dmotion(bl)+500,100,0,0,0);
+ clif->damage(bl,bl,status_get_amotion(bl),status_get_dmotion(bl)+500,100,0,0,0);
status_fix_damage(NULL,bl,100,0);
if( sc->data[type] ) {
sc_timer_next(3000+tick,status->change_timer,bl->id,data);
@@ -10343,7 +10341,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
damage += st->vit * (sce->val1 - 3);
unit->skillcastcancel(bl,2);
map->freeblock_lock();
- status->damage(bl, bl, damage, 0, clif->damage(bl,bl,tick,status_get_amotion(bl),status_get_dmotion(bl)+500,damage,1,0,0), 1);
+ status->damage(bl, bl, damage, 0, clif->damage(bl,bl,status_get_amotion(bl),status_get_dmotion(bl)+500,damage,1,0,0), 1);
if( sc->data[type] ) {
sc_timer_next(1000 + tick, status->change_timer, bl->id, data );
}
@@ -10401,7 +10399,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
if( --(sce->val4) > 0 ) {
//Damage is every 10 seconds including 3%sp drain.
map->freeblock_lock();
- clif->damage(bl,bl,tick,status_get_amotion(bl),1,1,0,0,0);
+ clif->damage(bl,bl,status_get_amotion(bl),1,1,0,0,0);
status->damage(NULL, bl, 1, st->max_sp * 3 / 100, 0, 0); //cancel dmg only if cancelable
if( sc->data[type] ) {
sc_timer_next(10000 + tick, status->change_timer, bl->id, data );
@@ -10451,7 +10449,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
int damage = 1000 + 3 * status_get_max_hp(bl) / 100; // Deals fixed (1000 + 3%*MaxHP)
map->freeblock_lock();
- clif->damage(bl,bl,tick,0,0,damage,1,9,0); //damage is like endure effect with no walk delay
+ clif->damage(bl,bl,0,0,damage,1,9,0); //damage is like endure effect with no walk delay
status->damage(src, bl, damage, 0, 0, 1);
if( sc->data[type]){ // Target still lives. [LimitLine]
@@ -10556,7 +10554,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
break;
map->freeblock_lock();
damage = sce->val3;
- status->damage(src, bl, damage, 0, clif->damage(bl,bl,tick,st->amotion,st->dmotion+200,damage,1,0,0), 1);
+ status->damage(src, bl, damage, 0, clif->damage(bl,bl,st->amotion,st->dmotion+200,damage,1,0,0), 1);
unit->skillcastcancel(bl,1);
if ( sc->data[type] ) {
sc_timer_next(1000 + tick, status->change_timer, bl->id, data);
@@ -10659,7 +10657,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
int damage = st->max_hp / 100; // Suggestion 1% each second
if( damage >= st->hp ) damage = st->hp - 1; // Do not kill, just keep you with 1 hp minimum
map->freeblock_lock();
- status_fix_damage(NULL,bl,damage,clif->damage(bl,bl,tick,0,0,damage,0,0,0));
+ status_fix_damage(NULL,bl,damage,clif->damage(bl,bl,0,0,damage,0,0,0));
if( sc->data[type] ) {
sc_timer_next(1000 + tick, status->change_timer, bl->id, data);
}
diff --git a/src/map/unit.c b/src/map/unit.c
index 04af6c117..872ad1f8b 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2021,13 +2021,13 @@ int unit_counttargeted(struct block_list* bl)
/*==========================================
*
*------------------------------------------*/
-int unit_fixdamage(struct block_list *src, struct block_list *target, int64 tick, int sdelay, int ddelay, int64 damage, int div, int type, int64 damage2) {
+int unit_fixdamage(struct block_list *src, struct block_list *target, int sdelay, int ddelay, int64 damage, short div, unsigned char type, int64 damage2) {
nullpo_ret(target);
if(damage+damage2 <= 0)
return 0;
- return status_fix_damage(src,target,damage+damage2,clif->damage(target,target,tick,sdelay,ddelay,damage,div,type,damage2));
+ return status_fix_damage(src,target,damage+damage2,clif->damage(target,target,sdelay,ddelay,damage,div,type,damage2));
}
/*==========================================
diff --git a/src/map/unit.h b/src/map/unit.h
index 8220b7e8f..a2d743875 100644
--- a/src/map/unit.h
+++ b/src/map/unit.h
@@ -113,7 +113,7 @@ struct unit_interface {
int (*skillcastcancel) (struct block_list *bl, int type);
void (*dataset) (struct block_list *bl);
int (*counttargeted) (struct block_list *bl);
- int (*fixdamage) (struct block_list *src, struct block_list *target, int64 tick, int sdelay, int ddelay, int64 damage, int div, int type, int64 damage2);
+ int (*fixdamage) (struct block_list *src, struct block_list *target, int sdelay, int ddelay, int64 damage, short div, unsigned char type, int64 damage2);
int (*changeviewsize) (struct block_list *bl, short size);
int (*remove_map) (struct block_list *bl, clr_type clrtype, const char *file, int line, const char *func);
void (*remove_map_pc) (struct map_session_data *sd, clr_type clrtype);