Notes |
(0029148)
PleasingFungus (administrator)
2015-06-07 21:17
|
This has nothing to do with orcs or friendliness, I think. Monsters will walk into clouds if they think they have enough HP to survive for a few turns, which e.g. high-level orcish followers (knights, warlords) do. The fact that they end up being in the flame clouds for more than a few turns is mainly the result of short-sightedness on their part. (:
Still not ideal, but I'm not sure there's anything to be done from a dev perspective; players may just have to be careful? Monsters being dumb is not a bug, in general... |
|
(0029182)
coledot (reporter)
2015-06-16 06:42
|
I took a quick look at the pathfinding code and found the method mons_travel_cost(). It appears there's no check at all for clouds? I only see terrain & trap-related checks. Could we add something like the following to help intelligent monsters avoid damaging clouds? Pseudocode:
# in mons_travel_cost, between the trap check & return
if monster.intelligent():
if (cloud_exists_at(pos) && mons.vulnerable_to(cloud_type_at(pos)):
return 2;
I'd be willing to code this up if it sounds like a reasonable change. |
|
(0029183)
PleasingFungus (administrator)
2015-06-16 18:26
|
For reference, the existing monster cloud logic is cloud.cc:mons_avoids_cloud(), mainly called from mon-act.cc:mon_can_move_to_pos(). It looks like this is used considerably after the pathfinding code you were looking at; the monster chooses a target destination & a path to it, and then, on each move, uses this logic to decide whether or not it can actually use the tiles with clouds on them.
That's my impression, anyway; certainly this logic is used, I'm just not sure how it interacts with the mon-pathfind stuff. |
|
(0029184)
coledot (reporter)
2015-06-16 19:43
edited on: 2015-06-16 19:45
|
Cool, thanks for the pointer to mons_avoids_cloud(). I took a closer look at the cloud avoidance logic and found a couple of issues with one particular line:
const bool hp_ok = mons->hit_points >= hp_threshold;
hp_threshold appears to be an expected amount of damage that the monster can receive from a cloud each turn. This means that a monster could enter a cloud and potentially die the next turn! This is not ideal for intelligent monsters; I think they should have a larger margin of safety for entering clouds. The check should also be > w/o = for similar reasons: what monster would enter a cloud that could just barely kill it?
I tested the following in wizard mode & it seems to work pretty well. Do you think this is a reasonable change?
// intelligent monsters want a larger margin of safety
int safety_mult = (mons_intel(mons) > I_ANIMAL) ? 2 : 1;
// dare we risk the damage?
const bool hp_ok = mons->hit_points > safety_mult * hp_threshold;
|
|