From 3030557468d39201f86e4b350e6f9d59fd50c3d4 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 23 May 2025 22:50:48 +0200 Subject: [PATCH] ru:: fire missiles work (except attack and limit) --- rogueviz/ru/classes.cpp | 14 ++++++++++++-- rogueviz/ru/entity.cpp | 15 +++++++++++++++ rogueviz/ru/map.ru | 9 +++++---- rogueviz/ru/randeff.cpp | 13 ++++++++++++- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/rogueviz/ru/classes.cpp b/rogueviz/ru/classes.cpp index e769090d..4087c7f3 100644 --- a/rogueviz/ru/classes.cpp +++ b/rogueviz/ru/classes.cpp @@ -237,6 +237,7 @@ struct entity { double get_scale() { return get_scale_at(where.y); } virtual bool freezing() { return false; } + virtual bool burning() { return false; } virtual void hit_wall() {}; virtual void draw(); @@ -609,10 +610,19 @@ struct missile : public entity { missile() { destroyed = false; } xy siz() override { return {4, 4}; } string glyph() override { return "*"; } - color_t color() override { return 0x8080FFFF; } void act() override; - bool freezing() override { return true; } void hit_wall() override { destroyed = true; } }; +struct ice_missile : public missile { + color_t color() override { return 0x8080FFFF; } + bool freezing() override { return true; } + }; + +struct fire_missile : public missile { + int index; + color_t color() override { return gradient(0xFFFF00FF, 0xFF0000FF, -1, sin(index+ticks/100), 1); } + bool burning() override { return true; } + }; + } diff --git a/rogueviz/ru/entity.cpp b/rogueviz/ru/entity.cpp index bbb695e2..7ac34b12 100644 --- a/rogueviz/ru/entity.cpp +++ b/rogueviz/ru/entity.cpp @@ -110,6 +110,10 @@ void entity::apply_walls() { if(walls[b].flags & W_FROZEN) on_ice = true; vel.y /= 2; if(abs(vel.y) < 1e-6) vel.y = 0; + if(burning()) { + if(b == wWoodWall) current_room->replace_block(x, y, wAir); + else hit_wall(); + } if(freezing()) { if(b == wWater) current_room->replace_block(x, y, wFrozen); else if(b != wFrozen) hit_wall(); @@ -129,6 +133,9 @@ void entity::apply_walls() { vel.y /= 2; if(abs(vel.y) < 1e-6) vel.y = 0; if(pixel_to_block(get_pixel_bbox_at(where + vel)).miny > y) where.y += vel.y; + if(burning()) { + if(b == wWoodWall) current_room->replace_block(x, y, wAir); + } goto again; } if((walls[b].flags & W_PAIN) && pain_effect()) goto again; @@ -146,6 +153,10 @@ void entity::apply_walls() { eWall b = current_room->at(x, y); if(walls[b].flags & W_BLOCK) { if(freezing()) { hit_wall(); } + if(burning()) { + if(b == wWoodWall) current_room->replace_block(x, y, wAir); + else hit_wall(); + } vel.x = (vel.x - max(vel.y, 0)/10) / 2; wallhug = true; goto again; @@ -157,6 +168,10 @@ void entity::apply_walls() { eWall b = current_room->at(x, y); if(walls[b].flags & W_BLOCK) { if(freezing()) { hit_wall(); } + if(burning()) { + if(b == wWoodWall) current_room->replace_block(x, y, wAir); + else hit_wall(); + } vel.x = (vel.x + max(vel.y, 0)/10) / 2; wallhug = true; goto again; diff --git a/rogueviz/ru/map.ru b/rogueviz/ru/map.ru index 486e6118..e1c23dfc 100644 --- a/rogueviz/ru/map.ru +++ b/rogueviz/ru/map.ru @@ -1617,6 +1617,7 @@ ROOM Leap of Faith S secret passage X wall sign P platform +W wooden wall MAP ################################################################################ ################################################################################ @@ -1636,10 +1637,10 @@ MAP ..............###.....################.......................................... ..............##.....#################.......................................... ####..........#.....##################.......................................... -####.........P.....###################.......................................... -####..............####################.......................................... -####....!!.......#####################.......................................... -........!b......######################.......................................... +####.........PW....###################.......................................... +####..........W...####################.......................................... +####....!!....W..#####################.......................................... +........!b....W.######################.......................................... ######################################.......................................... ############SS########################.......................................... ############--########################.......................................... diff --git a/rogueviz/ru/randeff.cpp b/rogueviz/ru/randeff.cpp index 0daa92ba..db59c484 100644 --- a/rogueviz/ru/randeff.cpp +++ b/rogueviz/ru/randeff.cpp @@ -70,7 +70,18 @@ randeff health_bubbles("Bubbles", "When you are attacked, you produce red bubble }); // fire powers -randeff fire_spit("Fiery Spit", "Lets you spit fire.", "You feel fire in your mouth!", [] (data &d) { }); +randeff fire_spit("Fiery Spit", "Lets you spit fire.", "You feel fire in your mouth!", [] (data &d) { + if(d.mode == rev::start || (d.mode == rev::active && d.keystate == 1)) + for(int i=1; i<10; i++) { + auto d = m.get_dat(); + auto mi = std::make_unique(); + mi->where = m.where + xy(m.facing * m.get_scale() * m.siz().y * 0.45, 0); + mi->vel = m.vel + xy(m.facing * d.modv * i, d.modv * (10-i) / 5.); + mi->clearg(); + mi->index = i; + current_room->entities.emplace_back(std::move(mi)); + } + }); randeff fire_weapon("Fiery Weapon", "Attacks with your [weapon] set things on fire.", "Your hands glow, and your [weapon] burst into flame!", [] (data &d) { }); // morph powers