ソースを参照

- Modified slaves_inherit_speed and slaves_inherit_mode so you get better control of when to copy/remove modes/speed.
- Reenabled usage of mode MD_CHANGETARGET, so mobs with mode 0x200 will be able to switch targets while attacking.
- Simplified some more the chase-changetarget function.


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

skotlex 18 年 前
コミット
be7935af91
9 ファイル変更64 行追加33 行削除
  1. 5 0
      Changelog-Trunk.txt
  2. 6 0
      conf-tmpl/Changelog.txt
  3. 15 6
      conf-tmpl/battle/monster.conf
  4. 2 2
      src/map/battle.c
  5. 1 1
      src/map/clif.c
  6. 1 1
      src/map/map.c
  7. 28 21
      src/map/mob.c
  8. 5 1
      src/map/status.c
  9. 1 1
      src/map/status.h

+ 5 - 0
Changelog-Trunk.txt

@@ -4,6 +4,11 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/11/22
+	* Modified slaves_inherit_speed and slaves_inherit_mode so you get better
+	  control of when to copy/remove modes/speed. See the conf changelog for
+	  details. [Skotlex]
+	* Reenabled usage of mode MD_CHANGETARGET, so mobs with mode 0x200 will be
+	  able to switch targets while attacking. [Skotlex]
 	* Some cleanups around usage of session[] in the map server, hoping that it
 	  may fix some not very likely crashes. [Skotlex]
 	* Rewrote a few messy @ commands. [Skotlex]

+ 6 - 0
conf-tmpl/Changelog.txt

@@ -1,5 +1,11 @@
 Date	Added
 
+2006/11/22
+	* Modified slaves_inherit_speed (monster.conf): 0 never. 1 - when the
+	  master can move. 2 - when the master can't move. 3 - always (default)
+	* Also modified slaves_inherit_mode: 0 don't change mode. 1 slaves are
+	  always aggressive. 2 slaves are always passive. 3 they copy the
+	  agro/passive mode from their master. Defaults to 2.
 2006/11/20
 	* Added monster_ai&0x200 (monster.conf). When set, mob skill delays are
 	  shared. That is, if the mob has several lines with the same skill, when the

+ 15 - 6
conf-tmpl/battle/monster.conf

@@ -139,12 +139,21 @@ no_spawn_on_player: 0
 // map regardless of what the mob-spawn file says.
 force_random_spawn: no
 
-// Do summon slaves inherit the passive/aggressive traits of their master? (Note 1)
-slaves_inherit_mode: yes
-
-// Do summon slaves have the same walking speed as their master? (Note 1)
-// NOTE: The default is yes for official servers.
-slaves_inherit_speed: yes
+// Do summon slaves inherit the passive/aggressive traits of their master?
+// 0: No, retain original mode.
+// 1: Slaves are always aggressive.
+// 2: Slaves are always passive.
+// 3: Same as master's aggressive/passive state.
+slaves_inherit_mode: 2
+
+// Do summon slaves have the same walking speed as their master?
+// NOTE: The default is 3 for official servers.
+// 0: Never.
+// 1: If the master can walk
+// 2: If the master can't walk (even motionless mobs have a speed
+//    entry in their mob_db)
+// 3: Always
+slaves_inherit_speed: 3
 
 // Will summoned monsters (alchemists, or @summon'ed monsters) attack cause a
 // chance of triggering the master's autospell cards? (Note 1)

+ 2 - 2
src/map/battle.c

@@ -3957,8 +3957,8 @@ void battle_set_defaults() {
 	battle_config.force_random_spawn=0;
 	battle_config.plant_spawn_delay=100;
 	battle_config.boss_spawn_delay=100;
-	battle_config.slaves_inherit_mode=1;
-	battle_config.slaves_inherit_speed=1;
+	battle_config.slaves_inherit_mode=2;
+	battle_config.slaves_inherit_speed=3;
  	battle_config.summons_trigger_autospells=1; 
 	battle_config.pc_walk_delay_rate=20;
 	battle_config.walk_delay_rate=100;

+ 1 - 1
src/map/clif.c

@@ -8399,7 +8399,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
 		clif_send_homdata(sd,0,0);
 		clif_homskillinfoblock(sd);
 		//Homunc mimic their master's speed on each map change. [Skotlex]
-		if (battle_config.slaves_inherit_speed)
+		if (battle_config.slaves_inherit_speed&1)
 			status_calc_bl(&sd->hd->bl, SCB_SPEED);
 	}
 

+ 1 - 1
src/map/map.c

