Skip to content
Permalink
Browse files

Follow up to e27aa8b (#4509)

* Additional configs for boss idle AI
  • Loading branch information
Daegaladh committed Jan 11, 2020
1 parent fb8a752 commit 78a02330b22176166d56c3fa8a7df04533c646c0
Showing with 14 additions and 4 deletions.
  1. +2 −0 conf/battle/monster.conf
  2. +4 −2 src/map/battle.cpp
  3. +2 −0 src/map/battle.hpp
  4. +6 −2 src/map/mob.cpp
@@ -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
@@ -8557,8 +8557,10 @@ static const struct _battle_data {
{ "feature.equipswitch", &battle_config.feature_equipswitch, 1, 0, 1, },
{ "pet_walk_speed", &battle_config.pet_walk_speed, 1, 1, 3, },
{ "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, },
{ "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"
};
@@ -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"
};
@@ -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);
}

0 comments on commit 78a0233

Please sign in to comment.
You can’t perform that action at this time.