// replace clif_calc_walkdelay with this!
static int clif_calc_walkdelay(struct block_list *bl,int delay, int type, int damage, int div_)
{
if (type == 4 || type == 9 || damage <=0)
return 0;
if (bl->type == BL_PC)
{
if (battle_config.pc_walk_delay_rate != 100)
delay = delay*battle_config.pc_walk_delay_rate/100;
}
//else if (bl->type == BL_MOB && status_get_mode(bl)&MD_BOSS)
//{
// delay = delay * 10/100;
//}
else if (battle_config.walk_delay_rate != 100)
delay = delay*battle_config.walk_delay_rate/100;
if (div_ > 1) //Multi-hit skills mean higher delays.
delay += battle_config.multihit_delay*(div_-1);
if (bl->type == BL_PC)
{
TBL_PC *sd = BL_CAST(BL_PC, bl);
nullpo_retr(delay>0?delay:1, sd);
sd->hit_tick = gettick();
}
return delay>0?delay:1; //Return 1 to specify there should be no noticeable delay, but you should stop walking.
}
// this is for server-side skill delays to prevent no-delay shit
// these numbers are chosen based off testing done by goodgamersro and proro staff, investigating it myself felt like a waste of time
static int skill_min_delay(struct map_session_data *sd, int skill_id)
{
int min = battle_config.min_skill_delay_limit?battle_config.min_skill_delay_limit:200; //the 200 is arbitrarily chosen
int minimum_min = min;
static int instance = 0;
unsigned int time = gettick();
switch(skill_id)
{
case AL_HEAL:
case MG_FIREBOLT:
case MG_COLDBOLT:
case MG_LIGHTNINGBOLT:
case MG_SOULSTRIKE:
case WZ_EARTHSPIKE:
case WZ_JUPITEL:
case AS_GRIMTOOTH:
case CR_SHIELDCHARGE:
case CR_SHIELDBOOMERANG:
case PA_SHIELDCHAIN:
case SN_FALCONASSAULT:
case WS_CARTTERMINATION:
min = 192;
break;
case SM_BASH:
case PA_PRESSURE:
case AC_DOUBLE:
case SN_SHARPSHOOTING:
case NJ_HYOUSENSOU:
case NJ_KAMAITACHI:
case NJ_BAKUENRYU:
min = 224;
break;
case CR_DEVOTION:
case SA_DISPEL:
case AL_BLESSING:
min = 312;
break;
case HW_GANBANTEIN:
case SA_LANDPROTECTOR:
min = 480;
break;
case WZ_HEAVENDRIVE:
min = 512;
break;
case PR_STRECOVERY:
case PR_LEXAETERNA:
case HT_DETECTING:
case SL_KAUPE:
case SL_KAITE:
min = 544;
break;
case AC_SHOWER:
min = 768;
break;
}
if ( min > minimum_min && DIFF_TICK(time, sd->hit_tick) < minimum_min*5 ) // that is, you've been hit between now ~600 ms ago
min = minimum_min;
return max(min, minimum_min);
}
// add this to pc_authok around the other timers
sd->hit_tick = last_tick; //probably not necessary but do it anyways
// add this to struct map_session_data (pc.h)
unsigned int hit_tick;