diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-08-08 01:55:58 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-08-08 01:55:58 +0000 |
commit | 12c59ee92f231545497b901bf16fee77f080bfea (patch) | |
tree | a5ac684163795a0ab89a1164066c5ea3fe7d75a9 /src/map/mob.c | |
parent | f325738db0ff69176476cac7f11e0460bfdbcba4 (diff) | |
download | hercules-12c59ee92f231545497b901bf16fee77f080bfea.tar.gz hercules-12c59ee92f231545497b901bf16fee77f080bfea.tar.bz2 hercules-12c59ee92f231545497b901bf16fee77f080bfea.tar.xz hercules-12c59ee92f231545497b901bf16fee77f080bfea.zip |
- Fixed some missing max levels for npc skills
- Expanded isloggedin script command to support an optional argument (char id)
- Expanded warpparty command to accept target "Leader", this will warp the party to the leader.
- Added a summon structure to handle non-dead-branch mob-groups since the current implementation totally fails for mob groups that don't have MANY integrants
- Fixed mobs not attempting an IDLE skill right before unlocking a target.
- Removed a useless variable in the pet_data structure
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10961 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 60c5ad603..a7c8f878c 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -56,6 +56,12 @@ struct mob_db *mob_db(int index) { if (index < 0 || index > MAX_MOB_DB || mob_db static struct eri *item_drop_ers; //For loot drops delay structures. static struct eri *item_drop_list_ers; + +static struct { + int qty; + int class_[150]; +} summon[MAX_RANDOMMONSTER]; + #define CLASSCHANGE_BOSS_NUM 21 /*========================================== @@ -249,7 +255,10 @@ int mob_get_random_id(int type, int flag, int lv) return 0; } do { - class_ = rand() % MAX_MOB_DB; + if (type) + class_ = summon[type].class_[rand()%summon[type].qty]; + else //Dead branch + class_ = rand() % MAX_MOB_DB; mob = mob_db(class_); } while ((mob == mob_dummy || mob_is_clone(class_) || @@ -986,7 +995,7 @@ int mob_unlocktarget(struct mob_data *md,int tick) md->state.skillstate = MSS_IDLE; case MSS_IDLE: // Idle skill. - if (!(++md->ud.walk_count%IDLE_SKILL_INTERVAL) && + if ((md->target_id || !(++md->ud.walk_count%IDLE_SKILL_INTERVAL)) && mobskill_use(md, tick, -1)) break; //Random walk. @@ -3555,6 +3564,8 @@ static int mob_read_randommonster(void) "mob_boss.txt", "mob_pouch.txt"}; + memset(&summon, 0, sizeof(summon)); + for(i=0;i<MAX_RANDOMMONSTER;i++){ mob_db_data[0]->summonper[i] = 1002; // 設定し忘れた場合はポリンが出るようにしておく sprintf(line, "%s/%s", db_path, mobfile[i]); @@ -3565,7 +3576,7 @@ static int mob_read_randommonster(void) } while(fgets(line, sizeof(line), fp)) { - int class_,per; + int class_; if(line[0] == '/' && line[1] == '/') continue; memset(str,0,sizeof(str)); @@ -3579,9 +3590,22 @@ static int mob_read_randommonster(void) continue; class_ = atoi(str[0]); - per=atoi(str[2]); - if(mob_db(class_) != mob_dummy) - mob_db_data[class_]->summonper[i]=per; + if(mob_db(class_) == mob_dummy) + continue; + mob_db_data[class_]->summonper[i]=atoi(str[2]); + if (i) { + if (summon[i].qty < sizeof(summon[i].class_)/sizeof(summon[i].class_[0])) //MvPs + summon[i].class_[summon[i].qty++] = class_; + else { + ShowDebug("Can't store more random mobs from %s, increase size of mob.c:summon variable!\n", mobfile[i]); + break; + } + } + } + if (i && !summon[i].qty) + { //At least have the default here. + summon[i].class_[0] = mob_db_data[0]->summonper[i]; + summon[i].qty = 1; } fclose(fp); ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n",mobfile[i]); |