The code of casting buffs is scattered over multiple places. It makes development and maintenance harder.
During non-combat, buffs, like Heal, Armor, are handled in:
process_creature_self_spell_casting(), called in the end of update_creature().
During combat, they are handled in:
get_best_self_preservation_instance_to_use(), called in many places of combat code.
In my opinion, get_best_self_preservation_instance_to_use() is not being used properly. Its name is inconsistent with its usage.
It is now used in get_best_ranged_offensive_weapon() and get_best_combat_weapon_instance_to_use() and they might return the value of get_best_self_preservation_instance_to_use(). However, get_best_self_preservation_instance_to_use() does NOT return a "WEAPON" or any offensive spell.
Also, creature_would_benefit_from_healing() and creature_requires_healing() are duplicated code.
The code of casting buffs is scattered over multiple places. It makes development and maintenance harder.
During non-combat, buffs, like Heal, Armor, are handled in: process_creature_self_spell_casting(), called in the end of update_creature().
During combat, they are handled in: get_best_self_preservation_instance_to_use(), called in many places of combat code. In my opinion, get_best_self_preservation_instance_to_use() is not being used properly. Its name is inconsistent with its usage. It is now used in get_best_ranged_offensive_weapon() and get_best_combat_weapon_instance_to_use() and they might return the value of get_best_self_preservation_instance_to_use(). However, get_best_self_preservation_instance_to_use() does NOT return a "WEAPON" or any offensive spell.
Also, creature_would_benefit_from_healing() and creature_requires_healing() are duplicated code.