Browse Source

- Idle skills won't trigger while the mob is walking.
- Idle skills will now trigger each IDLE_SKILL_INTERVAL iterations (10 currently)
- Added support for walk packet 0x22c (disabled currently as it's non-walk packet equivalent is yet missing), it will be used when PACKETVER is set to 7 or above.
- Normal walking will now also trigger mob skills (due to the walk skill condition)
- Updated mob_skill_db: all idle and walk skills had their rate go up x10.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6245 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 years ago
parent
commit
cb00c164f7
6 changed files with 239 additions and 192 deletions
  1. 8 0
      Changelog-Trunk.txt
  2. 1 0
      db/Changelog.txt
  3. 177 177
      db/mob_skill_db.txt
  4. 39 1
      src/map/clif.c
  5. 9 8
      src/map/mob.c
  6. 5 6
      src/map/unit.c

+ 8 - 0
Changelog-Trunk.txt

@@ -3,6 +3,14 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 2006/04/23
+	* Idle skills won't trigger while the mob is walking (that is for the state
+	  "walk") [Skotlex]
+	* Idle skills will now trigger each IDLE_SKILL_INTERVAL iterations (10
+	  currently) [Skotlex]
+	* Added support for walk packet 0x22c, will be used when PACKETVER is set
+	  to 7 or above (packetver is still set to 6 for now) [Skotlex]
+	* Normal walking will now also trigger mob skills (due to the walk skill
+	  condition)  [Skotlex]
 	* additional experience multiplicator as mapflags which is based off battle.conf
 	  so with battle.conf rates 200 and "mapflag <jexp/bexp> 200" it will be 4x 
 	  on this specific map and 2x anywhere else [Jbain]

+ 1 - 0
db/Changelog.txt

@@ -28,6 +28,7 @@
 =========================
 
 04/23
+	* Updated mob_skill_db: all idle and walk skills had their rate up x10. [Skotlex]
 	* Put in most of the Kiel Hyre monster drops, at temporary low rates. [MasterOfMuppets]
 	* Updated some loot sell prices for the Kiel Hyre/Odin Temple monsters [MasterOfMuppets]
 	* NPC_CHANGE<property> should be self, not target [Vicious]

File diff suppressed because it is too large
+ 177 - 177
db/mob_skill_db.txt


+ 39 - 1
src/map/clif.c

