Added monster config as https://rathena.org/board/topic/101136-toggle-for-loot-search-type-closest-vs-random/
* `monster_loot_search_type` default is `1` for official behavior in e6caa95, and `0` for old Athena style -closest- item. Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
This commit is contained in:
parent
cbdc01271d
commit
3028c871e3
@ -99,6 +99,11 @@ monster_damage_delay_rate: 100
|
||||
// 1 = Monster will not consume the item.
|
||||
monster_loot_type: 0
|
||||
|
||||
// How does monster search floor item to loot?
|
||||
// 0: Closest (old Athena style)
|
||||
// 1: Oldest in range (Official)
|
||||
monster_loot_search_type: 1
|
||||
|
||||
// Chance of mob casting a skill (Note 2)
|
||||
// Higher rates lead to 100% mob skill usage with no/few normal attacks.
|
||||
// Set to 0 to disable mob skills.
|
||||
|
@ -7982,6 +7982,7 @@ static const struct _battle_data {
|
||||
{ "pet_ignore_infinite_def", &battle_config.pet_ignore_infinite_def, 0, 0, 1, },
|
||||
{ "homunculus_evo_intimacy_need", &battle_config.homunculus_evo_intimacy_need, 91100, 0, INT_MAX, },
|
||||
{ "homunculus_evo_intimacy_reset", &battle_config.homunculus_evo_intimacy_reset, 1000, 0, INT_MAX, },
|
||||
{ "monster_loot_search_type", &battle_config.monster_loot_search_type, 1, 0, 1, },
|
||||
};
|
||||
|
||||
#ifndef STATS_OPT_OUT
|
||||
|
@ -587,6 +587,7 @@ extern struct Battle_Config
|
||||
int pet_ignore_infinite_def; // Makes fixed damage of petskillattack2 ignores infinite defense
|
||||
int homunculus_evo_intimacy_need;
|
||||
int homunculus_evo_intimacy_reset;
|
||||
int monster_loot_search_type;
|
||||
} battle_config;
|
||||
|
||||
void do_init_battle(void);
|
||||
|
@ -1175,11 +1175,18 @@ static int mob_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap)
|
||||
target = va_arg(ap,struct block_list**);
|
||||
|
||||
dist = distance_bl(&md->bl, bl);
|
||||
if (mob_can_reach(md,bl,dist+1, MSS_LOOT) && ((*target) == NULL || md->target_id > bl->id)) {
|
||||
if (mob_can_reach(md,bl,dist+1, MSS_LOOT) && (
|
||||
(*target) == NULL ||
|
||||
(battle_config.monster_loot_search_type && md->target_id > bl->id) ||
|
||||
(!battle_config.monster_loot_search_type && !check_distance_bl(&md->bl, *target, dist)) // New target closer than previous one.
|
||||
))
|
||||
{
|
||||
(*target) = bl;
|
||||
md->target_id = bl->id;
|
||||
md->min_chase = md->db->range3;
|
||||
}
|
||||
else if (!battle_config.monster_loot_search_type)
|
||||
mob_stop_walking(md, 1); // Stop walking immediately if item is no longer on the ground.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user