diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index d410aa34..b376c24a 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1717,19 +1717,22 @@ void Creature::CheckSpecObject(int new_poly_flags) RemoveBuffById(kInGrassBuffId); } else { TryAddBuffAndSetTime(this, kInGrassBuffId, 9999999); - if ((room->GetFrameNo() - last_battling_frameno) * FRAME_RATE_MS < - mt::Param::s().battling_grass_hide_delay_time) { - #if 0 + if (battling_grass_hide_delay_timer.expired() && + (room->GetFrameNo() - last_battling_frameno) * FRAME_RATE_MS < + mt::Param::s().battling_disengage_time) { + int dur_time = mt::Param::s().battling_grass_hide_delay_time * FRAME_RATE_MS; battling_grass_hide_delay_timer = room->xtimer.SetTimeoutWpEx ( - dur_time * SERVER_FRAME_RATE, - [] (int event, const a8::Args* args) + dur_time / SERVER_FRAME_RATE, + [this] (int event, const a8::Args* args) { if (a8::TIMER_EXEC_EVENT == event) { + if (HasBuffEffect(kBET_InGrass) && !dead) { + TryAddBuffAndSetTime(this, 8058, 9999999); + } } }, &xtimer_attacher); - #endif } else { TryAddBuffAndSetTime(this, 8058, 9999999); } diff --git a/server/gameserver/mt/Param.h b/server/gameserver/mt/Param.h index aa998320..35c62e73 100644 --- a/server/gameserver/mt/Param.h +++ b/server/gameserver/mt/Param.h @@ -142,6 +142,7 @@ namespace mt int battle_auto_ready_min_time = 0; int battle_auto_ready_max_time = 0; + int battling_disengage_time = 0; int battling_detection_range = 0; int battling_grass_hide_delay_time = 0;