summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-11-22 20:32:25 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-11-22 20:32:25 +0000
commit46c2eeef1fb61d251afe62f123c8f0cc6e25a7a2 (patch)
tree6c2d771580a35911711a0101cc4b1ca5e67bd896
parent3fe27e962cf2084d380b6229fcc07c47d0c51e67 (diff)
downloadhercules-46c2eeef1fb61d251afe62f123c8f0cc6e25a7a2.tar.gz
hercules-46c2eeef1fb61d251afe62f123c8f0cc6e25a7a2.tar.bz2
hercules-46c2eeef1fb61d251afe62f123c8f0cc6e25a7a2.tar.xz
hercules-46c2eeef1fb61d251afe62f123c8f0cc6e25a7a2.zip
- 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9294 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt5
-rw-r--r--conf-tmpl/Changelog.txt6
-rw-r--r--conf-tmpl/battle/monster.conf21
-rw-r--r--src/map/battle.c4
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/map.c2
-rw-r--r--src/map/mob.c49
-rw-r--r--src/map/status.c6
-rw-r--r--src/map/status.h2
9 files changed, 64 insertions, 33 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 3ceb2c3b1..231be57cf 100644
--- a/Changelog-Trunk.txt
+++ b/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]
diff --git a/conf-tmpl/Changelog.txt b/conf-tmpl/Changelog.txt
index 25a21f4eb..7c8a5cb6d 100644
--- a/conf-tmpl/Changelog.txt
+++ b/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
diff --git a/conf-tmpl/battle/monster.conf b/conf-tmpl/battle/monster.conf
index c0436d26c..7549ea3e8 100644
--- a/conf-tmpl/battle/monster.conf
+++ b/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)
diff --git a/src/map/battle.c b/src/map/battle.c
index dca3f27f5..20e6e345a 100644
--- a/src/map/battle.c
+++ b/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;
diff --git a/src/map/clif.c b/src/map/clif.c
index 8e468515d..c221f5e8c 100644
--- a/src/map/clif.c
+++ b/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);
}
diff --git a/src/map/map.c b/src/map/map.c
index e5f266b9e..5e4ea6b9e 100644
--- a/src/map/map.c
+++ b/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");
diff --git a/src/map/mob.c b/src/map/mob.c
index a1adac8fb..a53b5717b 100644
--- a/src/map/mob.c
+++ b/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);
diff --git a/src/map/status.c b/src/map/status.c
index dcc1f9e1d..4c78c26ea 100644
--- a/src/map/status.c
+++ b/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.
diff --git a/src/map/status.h b/src/map/status.h
index d8da56888..5723a5cde 100644
--- a/src/map/status.h
+++ b/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