diff --git a/rogueviz/ru/classes.cpp b/rogueviz/ru/classes.cpp index 768e37df..762b896f 100644 --- a/rogueviz/ru/classes.cpp +++ b/rogueviz/ru/classes.cpp @@ -652,6 +652,19 @@ struct guineapig : public enemy { int max_hp() { return 300; } }; +struct icicle : public enemy { + bool falling; + vector fallframes; + xy siz() override { return {10, 10}; } + string glyph() override { return "|"; } + color_t color() override { return 0xA0A0F0FF; } + void act() override; + string get_name() override { return "icicle"; } + string get_help() override { return "A dangerous looking icicle."; } + int base_xp() { return 1; } + int max_hp() { return 1; } + }; + struct hint : public entity { string hint_text; int state; diff --git a/rogueviz/ru/entity.cpp b/rogueviz/ru/entity.cpp index 8f39fa22..bed14616 100644 --- a/rogueviz/ru/entity.cpp +++ b/rogueviz/ru/entity.cpp @@ -792,4 +792,30 @@ void disnake::act() { } } +void icicle::act() { + fallthru = true; + if(fallframes.empty()) { + while(isize(fallframes) < 9999) { + fallframes.push_back(where); + kino(); + if(on_floor) break; + } + regenerate(); + } + if(!falling) { + auto w = m.where; + for(auto f: fallframes) { + if(intersect(get_pixel_bbox_at(f), m.get_pixel_bbox_at(w))) falling = true; + w += m.vel; + } + } + if(falling) { + kino(); + if(on_floor) existing = false; + } + if(intersect(get_pixel_bbox(), m.get_pixel_bbox())) { + if(m.reduce_hp(50)) addMessage("An icicle falls on you!"); + } + } + } diff --git a/rogueviz/ru/map.ru b/rogueviz/ru/map.ru index e729e1dc..5a020de7 100644 --- a/rogueviz/ru/map.ru +++ b/rogueviz/ru/map.ru @@ -1557,6 +1557,10 @@ MAP ################################################################################ #b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b ROPE 300 0 0.7 50 5 0 60 +ICICLE 60 60 +ICICLE 552 63 +ICICLE 597 118 +ICICLE 577 151 OK MOVE 1 Swinging Rope Room diff --git a/rogueviz/ru/save.cpp b/rogueviz/ru/save.cpp index 4b4477b5..130ca42d 100644 --- a/rogueviz/ru/save.cpp +++ b/rogueviz/ru/save.cpp @@ -231,6 +231,13 @@ void load_room(fhstream& f, cell *c) { b->respawn = b->where; b->respawn_spindir = b->spindir; b->postfix(); r.entities.emplace_back(std::move(b)); } + else if(cap == "ICICLE") { + auto b = std::make_unique(); + sscanf(param.c_str(), "%lf%lf", &b->where.x, &b->where.y); + b->falling = false; b->vel = xy{0,0}; + b->respawn = b->where; b->postfix(); + r.entities.emplace_back(std::move(b)); + } else if(cap == "VTRAP") { auto b = std::make_unique(); sscanf(param.c_str(), "%lf%lf", &b->where.x, &b->where.y);