Skip to content
Permalink
Browse files
Follow up 144a9d0
It will no longer block the equipping of items, instead it will delay (if applicable) the item's effect until it is no longer capable of affecting the skills under the timer.
Special Thanks to kyeme for the information.

Signed-off-by: shennetsind <ind@henn.et>
  • Loading branch information
shennetsind committed Jul 26, 2013
1 parent 21b13ae commit 2eab181cece04d8c6a79f9d1a3ff74343cd3ae76
Showing with 24 additions and 13 deletions.
  1. +10 −5 src/map/battle.c
  2. +1 −1 src/map/clif.c
  3. +1 −0 src/map/pc.h
  4. +12 −7 src/map/status.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);

@@ -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;
}
@@ -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;
@@ -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;
}
}

0 comments on commit 2eab181

Please sign in to comment.