mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-21 17:07:40 +00:00
ru:: magic fountain respawns enemies and refills potions
This commit is contained in:
@@ -2,6 +2,28 @@ namespace rogue_unlike {
|
||||
|
||||
void handle_powers(data& d);
|
||||
|
||||
bool on_fountain;
|
||||
room *fountain_room;
|
||||
|
||||
void check_fountains() {
|
||||
bool next_on_fountain = false;
|
||||
auto bb = pixel_to_block(m.get_pixel_bbox());
|
||||
for(int x = bb.minx; x < bb.maxx; x++) for(int y = bb.miny; y < bb.maxy; y++) {
|
||||
eWall b = current_room->at(x, y);
|
||||
println(hlog, tuple(x, y, int(b)));
|
||||
if(b == wFountain) next_on_fountain = true;
|
||||
}
|
||||
if(next_on_fountain && !on_fountain) {
|
||||
fountain_room = current_room;
|
||||
addMessage("A magic fountain! You feel safe and refill your potions.");
|
||||
m.hp = m.max_hp();
|
||||
for(auto& p: powers) p.refill();
|
||||
for(auto& r: rooms) for(auto& e: r.second.entities) e->regenerate();
|
||||
current_target = nullptr;
|
||||
}
|
||||
swap(on_fountain, next_on_fountain);
|
||||
}
|
||||
|
||||
void man::act() {
|
||||
kino();
|
||||
|
||||
@@ -31,6 +53,8 @@ void man::act() {
|
||||
if(dat.dx) facing = dat.dx;
|
||||
|
||||
current_room->fov_from(where.x / block_x, where.y / block_y);
|
||||
|
||||
check_fountains();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user