From d35733732b5594c7e5da8146157a5d59325f0909 Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 12 Dec 2006 21:38:34 +0000 Subject: - Mobs now by default are "everyone's" enemy, so mobs are able to hit each another. - Added monster_ai&0x400 to use the previous 'smart' criteria that prevents mobs from fighting each another. - Moved "unsetting" the angry mode from the mob_ai to the mob_damage function, where it'll work regardless of who hits the mob. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9481 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 3 +++ conf-tmpl/Changelog.txt | 4 ++++ conf-tmpl/battle/monster.conf | 2 ++ src/map/battle.c | 27 +++++++++++++++------------ src/map/mob.c | 20 +++++++++++--------- 5 files changed, 35 insertions(+), 21 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 15a1d224c..b403ba99e 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,9 @@ 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/12/12 + * Mobs now by default are "everyone's" enemy, so mobs are able to hit each another. + * Moved "unsetting" the angry mode from the mob_ai to the mob_damage + function, where it'll work regardless of who hits the mob. * Modifed a bit the clif_change_look function, it should fix crashes with the Xmas sprite when changing maps. * Fixed skills displaying a 32k damage when used while disguised. [Skotlex] diff --git a/conf-tmpl/Changelog.txt b/conf-tmpl/Changelog.txt index 487ec5371..33f7434c8 100644 --- a/conf-tmpl/Changelog.txt +++ b/conf-tmpl/Changelog.txt @@ -1,5 +1,9 @@ Date Added +2006/12/12 + * Added monster_ai&0x400 to use the previous 'smart' criteria that prevents + mobs from fighting each another, since now they are all natural enemies + of each another. [Skotlex] 2006/11/29 * Added Rachel Santuary to nomemo mapflags [Playtester] 2006/11/22 diff --git a/conf-tmpl/battle/monster.conf b/conf-tmpl/battle/monster.conf index 1ea2c822e..66f968c5e 100644 --- a/conf-tmpl/battle/monster.conf +++ b/conf-tmpl/battle/monster.conf @@ -69,6 +69,8 @@ monster_max_aspd: 199 // the same skill, instead of only that particular entry (eg: Mob has heal // on six lines for different conditions, when set, whenever one of the six // trigger, all of them will share the delay) +// 0x400: When set, mobs of the same AI type are allied (by default all mobs are +// enemies of each other). // Example: 0x140 -> Chase players through warps + use skills in random order. monster_ai: 0 diff --git a/src/map/battle.c b/src/map/battle.c index e315142f9..f82153c37 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3254,11 +3254,23 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f case BL_MOB: { TBL_MOB *md = (TBL_MOB*)t_bl; - if(md->state.killer) //Enable retaliation - state |= BCT_ENEMY; - + if (!agit_flag && md->guardian_data && md->guardian_data->guild_id) return 0; //Disable guardians/emperiums owned by Guilds on non-woe times. + if(md->state.killer || !(battle_config.mob_ai&0x400)) + state |= BCT_ENEMY; //By default everyone hates mobs. + else + { //Smart enemy criteria. + if (!md->special_state.ai) { //Normal mobs. + if (s_bl->type == BL_MOB && !((TBL_MOB*)s_bl)->special_state.ai) + state |= BCT_PARTY; //Normal mobs with no ai are friends. + else + state |= BCT_ENEMY; //However, all else are enemies. + } else { + if (s_bl->type == BL_MOB && !((TBL_MOB*)s_bl)->special_state.ai) + state |= BCT_ENEMY; //Natural enemy for AI mobs are normal mobs. + } + } break; } } @@ -3335,15 +3347,6 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f return 0; //Disable guardians/emperium owned by Guilds on non-woe times. if(md->state.killer) // Is on a rampage too :D state |= BCT_ENEMY; - else if (!md->special_state.ai) { //Normal mobs. - if (t_bl->type == BL_MOB && !((TBL_MOB*)t_bl)->special_state.ai) - state |= BCT_PARTY; //Normal mobs with no ai are friends. - else - state |= BCT_ENEMY; //However, all else are enemies. - } else { - if (t_bl->type == BL_MOB && !((TBL_MOB*)t_bl)->special_state.ai) - state |= BCT_ENEMY; //Natural enemy for AI mobs are normal mobs. - } break; } default: diff --git a/src/map/mob.c b/src/map/mob.c index 286146e5c..32deef2bc 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1162,14 +1162,6 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) } } } - if (md->state.aggressive && md->attacked_id == md->target_id) - { //No longer aggressive, change to retaliate AI. - md->state.aggressive = 0; - if(md->state.skillstate== MSS_ANGRY) - md->state.skillstate = MSS_BERSERK; - if(md->state.skillstate== MSS_FOLLOW) - md->state.skillstate = MSS_RUSH; - } //Clear it since it's been checked for already. md->attacked_id = 0; } @@ -1582,8 +1574,18 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) { int char_id = 0, flag = 0; - if (damage > 0) //Store total damage... + if (damage > 0) + { //Store total damage... md->tdmg+=damage; + if (md->state.aggressive) + { //No longer aggressive, change to retaliate AI. + md->state.aggressive = 0; + if(md->state.skillstate== MSS_ANGRY) + md->state.skillstate = MSS_BERSERK; + if(md->state.skillstate== MSS_FOLLOW) + md->state.skillstate = MSS_RUSH; + } + } if(md->guardian_data && md->guardian_data->number < MAX_GUARDIANS) // guardian hp update [Valaris] (updated by [Skotlex]) md->guardian_data->castle->guardian[md->guardian_data->number].hp = md->status.hp; -- cgit v1.2.3-70-g09d2