summaryrefslogtreecommitdiff
path: root/src/map/mob.c
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/map/mob.c
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/map/mob.c')
-rw-r--r--src/map/mob.c49
1 files changed, 28 insertions, 21 deletions
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);