@@ -981,7 +981,45 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
 	lv = status_get_lv(bl);
 	
 	if(pcdb_checkid(vd->class_)) { 
-#if PACKETVER > 3
+#if PACKETVER > 6
+		//Packet 0x22c, still in construction. [Skotlex]
+		memset(buf,0,packet_len_table[0x22c]);
+
+		WBUFW(buf,0)=0x22c;
+		WBUFL(buf,2)=bl->id;
+		WBUFW(buf,6)=status_get_speed(bl);
+		if (sc) {
+			WBUFW(buf,8)= sc->opt1;
+			WBUFW(buf,10)= sc->opt2;
+			WBUFL(buf,12)= sc->option;
+			WBUFL(buf,48)= sc->opt3;
+		}
+		WBUFW(buf,16)=vd->class_;
+		WBUFW(buf,18)=vd->hair_style;
+		WBUFW(buf,20)=vd->weapon;
+		WBUFW(buf,22)=vd->shield;
+		WBUFW(buf,24)=vd->head_bottom;
+		WBUFL(buf,26)=gettick();
+		WBUFW(buf,30)=vd->head_top;
+		WBUFW(buf,32)=vd->head_mid;
+		WBUFW(buf,34)=vd->hair_color;
+		WBUFW(buf,36)=vd->cloth_color;
+		WBUFW(buf,38)=sd?sd->head_dir:unit_getdir(bl);
+		WBUFL(buf,40)=guild_id;
+		WBUFW(buf,44)=emblem_id;
+		if (sd) {
+			WBUFW(buf,46)=sd->status.manner;
+			WBUFB(buf,52)=sd->status.karma;
+		}
+		WBUFB(buf,53)=vd->sex;
+		WBUFPOS2(buf,54,bl->x,bl->y,ud->to_x,ud->to_y);
+		WBUFB(buf,59)=0x88; // Deals with acceleration in directions. [Valaris]
+		WBUFB(buf,60)=0;
+		WBUFB(buf,61)=0;
+		WBUFW(buf,62)=clif_setlevel(lv);
+
+		return packet_len_table[0x22c];	
+#elif PACKETVER > 3
 		memset(buf,0,packet_len_table[0x1da]);
 
 		WBUFW(buf,0)=0x1da;

+ 9 - 8
src/map/mob.c

@@ -34,6 +34,7 @@
 #include "irc.h"
 
 #define MIN_MOBTHINKTIME 100
+#define IDLE_SKILL_INTERVAL 10	//Active idle skills should be triggered every 1 second (1000/MIN_MOBTHINKTIME)
 
 #define MOB_LAZYSKILLPERC 10	// Probability for mobs far from players from doing their IDLE skill. (rate of 1000 minute)
 #define MOB_LAZYMOVEPERC 50	// Move probability in the negligent mode MOB (rate of 1000 minute)
@@ -983,9 +984,9 @@ int mob_randomwalk(struct mob_data *md,int tick)
 
 	nullpo_retr(0, md);
 
-	speed=status_get_speed(&md->bl);
 	if(DIFF_TICK(md->next_walktime,tick)<0 && unit_can_move(&md->bl)){
 		int i,x,y,c,d=12-md->move_fail_count;
+		speed=status_get_speed(&md->bl);
 		if(d<5) d=5;
 		for(i=0;i<retrycount;i++){	// Search of a movable place
 			int r=rand();
@@ -1247,11 +1248,13 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
 		}
 	}
 
-	// When there's no target, it is idling.
-	md->state.skillstate = MSS_IDLE;
-	if (mobskill_use(md, tick, -1))
-		return 0;
-
+	if(md->ud.walktimer == -1) {
+		// When there's no target, it is idling.
+		// Is it terribly exploitable to reuse the walkcounter for idle state skills? [Skotlex]
+		md->state.skillstate = MSS_IDLE;
+		if (!(++md->ud.walk_count%IDLE_SKILL_INTERVAL) && mobskill_use(md, tick, -1))
+			return 0;
+	}
 	// Nothing else to do... except random walking.
 	// Slaves do not random walk! [Skotlex]
 	if (can_move && !md->master_id)
@@ -2685,7 +2688,6 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
 		//Execute skill	
 		if (skill_get_casttype(ms[i].skill_id) == CAST_GROUND)
 		{
-			// �ê�ŠŽw’è
 			struct block_list *bl = NULL;
 			short x = 0, y = 0;
 			if (ms[i].target <= MST_AROUND) {
@@ -2735,7 +2737,6 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
 			if (!flag) md->skillidx = -1; //Skill failed.
 			return flag;
 		} else {
-			// IDŽw’è
 			if (ms[i].target <= MST_MASTER) {
 				struct block_list *bl;
 				switch (ms[i].target) {

+ 5 - 6
src/map/unit.c

@@ -190,12 +190,11 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data)
 			sc_start(&sd->bl,SC_MIRACLE,100,1,battle_config.sg_miracle_skill_duration);
 		}
 	} else if (md) {
-		if (ud->target && ud->state.attack_continue) {
-			if(md->min_chase > md->db->range2) md->min_chase--;
-			if(!(ud->walk_count%WALK_SKILL_INTERVAL) &&
-				mobskill_use(md, tick, -1))
-				return 0;
-		}
+		if (md->min_chase > md->db->range2) md->min_chase--;
+		//Walk skills are triggered regardless of target due to the idle-walk mob state.
+		if(!(ud->walk_count%WALK_SKILL_INTERVAL) &&
+			mobskill_use(md, tick, -1))
+			return 0;
 	}
 
 	if(ud->state.change_walk_target)

Some files were not shown because too many files changed in this diff