* Fix #2694

Move down skill_unit_move(bl,gettick(),4) of unit_remove_map_ to avoid conflict with duel changing realm.
The issue was that skill_unit_onleft was called before the duel_leave handling which was reapplying skill_unit_onplace causing an infinite status duration.
Other skill might had same issue.

* Small optimisation.
Avoid calling status_change_end when we have no status set yet (or no status_change holder).
Move down overrecurent call to status_change_end SC_ROLLINGCUTTER.
This commit is contained in:
lighta 2017-12-22 14:29:44 -05:00 committed by GitHub
parent 65771a8ec1
commit 5ad35eb66b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 23 deletions

View File

@ -413,6 +413,9 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
sc = status_get_sc(bl); sc = status_get_sc(bl);
skill_unit_move(bl,tick,2); skill_unit_move(bl,tick,2);
if ( sc && sc->count ) //at least one to cancel
{
status_change_end(bl, SC_ROLLINGCUTTER, INVALID_TIMER); // If you move, you lose your counters. [malufett]
status_change_end(bl, SC_CLOSECONFINE, INVALID_TIMER); status_change_end(bl, SC_CLOSECONFINE, INVALID_TIMER);
status_change_end(bl, SC_CLOSECONFINE2, INVALID_TIMER); status_change_end(bl, SC_CLOSECONFINE2, INVALID_TIMER);
status_change_end(bl, SC_TINDER_BREAKER, INVALID_TIMER); status_change_end(bl, SC_TINDER_BREAKER, INVALID_TIMER);
@ -424,6 +427,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
if (sc->data[SC_PROPERTYWALK] && if (sc->data[SC_PROPERTYWALK] &&
sc->data[SC_PROPERTYWALK]->val3 >= skill_get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) ) sc->data[SC_PROPERTYWALK]->val3 >= skill_get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) )
status_change_end(bl,SC_PROPERTYWALK,INVALID_TIMER); status_change_end(bl,SC_PROPERTYWALK,INVALID_TIMER);
}
} else } else
if (bl->type == BL_NPC) if (bl->type == BL_NPC)
npc_unsetcells((TBL_NPC*)bl); npc_unsetcells((TBL_NPC*)bl);

View File

@ -11325,11 +11325,11 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
else else
skill_castend_damage_id(src,target,ud->skill_id,ud->skill_lv,tick,flag); skill_castend_damage_id(src,target,ud->skill_id,ud->skill_lv,tick,flag);
sc = status_get_sc(src);
if(sc && sc->count) {
if (ud->skill_id != RA_CAMOUFLAGE) if (ud->skill_id != RA_CAMOUFLAGE)
status_change_end(src, SC_CAMOUFLAGE, INVALID_TIMER); // Applies to the first skill if active status_change_end(src, SC_CAMOUFLAGE, INVALID_TIMER); // Applies to the first skill if active
sc = status_get_sc(src);
if(sc && sc->count) {
if(sc->data[SC_SPIRIT] && if(sc->data[SC_SPIRIT] &&
sc->data[SC_SPIRIT]->val2 == SL_WIZARD && sc->data[SC_SPIRIT]->val2 == SL_WIZARD &&
sc->data[SC_SPIRIT]->val3 == ud->skill_id && sc->data[SC_SPIRIT]->val3 == ud->skill_id &&
@ -18112,10 +18112,14 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li
case NC_NEUTRALBARRIER: case NC_NEUTRALBARRIER:
{ {
struct status_change *sc = NULL; struct status_change *sc = NULL;
if( (sc = status_get_sc(src)) != NULL && sc->data[SC_NEUTRALBARRIER_MASTER] ) { if( (sc = status_get_sc(src)) != NULL ) {
if ( sc->data[SC_NEUTRALBARRIER_MASTER] )
{
sc->data[SC_NEUTRALBARRIER_MASTER]->val2 = 0; sc->data[SC_NEUTRALBARRIER_MASTER]->val2 = 0;
status_change_end(src,SC_NEUTRALBARRIER_MASTER,INVALID_TIMER); status_change_end(src,SC_NEUTRALBARRIER_MASTER,INVALID_TIMER);
} }
status_change_end(src,SC_NEUTRALBARRIER,INVALID_TIMER);
}
} }
break; break;
case NC_STEALTHFIELD: case NC_STEALTHFIELD:

View File

@ -406,7 +406,6 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
y += dy; y += dy;
map_moveblock(bl, x, y, tick); map_moveblock(bl, x, y, tick);
ud->walk_count++; // Walked cell counter, to be used for walk-triggered skills. [Skotlex] ud->walk_count++; // Walked cell counter, to be used for walk-triggered skills. [Skotlex]
status_change_end(bl, SC_ROLLINGCUTTER, INVALID_TIMER); // If you move, you lose your counters. [malufett]
if (bl->x != x || bl->y != y || ud->walktimer != INVALID_TIMER) if (bl->x != x || bl->y != y || ud->walktimer != INVALID_TIMER)
return 0; // map_moveblock has altered the object beyond what we expected (moved/warped it) return 0; // map_moveblock has altered the object beyond what we expected (moved/warped it)
@ -2878,11 +2877,6 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
status_change_end(bl, SC_SUHIDE, INVALID_TIMER); status_change_end(bl, SC_SUHIDE, INVALID_TIMER);
} }
if (bl->type&(BL_CHAR|BL_PET)) {
skill_unit_move(bl,gettick(),4);
skill_cleartimerskill(bl);
}
switch( bl->type ) { switch( bl->type ) {
case BL_PC: { case BL_PC: {
struct map_session_data *sd = (struct map_session_data*)bl; struct map_session_data *sd = (struct map_session_data*)bl;
@ -3066,6 +3060,10 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
break;// do nothing break;// do nothing
} }
if (bl->type&(BL_CHAR|BL_PET)) {
skill_unit_move(bl,gettick(),4);
skill_cleartimerskill(bl);
}
// /BL_MOB is handled by mob_dead unless the monster is not dead. // /BL_MOB is handled by mob_dead unless the monster is not dead.
if( bl->type != BL_MOB || !status_isdead(bl) ) if( bl->type != BL_MOB || !status_isdead(bl) )
clif_clearunit_area(bl,clrtype); clif_clearunit_area(bl,clrtype);