This issue is being logged based on a discord conversation with me and BareKnuckleRoo
When monsters with an acid attack type drop flesh, that flesh is set to damage the player when consumed. This damage is applied directly to the player, and does not check for any resistances.
Inside treasure.cpp: fix_flesh_item()
/* if donor has some attacktypes, the flesh is poisonous */
if (donor->attacktype&AT_POISON)
item->type = POISON;
if (donor->attacktype&AT_ACID)
item->stats.hp = -1*item->stats.food;
Inside food.cpp: check_heal_and_mana(),
/* check for hp, sp change */
if (food->stats.hp != 0 && !is_wraith_pl(who)) {
if (QUERY_FLAG(food, FLAG_CURSED)) {
safe_strncpy(who->contr->killer, food->name,
sizeof(who->contr->killer));
hit_player(who, food->stats.hp, food, AT_POISON, 1);
draw_ext_info(NDI_UNIQUE, 0, who, MSG_TYPE_APPLY, MSG_TYPE_APPLY_CURSED,
"Eck!...that was poisonous!");
} else {
if (food->stats.hp > 0)
draw_ext_info(NDI_UNIQUE, 0, who, MSG_TYPE_APPLY, MSG_TYPE_APPLY_SUCCESS,
"You begin to feel better.");
else
draw_ext_info(NDI_UNIQUE, 0, who, MSG_TYPE_APPLY, MSG_TYPE_APPLY_CURSED,
"Eck!...that was poisonous!");
who->stats.hp += food->stats.hp;
}
}
I am not sure the best way to fix this - hoping someone with more understanding might provide some thoughts.
It seems that hit_player() would need to be called to factor in resistances, so I suppose a possible path forward would be:
- set the attack_type on the generated flesh to match that of the monster
- check if the consumed food will damage the player (FLAG_CURSED, or .hp < 0)
- if food will damage player and has an attack_type, call hit_player(attack_type)
- otherwise, use existing behaviour (cursed food is treated as poison, uncursed damaging food is just deducted)