1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-26 15:12:48 +00:00

ru:: fire missiles work (except attack and limit)

This commit is contained in:
Zeno Rogue 2025-05-23 22:50:48 +02:00
parent 37d66c60cc
commit 3030557468
4 changed files with 44 additions and 7 deletions

View File

@ -237,6 +237,7 @@ struct entity {
double get_scale() { return get_scale_at(where.y); } double get_scale() { return get_scale_at(where.y); }
virtual bool freezing() { return false; } virtual bool freezing() { return false; }
virtual bool burning() { return false; }
virtual void hit_wall() {}; virtual void hit_wall() {};
virtual void draw(); virtual void draw();
@ -609,10 +610,19 @@ struct missile : public entity {
missile() { destroyed = false; } missile() { destroyed = false; }
xy siz() override { return {4, 4}; } xy siz() override { return {4, 4}; }
string glyph() override { return "*"; } string glyph() override { return "*"; }
color_t color() override { return 0x8080FFFF; }
void act() override; void act() override;
bool freezing() override { return true; }
void hit_wall() override { destroyed = 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; }
};
} }

View File

@ -110,6 +110,10 @@ void entity::apply_walls() {
if(walls[b].flags & W_FROZEN) on_ice = true; if(walls[b].flags & W_FROZEN) on_ice = true;
vel.y /= 2; vel.y /= 2;
if(abs(vel.y) < 1e-6) vel.y = 0; 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(freezing()) {
if(b == wWater) current_room->replace_block(x, y, wFrozen); if(b == wWater) current_room->replace_block(x, y, wFrozen);
else if(b != wFrozen) hit_wall(); else if(b != wFrozen) hit_wall();
@ -129,6 +133,9 @@ void entity::apply_walls() {
vel.y /= 2; vel.y /= 2;
if(abs(vel.y) < 1e-6) vel.y = 0; 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(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; goto again;
} }
if((walls[b].flags & W_PAIN) && pain_effect()) 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); eWall b = current_room->at(x, y);
if(walls[b].flags & W_BLOCK) { if(walls[b].flags & W_BLOCK) {
if(freezing()) { hit_wall(); } if(freezing()) { hit_wall(); }
if(burning()) {
if(b == wWoodWall) current_room->replace_block(x, y, wAir);
else hit_wall();
}
vel.x = (vel.x - max<ld>(vel.y, 0)/10) / 2; vel.x = (vel.x - max<ld>(vel.y, 0)/10) / 2;
wallhug = true; wallhug = true;
goto again; goto again;
@ -157,6 +168,10 @@ void entity::apply_walls() {
eWall b = current_room->at(x, y); eWall b = current_room->at(x, y);
if(walls[b].flags & W_BLOCK) { if(walls[b].flags & W_BLOCK) {
if(freezing()) { hit_wall(); } if(freezing()) { hit_wall(); }
if(burning()) {
if(b == wWoodWall) current_room->replace_block(x, y, wAir);
else hit_wall();
}
vel.x = (vel.x + max<ld>(vel.y, 0)/10) / 2; vel.x = (vel.x + max<ld>(vel.y, 0)/10) / 2;
wallhug = true; wallhug = true;
goto again; goto again;

View File

@ -1617,6 +1617,7 @@ ROOM Leap of Faith
S secret passage S secret passage
X wall sign X wall sign
P platform P platform
W wooden wall
MAP MAP
################################################################################ ################################################################################
################################################################################ ################################################################################
@ -1636,10 +1637,10 @@ MAP
..............###.....################.......................................... ..............###.....################..........................................
..............##.....#################.......................................... ..............##.....#################..........................................
####..........#.....##################.......................................... ####..........#.....##################..........................................
####.........P.....###################.......................................... ####.........PW....###################..........................................
####..............####################.......................................... ####..........W...####################..........................................
####....!!.......#####################.......................................... ####....!!....W..#####################..........................................
........!b......######################.......................................... ........!b....W.######################..........................................
######################################.......................................... ######################################..........................................
############SS########################.......................................... ############SS########################..........................................
############--########################.......................................... ############--########################..........................................

View File

@ -70,7 +70,18 @@ randeff health_bubbles("Bubbles", "When you are attacked, you produce red bubble
}); });
// fire powers // 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<fire_missile>();
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) { }); 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 // morph powers