1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-08-28 16:32:18 +00:00

ru:: icicles can now bounce to return to the top

This commit is contained in:
Zeno Rogue 2025-08-05 00:03:42 +02:00
parent 120698379f
commit c4af27b763
2 changed files with 14 additions and 7 deletions

View File

@ -653,7 +653,7 @@ struct guineapig : public enemy {
}; };
struct icicle : public enemy { struct icicle : public enemy {
bool falling; int state;
vector<xy> fallframes; vector<xy> fallframes;
xy siz() override { return {10, 10}; } xy siz() override { return {10, 10}; }
string glyph() override { return "|"; } string glyph() override { return "|"; }

View File

@ -802,19 +802,26 @@ void icicle::act() {
} }
regenerate(); regenerate();
} }
if(!falling) { if(state == 0) {
auto w = m.where; auto w = m.where;
for(auto f: fallframes) { for(auto f: fallframes) {
if(intersect(get_pixel_bbox_at(f), m.get_pixel_bbox_at(w))) falling = true; if(intersect(get_pixel_bbox_at(f), m.get_pixel_bbox_at(w))) state = 1;
w += m.vel; w += m.vel;
} }
} }
if(falling) { if(state == 1) {
kino(); kino();
if(on_floor) existing = false; if(on_floor && vel.y > 0) existing = false;
if(vel.y < 0) state = 2;
} }
if(intersect(get_pixel_bbox(), m.get_pixel_bbox())) { if(state == 2) {
if(m.reduce_hp(50)) addMessage("An icicle falls on you!"); kino();
if(vel.y >= 0) state = 0;
}
if(state != 0) {
if(intersect(get_pixel_bbox(), m.get_pixel_bbox())) {
if(m.reduce_hp(50)) addMessage("An icicle falls on you!");
}
} }
} }