summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c15
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/pc.h1
-rw-r--r--src/map/status.c19
4 files changed, 24 insertions, 13 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 2fca9ef9c..c1f568843 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -222,8 +222,10 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) {
struct block_list* target = iMap->id2bl(dat->target_id);
if( !target || iStatus->isdead(target) ) {/* nothing we can do */
- if( dat->src_type == BL_PC && ( src = iMap->id2bl(dat->src_id) ) )
- ((TBL_PC*)src)->delayed_damage--;
+ if( dat->src_type == BL_PC && ( src = iMap->id2bl(dat->src_id) ) && --((TBL_PC*)src)->delayed_damage == 0 && ((TBL_PC*)src)->state.hold_recalc ) {
+ ((TBL_PC*)src)->state.hold_recalc = 0;
+ status_calc_pc(((TBL_PC*)src),0);
+ }
ers_free(delay_damage_ers, dat);
return 0;
}
@@ -250,8 +252,10 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) {
iMap->freeblock_unlock();
}
- if( src && src->type == BL_PC )
- ((TBL_PC*)src)->delayed_damage--;
+ if( src && src->type == BL_PC && --((TBL_PC*)src)->delayed_damage == 0 && ((TBL_PC*)src)->state.hold_recalc ) {
+ ((TBL_PC*)src)->state.hold_recalc = 0;
+ status_calc_pc(((TBL_PC*)src),0);
+ }
}
ers_free(delay_damage_ers, dat);
return 0;
@@ -294,8 +298,9 @@ int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src,
if (src->type != BL_PC && amotion > 1000)
amotion = 1000; //Aegis places a damage-delay cap of 1 sec to non player attacks. [Skotlex]
- if( src->type == BL_PC )
+ if( src->type == BL_PC ) {
((TBL_PC*)src)->delayed_damage++;
+ }
iTimer->add_timer(tick+amotion, battle->delay_damage_sub, 0, (intptr_t)dat);
diff --git a/src/map/clif.c b/src/map/clif.c
index 4f0f4f7bf..718b98bc5 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -10671,7 +10671,7 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd)
else if ( pc_cant_act2(sd) || sd->state.prerefining )
return;
- if(!sd->status.inventory[index].identify || sd->delayed_damage != 0) {
+ if(!sd->status.inventory[index].identify) {
clif->equipitemack(sd,index,0,0); // fail
return;
}
diff --git a/src/map/pc.h b/src/map/pc.h
index a69c77efe..8544650a3 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -165,6 +165,7 @@ struct map_session_data {
unsigned int dialog : 1;
unsigned int prerefining : 1;
unsigned int workinprogress : 3; // 1 = disable skill/item, 2 = disable npc interaction, 3 = disable both
+ unsigned int hold_recalc : 1;
} state;
struct {
unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
diff --git a/src/map/status.c b/src/map/status.c
index 2f1950c47..4c5b5c7c2 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -3929,19 +3929,24 @@ void status_calc_bl_(struct block_list* bl, enum scb_flag flag, bool first)
struct status_data b_status; // previous battle status
struct status_data* status; // pointer to current battle status
+ if( bl->type == BL_PC && ((TBL_PC*)bl)->delayed_damage != 0 ) {
+ ((TBL_PC*)bl)->state.hold_recalc = 1;
+ return;
+ }
+
// remember previous values
status = iStatus->get_status_data(bl);
memcpy(&b_status, status, sizeof(struct status_data));
if( flag&SCB_BASE ) {// calculate the object's base status too
switch( bl->type ) {
- case BL_PC: iStatus->calc_pc_(BL_CAST(BL_PC,bl), first); break;
- case BL_MOB: iStatus->calc_mob_(BL_CAST(BL_MOB,bl), first); break;
- case BL_PET: iStatus->calc_pet_(BL_CAST(BL_PET,bl), first); break;
- case BL_HOM: iStatus->calc_homunculus_(BL_CAST(BL_HOM,bl), first); break;
- case BL_MER: iStatus->calc_mercenary_(BL_CAST(BL_MER,bl), first); break;
- case BL_ELEM: iStatus->calc_elemental_(BL_CAST(BL_ELEM,bl), first); break;
- case BL_NPC: status_calc_npc_(BL_CAST(BL_NPC,bl), first); break;
+ case BL_PC: iStatus->calc_pc_(BL_CAST(BL_PC,bl), first); break;
+ case BL_MOB: iStatus->calc_mob_(BL_CAST(BL_MOB,bl), first); break;
+ case BL_PET: iStatus->calc_pet_(BL_CAST(BL_PET,bl), first); break;
+ case BL_HOM: iStatus->calc_homunculus_(BL_CAST(BL_HOM,bl), first); break;
+ case BL_MER: iStatus->calc_mercenary_(BL_CAST(BL_MER,bl), first); break;
+ case BL_ELEM: iStatus->calc_elemental_(BL_CAST(BL_ELEM,bl), first); break;
+ case BL_NPC: status_calc_npc_(BL_CAST(BL_NPC,bl), first); break;
}
}