summaryrefslogtreecommitdiff
path: root/src
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 /src
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
Diffstat (limited to 'src')
-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
6 files changed, 38 insertions, 27 deletions
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