summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorgepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-09 23:18:01 +0000
committergepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-09 23:18:01 +0000
commitd1ef5355c484c6de06224551caf977b0ae1d3497 (patch)
tree9c7874175ab390678ce6797dba51b6a3f031d8da /src/map/mob.c
parent77c0db2f2cf420d70ce9c00e46d72d3506f5c9df (diff)
downloadhercules-d1ef5355c484c6de06224551caf977b0ae1d3497.tar.gz
hercules-d1ef5355c484c6de06224551caf977b0ae1d3497.tar.bz2
hercules-d1ef5355c484c6de06224551caf977b0ae1d3497.tar.xz
hercules-d1ef5355c484c6de06224551caf977b0ae1d3497.zip
Fixed battle configs `boss_delay_spawn`, `plant_delay_spawn` and `mob_delay_spawn` not being properly applied if changed during runtime (with `@reloadbattleconf` or `setbattleflag`) (bugreport:5204)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15416 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c20
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;