1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-26 07:02:49 +00:00

a message on spikes hurt

This commit is contained in:
Zeno Rogue 2025-05-14 17:56:38 +02:00
parent 0ffb805ce8
commit 82bc85ee60
2 changed files with 11 additions and 1 deletions

View File

@ -221,6 +221,10 @@ struct entity {
virtual void attacked(int s) {}
virtual void spiked() {
reduce_hp(10);
}
virtual string glyph() = 0;
virtual color_t color() = 0;
@ -283,6 +287,12 @@ struct man : public entity {
string get_help() override { return "This is you."; }
void on_kill() override;
virtual void spiked() {
entity::spiked();
addMessage("OUCH! These spikes hurt!");
}
};
extern man m;

View File

@ -97,7 +97,7 @@ void entity::apply_walls() {
auto pain_effect = [&] {
if(!hurt_by_spikes()) return false;
reduce_hp(10);
spiked();
vel.x = -vel.x; vel.y = -vel.y; apply_grav();
return true;
};