diff options
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 427b0ae5f..585ebf0af 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -789,7 +789,8 @@ int mob_delayspawn(int tid, unsigned int tick, int id, intptr_t data) *------------------------------------------*/ int mob_setdelayspawn(struct mob_data *md) { - unsigned int spawntime; + unsigned int spawntime, mode; + struct mob_db *db; if (!md->spawn) //Doesn't has respawn data! return unit_free(&md->bl,CLR_DEAD); @@ -798,6 +799,23 @@ int mob_setdelayspawn(struct mob_data *md) if (md->spawn->delay2) //random variance spawntime+= rand()%md->spawn->delay2; + //Apply the spawn delay fix [Skotlex] + db = mob_db(md->spawn->class_); + mode = db->status.mode; + if (mode & MD_BOSS) { //Bosses + if (battle_config.boss_spawn_delay != 100) { + // Divide by 100 first to prevent overflows + //(precision loss is minimal as duration is in ms already) + spawntime = spawntime/100*battle_config.boss_spawn_delay; + } + } else if (mode&MD_PLANT) { //Plants + if (battle_config.plant_spawn_delay != 100) { + spawntime = spawntime/100*battle_config.plant_spawn_delay; + } + } else if (battle_config.mob_spawn_delay != 100) { //Normal mobs + spawntime = spawntime/100*battle_config.mob_spawn_delay; + } + if (spawntime < 500) //Min respawn time (is it needed?) spawntime = 500; |