Follow up to e27aa8b2d82620aa461291b293e00afb7c79e0cb (#4509)

* Additional configs for boss idle AI
This commit is contained in:
Daegaladh 2020-01-11 15:14:33 +01:00 committed by GitHub
parent fb8a752320
commit 78a02330b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View File

@ -269,8 +269,10 @@ monster_stuck_warning: no
// On small-medium sized servers this can cause all monsters like eggs and Fabre/Pupa to metamorph.
// To switch it off, set it to 0.
mob_nopc_idleskill_rate: 100
boss_nopc_idleskill_rate: 100
// Rate at which monsters move when there are no players nearby (Note 2)
// On official servers monsters always move if they have been spotted once, even if there are no players nearby anymore.
// To switch it off, set it to 0.
mob_nopc_move_rate: 100
boss_nopc_move_rate: 100

View File

@ -8559,6 +8559,8 @@ static const struct _battle_data {
{ "blacksmith_fame_refine_threshold", &battle_config.blacksmith_fame_refine_threshold,10, 1, MAX_REFINE, },
{ "mob_nopc_idleskill_rate", &battle_config.mob_nopc_idleskill_rate, 100, 0, 100, },
{ "mob_nopc_move_rate", &battle_config.mob_nopc_move_rate, 100, 0, 100, },
{ "boss_nopc_idleskill_rate", &battle_config.boss_nopc_idleskill_rate, 100, 0, 100, },
{ "boss_nopc_move_rate", &battle_config.boss_nopc_move_rate, 100, 0, 100, },
#include "../custom/battle_config_init.inc"
};

View File

@ -661,6 +661,8 @@ struct Battle_Config
int blacksmith_fame_refine_threshold;
int mob_nopc_idleskill_rate;
int mob_nopc_move_rate;
int boss_nopc_idleskill_rate;
int boss_nopc_move_rate;
#include "../custom/battle_config_struct.inc"
};

View File

@ -2048,7 +2048,9 @@ static int mob_ai_sub_lazy(struct mob_data *md, va_list args)
{
// Move probability for mobs away from players
// In Aegis, this is 100% for mobs that have been activated by players and none otherwise.
if( mob_is_spotted(md) && rnd()%100 < battle_config.mob_nopc_move_rate )
if( mob_is_spotted(md) &&
((!status_has_mode(&md->status,MD_STATUS_IMMUNE) && rnd()%100 < battle_config.mob_nopc_move_rate) ||
(status_has_mode(&md->status,MD_STATUS_IMMUNE) && rnd()%100 < battle_config.boss_nopc_move_rate)))
mob_randomwalk(md, tick);
}
else if( md->ud.walktimer == INVALID_TIMER )
@ -2058,7 +2060,9 @@ static int mob_ai_sub_lazy(struct mob_data *md, va_list args)
// Probability for mobs far from players from doing their IDLE skill.
// In Aegis, this is 100% for mobs that have been activated by players and none otherwise.
if( mob_is_spotted(md) && rnd()%100 < battle_config.mob_nopc_idleskill_rate )
if( mob_is_spotted(md) &&
((!status_has_mode(&md->status,MD_STATUS_IMMUNE) && rnd()%100 < battle_config.mob_nopc_idleskill_rate) ||
(status_has_mode(&md->status,MD_STATUS_IMMUNE) && rnd()%100 < battle_config.boss_nopc_idleskill_rate)))
mobskill_use(md, tick, -1);
}