From e259ba1a0f508d11a525fb5bde1d03bf2948ff9b Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 3 Dec 2017 18:54:39 +0100 Subject: Fix an issue that prevents the Poison status to naturally end when Slow Poison is active The status change timer wasn't correctly rearmed in such a condition, keeping SC_POISON active indefinitely. Signed-off-by: Haru --- src/map/status.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/map/status.c b/src/map/status.c index e0893aa36..48fd03135 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -11542,24 +11542,26 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) break; case SC_POISON: - if(st->hp <= max(st->max_hp>>2, sce->val4)) //Stop damaging after 25% HP left. + if (st->hp <= max(st->max_hp / 4, sce->val4)) //Stop damaging after 25% HP left. break; FALLTHROUGH case SC_DPOISON: if (--(sce->val3) > 0) { - if (!sc->data[SC_SLOWPOISON]) { - if( sce->val2 && bl->type == BL_MOB ) { - struct block_list* src = map->id2bl(sce->val2); - if (src != NULL) - mob->log_damage(BL_UCAST(BL_MOB, bl), src, sce->val4); - } - map->freeblock_lock(); - status_zap(bl, sce->val4, 0); - if (sc->data[type]) { // Check if the status still last ( can be dead since then ). - sc_timer_next(1000 + tick, status->change_timer, bl->id, data ); - } - map->freeblock_unlock(); + if (sc->data[SC_SLOWPOISON] != NULL) { + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); + return 0; } + if (sce->val2 != 0 && bl->type == BL_MOB) { + struct block_list* src = map->id2bl(sce->val2); + if (src != NULL) + mob->log_damage(BL_UCAST(BL_MOB, bl), src, sce->val4); + } + map->freeblock_lock(); + status_zap(bl, sce->val4, 0); + if (sc->data[type] != NULL) { // Check if the status still last (can be dead since then). + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); + } + map->freeblock_unlock(); return 0; } break; -- cgit v1.2.3-70-g09d2