From be9cf2aec39f2e29990d945f783e3dbc2ad88ae9 Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 3 Apr 2006 18:43:19 +0000 Subject: - Modified Rude-Attacked behaviour so that such skills only triggers when the rude-attacked count is greater than 3. - Added config setting slaves_inherit_mode to determine whether slaves take on their master's aggressive/passive status (defaults to yes) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5890 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/battle.c | 2 ++ src/map/battle.h | 1 + src/map/mob.c | 20 +++++++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/map/battle.c b/src/map/battle.c index 2851f0c88..e618d4e87 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3580,6 +3580,7 @@ static const struct battle_data_short { { "no_spawn_on_player", &battle_config.no_spawn_on_player }, { "plant_spawn_delay", &battle_config.plant_spawn_delay }, { "boss_spawn_delay", &battle_config.boss_spawn_delay }, + { "slaves_inherit_mode", &battle_config.slaves_inherit_mode }, { "slaves_inherit_speed", &battle_config.slaves_inherit_speed }, { "summons_inherit_effects", &battle_config.summons_inherit_effects }, { "pc_damage_walk_delay_rate", &battle_config.pc_walk_delay_rate }, @@ -3961,6 +3962,7 @@ void battle_set_defaults() { battle_config.no_spawn_on_player=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.summons_inherit_effects=1; battle_config.pc_walk_delay_rate=20; diff --git a/src/map/battle.h b/src/map/battle.h index bdfbd90e5..c7b913b54 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -154,6 +154,7 @@ extern struct Battle_Config { unsigned short mob_count_rate; unsigned short no_spawn_on_player; //[Skotlex] unsigned short mob_spawn_delay, plant_spawn_delay, boss_spawn_delay; // [Skotlex] + unsigned short slaves_inherit_mode; unsigned short slaves_inherit_speed; unsigned short summons_inherit_effects; unsigned short pc_walk_delay_rate; //Adjusts can't walk delay after being hit for players. [Skotlex] diff --git a/src/map/mob.c b/src/map/mob.c index c5d9c44e5..41a68180e 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2494,7 +2494,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id) { struct mob_data *md; struct spawn_data data; - int count = 0,k=0; + int count = 0,k=0,mode; nullpo_retr(0, md2); nullpo_retr(0, value); @@ -2510,6 +2510,8 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id) if(mobdb_checkid(value[0]) == 0) return 0; + mode = status_get_mode(&md2->bl); + while(count < 5 && mobdb_checkid(value[count])) count++; if(count < 1) return 0; if (amount > 0 && amount < count) { //Do not start on 0, pick some random sub subset [Skotlex] @@ -2536,9 +2538,21 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id) md= mob_spawn_dataset(&data); - if (battle_config.slaves_inherit_speed && md2->db->mode&MD_CANMOVE + if (battle_config.slaves_inherit_speed && mode&MD_CANMOVE && (skill_id != NPC_METAMORPHOSIS && skill_id != NPC_TRANSFORMATION)) md->speed=md2->speed; + + //Inherit the aggressive mode of the master. + if (battle_config.slaves_inherit_mode) { + md->mode = md->db->mode; + if (mode&MD_AGGRESSIVE) + md->mode |= MD_AGGRESSIVE; + else + md->mode &=~MD_AGGRESSIVE; + if (md->mode == md->db->mode) + md->mode = 0; //No change. + } + md->special_state.cached= battle_config.dynamic_mobs; //[Skotlex] if (!battle_config.monster_class_change_full_recover && @@ -2763,7 +2777,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) case MSC_SKILLUSED: // specificated skill used flag = ((event & 0xffff) == MSC_SKILLUSED && ((event >> 16) == c2 || c2 == 0)); break; case MSC_RUDEATTACKED: - flag = (!md->attacked_id && md->attacked_count > 0); + flag = (md->attacked_count >= 3); if (flag) md->attacked_count = 0; //Rude attacked count should be reset after the skill condition is met. Thanks to Komurka [Skotlex] break; case MSC_MASTERHPLTMAXRATE: -- cgit v1.2.3-70-g09d2