mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2026-05-11 17:32:07 +00:00
ru:: saws
This commit is contained in:
@@ -507,6 +507,32 @@ struct rope_platform : public moving_platform {
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
struct saw: public entity {
|
||||
unique_ptr<entity> base;
|
||||
string glyph() override { return "*"; }
|
||||
color_t color() override { return walls[wWall].color; }
|
||||
xy siz() override { return {18, 18}; }
|
||||
string get_name() override { return "circular saw"; }
|
||||
void act() override;
|
||||
};
|
||||
|
||||
struct weaksaw : public saw {
|
||||
color_t color() override { return walls[wWeakWall].color; }
|
||||
string get_name() override { return "weak saw"; }
|
||||
void attacked(int s, power *p) override;
|
||||
};
|
||||
|
||||
struct woodsaw : public saw {
|
||||
color_t color() override { return walls[wWoodWall].color; }
|
||||
string get_name() override { return "wooden saw"; }
|
||||
void attacked(int s, power *p) override;
|
||||
};
|
||||
|
||||
struct fakesaw : public saw {
|
||||
void attacked(int s, power *p) override;
|
||||
void act() override;
|
||||
};
|
||||
|
||||
/* entities with a defined 'respawn' location */
|
||||
struct located_entity : public entity {
|
||||
xy respawn;
|
||||
|
||||
@@ -669,6 +669,52 @@ void moving_platform::act() {
|
||||
where = location_at(gframeid);
|
||||
}
|
||||
|
||||
void saw::act() {
|
||||
auto b = base->as_platform();
|
||||
if(!b) { addMessage("You have a vision of an otherworldly saw!"); existing = false; return; }
|
||||
where = b->location_at(gframeid);
|
||||
auto bb = get_pixel_bbox();
|
||||
if(intersect(bb, m.get_pixel_bbox())) {
|
||||
if(m.reduce_hp(40)) addMessage("The " + get_name() + " shreds you!");
|
||||
}
|
||||
}
|
||||
|
||||
void weaksaw::attacked(int s, power *p) {
|
||||
if(p->flags & WEAPON_AXE) {
|
||||
addMessage("You smash the " + get_name() + "!");
|
||||
existing = false;
|
||||
}
|
||||
}
|
||||
|
||||
void woodsaw::attacked(int s, power *p) {
|
||||
if(p == fire_power) {
|
||||
addMessage("You incinerate the " + get_name() + "!");
|
||||
existing = false;
|
||||
}
|
||||
}
|
||||
|
||||
void fakesaw::act() {
|
||||
auto b = base->as_platform();
|
||||
if(!b) { addMessage("You have a vision of an otherworldly saw!"); existing = false; return; }
|
||||
where = b->location_at(gframeid);
|
||||
auto bb = get_pixel_bbox();
|
||||
if(intersect(bb, m.get_pixel_bbox())) {
|
||||
addMessage("This " + get_name() + " turned out to be an illusion!");
|
||||
existing = false;
|
||||
}
|
||||
if(m.can_see(self)) {
|
||||
addMessage("You realize that the " + get_name() + " is an illusion!");
|
||||
existing = false;
|
||||
}
|
||||
}
|
||||
|
||||
void fakesaw::attacked(int s, power *p) {
|
||||
if(p == thief_power) {
|
||||
addMessage("Your attack goes right through the " + get_name() + "!");
|
||||
existing = false;
|
||||
}
|
||||
}
|
||||
|
||||
void entity::apply_walls_reflect() {
|
||||
int loopcount = 0;
|
||||
again:
|
||||
|
||||
@@ -326,6 +326,26 @@ void load_room(fhstream& f, cell *c) {
|
||||
b->a = get_xy(); b->b = get_xy(); b->period = get_ld(); b->shift = get_ld(); b->ratio = get_ld();
|
||||
r.entities.emplace_back(std::move(b));
|
||||
}
|
||||
else if(cap == "SAW") {
|
||||
auto b = std::make_unique<saw>(); nam(*b);
|
||||
b->base = std::move(r.entities.back());
|
||||
r.entities.back() = std::move(b);
|
||||
}
|
||||
else if(cap == "WOODSAW") {
|
||||
auto b = std::make_unique<woodsaw>(); nam(*b);
|
||||
b->base = std::move(r.entities.back());
|
||||
r.entities.back() = std::move(b);
|
||||
}
|
||||
else if(cap == "WEAKSAW") {
|
||||
auto b = std::make_unique<weaksaw>(); nam(*b);
|
||||
b->base = std::move(r.entities.back());
|
||||
r.entities.back() = std::move(b);
|
||||
}
|
||||
else if(cap == "FAKESAW") {
|
||||
auto b = std::make_unique<fakesaw>(); nam(*b);
|
||||
b->base = std::move(r.entities.back());
|
||||
r.entities.back() = std::move(b);
|
||||
}
|
||||
else if(cap == "HINT") {
|
||||
auto b = std::make_unique<hint>();
|
||||
b->respawn = get_xy(); b->size = get_xy();
|
||||
|
||||
Reference in New Issue
Block a user