added fallback for human gold generation upon death

This commit is contained in:
2024-07-25 11:28:11 -04:00
parent 535533206f
commit 546909b4aa

View File

@ -14,6 +14,10 @@ const char *human::get_race_name() const {
int human::dies(level *lvl) {
lvl->add_gold(gold{pos, GOLD_NORMAL});
auto plist = lvl->get_available_around_all(pos);
lvl->add_gold(gold{rng->get_rand_in_vector(plist), GOLD_NORMAL});
if (plist.size())
lvl->add_gold(gold{rng->get_rand_in_vector(plist), GOLD_NORMAL});
else
lvl->add_gold(gold{pos, GOLD_NORMAL});
return 0;
}