diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-12-26 15:07:18 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-12-26 15:07:18 +0000 |
commit | 5abd5bd1f8f53b73560cecd4496bfd4bc2acc226 (patch) | |
tree | 1599a2cfc0f4079ce75a649e04542bdc1d8d06d7 /src/map/mob.c | |
parent | 391ac7a8a4aedafe818d0559a2011722fa54163c (diff) | |
download | hercules-5abd5bd1f8f53b73560cecd4496bfd4bc2acc226.tar.gz hercules-5abd5bd1f8f53b73560cecd4496bfd4bc2acc226.tar.bz2 hercules-5abd5bd1f8f53b73560cecd4496bfd4bc2acc226.tar.xz hercules-5abd5bd1f8f53b73560cecd4496bfd4bc2acc226.zip |
- Cleaned up some more the code so it works for -DTURBO
- Cleaned the pvpoff @ and script commands.
- mob_get_random_id now has two additional flags to specify that the monster to acquire should not be a boss type (4) or that it should give exp (8).
- TK_MISSION will now pick any mob from the DB as long as it is not a boss type and it gives base exp.
- Fixed the double-stone issue when hitting a petrified character.
- Minor cleanups
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9573 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 935e80384..f2fdaabe2 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -237,15 +237,17 @@ struct mob_data* mob_spawn_dataset(struct spawn_data *data) * 1: poring list * 2: bloody branch list * flag: - * &1: Apply the summon success chance found in the list. + * &1: Apply the summon success chance found in the list (otherwise get any monster from the db) * &2: Apply a monster check level. + * &4: Selected monster should not be a boss type + * &8: Selected monster must give base exp. * lv: Mob level to check against *------------------------------------------ */ int mob_get_random_id(int type, int flag, int lv) { struct mob_db *mob; - int i=0, k=0, class_; + int i=0, class_; if(type < 0 || type >= MAX_RANDOMMONSTER) { if (battle_config.error_log) ShowError("mob_get_random_id: Invalid type (%d) of random monster.\n", type); @@ -253,11 +255,14 @@ int mob_get_random_id(int type, int flag, int lv) { } do { class_ = rand() % MAX_MOB_DB; - if (flag&1) - k = rand() % 1000000; mob = mob_db(class_); - } while ((mob == mob_dummy || mob->summonper[type] <= k || - (flag&2 && lv < mob->lv)) && (i++) < MAX_MOB_DB); + } while ((mob == mob_dummy || + (flag&1 && mob->summonper[type] <= rand() % 1000000) || + (flag&2 && lv < mob->lv) || + (flag&4 && mob->status.mode&MD_BOSS) || + (flag&8 && mob->base_exp < 1) + ) && (i++) < MAX_MOB_DB); + if(i >= MAX_MOB_DB) class_ = mob_db_data[0]->summonper[type]; return class_; @@ -1738,7 +1743,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) if (hp||sp) status_heal(src, hp, sp, battle_config.show_hp_sp_gain?2:0); if (sd->mission_mobid == md->class_) { //TK_MISSION [Skotlex] - if (++sd->mission_count >= 100 && (temp = mob_get_random_id(0, 0, sd->status.base_level))) + if (++sd->mission_count >= 100 && (temp = mob_get_random_id(0,0xC, sd->status.base_level))) { pc_addfame(sd, 1); sd->mission_mobid = temp; |