Fixed bugreport:4109 battle ground guardians will now follow nearby allies when no foes are in range.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16208 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
886ca9c647
commit
6f784872ba
@ -1122,6 +1122,22 @@ static int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*==========================================
|
||||||
|
* finds nearby bg ally for guardians looking for users to follow.
|
||||||
|
*------------------------------------------*/
|
||||||
|
static int mob_ai_sub_hard_bg_ally(struct block_list *bl,va_list ap) {
|
||||||
|
struct mob_data *md;
|
||||||
|
struct block_list **target;
|
||||||
|
|
||||||
|
nullpo_ret(bl);
|
||||||
|
md=va_arg(ap,struct mob_data *);
|
||||||
|
target= va_arg(ap,struct block_list**);
|
||||||
|
|
||||||
|
if( status_check_skilluse(&md->bl, bl, 0, 0) && battle_check_target(&md->bl,bl,BCT_ENEMY)<=0 ) {
|
||||||
|
(*target) = bl;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
* loot monster item search
|
* loot monster item search
|
||||||
@ -1528,6 +1544,18 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
|
|||||||
if (!tbl) { //No targets available.
|
if (!tbl) { //No targets available.
|
||||||
if (mode&MD_ANGRY && !md->state.aggressive)
|
if (mode&MD_ANGRY && !md->state.aggressive)
|
||||||
md->state.aggressive = 1; //Restore angry state when no targets are available.
|
md->state.aggressive = 1; //Restore angry state when no targets are available.
|
||||||
|
|
||||||
|
/* bg guardians follow allies when no targets nearby */
|
||||||
|
if( md->bg_id && mode&MD_CANATTACK ) {
|
||||||
|
if( md->ud.walktimer != INVALID_TIMER )
|
||||||
|
return true;/* we are already moving */
|
||||||
|
map_foreachinrange (mob_ai_sub_hard_bg_ally, &md->bl, view_range, BL_PC, md, &tbl, mode);
|
||||||
|
if( tbl ) {
|
||||||
|
if( distance_blxy(&md->bl, tbl->x, tbl->y) <= 3 || unit_walktobl(&md->bl, tbl, 1, 1) )
|
||||||
|
return true;/* we're moving or close enough don't unlock the target. */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//This handles triggering idle walk/skill.
|
//This handles triggering idle walk/skill.
|
||||||
mob_unlocktarget(md, tick);
|
mob_unlocktarget(md, tick);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user