@@ -3527,7 +3527,7 @@ int inter_config_read(char *cfgName)
 
 int map_sql_init(void){
 
-    mysql_init(&mmysql_handle);
+	mysql_init(&mmysql_handle);
 
 	//DB connection start
 	ShowInfo("Connecting to the Map DB Server....\n");

+ 28 - 21
src/map/mob.c

@@ -728,7 +728,7 @@ static int mob_can_changetarget(struct mob_data* md, struct block_list* target,
 	
 	switch (md->state.skillstate) {
 		case MSS_BERSERK: //Only Assist, Angry or Aggressive+CastSensor mobs can change target while attacking.
-			if (mode&(MD_ASSIST|MD_ANGRY) || (mode&(MD_AGGRESSIVE|MD_CASTSENSOR)) == (MD_AGGRESSIVE|MD_CASTSENSOR))
+			if (mode&(MD_ASSIST|MD_ANGRY|MD_CHANGETARGET) || (mode&(MD_AGGRESSIVE|MD_CASTSENSOR)) == (MD_AGGRESSIVE|MD_CASTSENSOR))
 				return (battle_config.mob_ai&0x4 || check_distance_bl(&md->bl, target, 3));
 			else
 				return 0;
@@ -837,24 +837,18 @@ static int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap)
 	target= va_arg(ap,struct block_list**);
 
 	//If can't seek yet, not an enemy, or you can't attack it, skip.
-	if ((*target) == bl || battle_check_target(&md->bl,bl,BCT_ENEMY)<=0 || !status_check_skilluse(&md->bl, bl, 0, 0))
+	if ((*target) == bl ||
+		battle_check_target(&md->bl,bl,BCT_ENEMY)<=0 ||
+	  	!status_check_skilluse(&md->bl, bl, 0, 0))
 		return 0;
 
-	switch (bl->type)
-	{
-	case BL_PC:
-	case BL_HOM:	//[orn]
-	case BL_MOB:
-		if(battle_check_range (&md->bl, bl, md->status.rhw.range))
-	  	{
-			(*target) = bl;
-			md->target_id=bl->id;
-			md->min_chase= md->db->range3;
-			return 1;
-		}
-		break;
+	if(battle_check_range (&md->bl, bl, md->status.rhw.range))
+  	{
+		(*target) = bl;
+		md->target_id=bl->id;
+		md->min_chase= md->db->range3;
 	}
-	return 0;
+	return 1;
 }
 
 
@@ -2499,11 +2493,24 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id)
 			md->status.hp = md->status.max_hp*hp_rate/100;
 
 		//Inherit the aggressive mode of the master.
-		if (battle_config.slaves_inherit_mode && md->master_id) {
-			if (md2->status.mode&MD_AGGRESSIVE)
-				sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 0);
-			else
-				sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, 0, MD_AGGRESSIVE, 0);
+		if (battle_config.slaves_inherit_mode && md->master_id)
+	  	{
+			switch (battle_config.slaves_inherit_mode) {
+			case 1: //Always aggressive
+				if (!(md->status.mode&MD_AGGRESSIVE))
+					sc_start4(&md->bl, SC_MODECHANGE, 100,1,0, MD_AGGRESSIVE, 0, 0);
+				break;
+			case 2: //Always passive
+				if (md->status.mode&MD_AGGRESSIVE)
+					sc_start4(&md->bl, SC_MODECHANGE, 100,1,0, 0, MD_AGGRESSIVE, 0);
+				break;
+			default: //Copy master.
+				if (md2->status.mode&MD_AGGRESSIVE)
+					sc_start4(&md->bl, SC_MODECHANGE, 100,1,0, MD_AGGRESSIVE, 0, 0);
+				else
+					sc_start4(&md->bl, SC_MODECHANGE, 100,1,0, 0, MD_AGGRESSIVE, 0);
+				break;
+			}
 		}
 
 		clif_skill_nodamage(&md->bl,&md->bl,skill_id,amount,1);

+ 5 - 1
src/map/status.c

@@ -1313,7 +1313,8 @@ int status_calc_mob(struct mob_data* md, int first)
 
 	if (flag&8 && mbl) {
 		struct status_data *mstatus = status_get_base_status(mbl);
-		if (mstatus)
+		if (mstatus &&
+			battle_config.slaves_inherit_speed&(status->mode&MD_CANMOVE?1:2))
 			status->speed = mstatus->speed;
 	}
 		
@@ -4607,6 +4608,9 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 			struct status_data *bstatus = status_get_base_status(bl);
 			if (!bstatus) return 0;
 			mode = val2?val2:bstatus->mode; //Base mode
+			//Mode added AND removed? Added has priority.
+			if ((val3&val4))
+				val4&= ~(val3&val4);
 			if (val3) mode|= val3; //Add mode
 			if (val4) mode&=~val4; //Del mode
 			if (mode == bstatus->mode) { //No change.

+ 1 - 1
src/map/status.h

@@ -418,7 +418,7 @@ extern int percentrefinery[5][MAX_REFINE+1]; //The last slot always has a 0% suc
 #define MD_PLANT 0x040
 #define MD_CANATTACK 0x080
 #define MD_DETECTOR 0x100
-//#define MD_CHANGETARGET 0x200 //Mode deprecated, figured out through mob_can_changetarget()
+#define MD_CHANGETARGET 0x200
 #define MD_CHANGECHASE 0x400
 #define MD_ANGRY 0x800
 #define MD_MASK 0xFFF