浏览代码

Monster idle skills, chase, final cleanups
- Spotted monsters will now use their idle skills even if no players are on the map
* This is official behavior and allows them to metamorph and heal up even if nobody is on the map
* I originally had concerns about the performance, but as the dynamic mobs option is enabled by default and set to 5 minutes, monsters will only stay "spotted" for 5 minutes when nobody is on the map anyway, this doesn't cost much extra performance
- Increased chase range of monsters by 2
* Tested this thoroughly and the effective chase range is actually 2 cells larger than listed in the "Range3" column
* Special thanks to ultramage and Michieru for helping me testing this
- Some final cleanups in the unit_stop_attack and unit_stop_stepaction functions
* Special thanks to icxbb-xx for pointing these out

Playtester 10 年之前
父节点
当前提交
464dd45863
共有 2 个文件被更改,包括 7 次插入9 次删除
  1. 3 1
      src/map/mob.c
  2. 4 8
      src/map/unit.c

+ 3 - 1
src/map/mob.c

@@ -1775,7 +1775,7 @@ static int mob_ai_sub_lazy(struct mob_data *md, va_list args)
 		if( rnd()%1000 < MOB_LAZYMOVEPERC(md) )
 			mob_randomwalk(md, tick);
 	}
-	else if( md->ud.walktimer == INVALID_TIMER && map[md->bl.m].users > 0 )
+	else if( md->ud.walktimer == INVALID_TIMER )
 	{
 		//Because it is not unset when the mob finishes walking.
 		md->state.skillstate = MSS_IDLE;
@@ -3781,6 +3781,8 @@ static bool mob_parse_dbrow(char** str)
 		if (db->range3 < db->range2)
 			db->range3 = db->range2;
 	}
+	//Tests showed that chase range is effectively 2 cells larger than expected [Playtester]
+	db->range3 += 2;
 
 	status->size = atoi(str[22]);
 	status->race = atoi(str[23]);

+ 4 - 8
src/map/unit.c

@@ -2066,9 +2066,9 @@ int unit_set_target(struct unit_data* ud, int target_id)
 void unit_stop_attack(struct block_list *bl)
 {
 	struct unit_data *ud;
-	nullpo_ret(bl);
+	nullpo_retv(bl);
 	ud = unit_bl2ud(bl);
-	nullpo_ret(ud);
+	nullpo_retv(ud);
 
 	//Clear target
 	unit_set_target(ud, 0);
@@ -2079,8 +2079,6 @@ void unit_stop_attack(struct block_list *bl)
 	//Clear timer
 	delete_timer(ud->attacktimer, unit_attack_timer);
 	ud->attacktimer = INVALID_TIMER;
-
-	return;
 }
 
 /**
@@ -2090,9 +2088,9 @@ void unit_stop_attack(struct block_list *bl)
 void unit_stop_stepaction(struct block_list *bl)
 {
 	struct unit_data *ud;
-	nullpo_ret(bl);
+	nullpo_retv(bl);
 	ud = unit_bl2ud(bl);
-	nullpo_ret(ud);
+	nullpo_retv(ud);
 
 	//Clear remembered step action
 	ud->stepaction = false;
@@ -2106,8 +2104,6 @@ void unit_stop_stepaction(struct block_list *bl)
 	//Clear timer
 	delete_timer(ud->steptimer, unit_step_timer);
 	ud->steptimer = INVALID_TIMER;
-	
-	return;
 }
 
 /**