1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-08-27 07:52:19 +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 {
bool falling;
int state;
vector<xy> fallframes;
xy siz() override { return {10, 10}; }
string glyph() override { return "|"; }

View File

@ -802,19 +802,26 @@ void icicle::act() {
}
regenerate();
}
if(!falling) {
if(state == 0) {
auto w = m.where;
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;
}
}
if(falling) {
if(state == 1) {
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(m.reduce_hp(50)) addMessage("An icicle falls on you!");
if(state == 2) {
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!");
}
}
}