1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-25 14:43:01 +00:00

ru:: time orbs

This commit is contained in:
Zeno Rogue 2025-05-17 00:50:51 +02:00
parent 65f0ce2f0e
commit 067066df40
5 changed files with 98 additions and 5 deletions

View File

@ -67,6 +67,7 @@ struct room {
bool fov[room_y][room_x];
bool which_map_rendered;
bool infile, need_rerender;
int timed_orb_end;
vector<unique_ptr<struct entity>> entities;
@ -327,6 +328,20 @@ struct pendulum_platform : public moving_platform {
string get_help() override { return "These pendulum platforms go back and forth between two locations, taking the shortest path possible."; }
};
struct timed_orb : public entity {
int duration;
xy siz() override { return {18, 18}; }
string glyph() override { return "O"; }
color_t color() override {
println(hlog, tie(gframeid, current_room->timed_orb_end));
if(gframeid > current_room->timed_orb_end) return 0x8080FFFF;
return gradient(0x404080FF, 0x8080FFFF, -1, cos((gframeid - current_room->timed_orb_end) * TAU * 5 / game_fps), 1);
}
void act() override;
string get_name() override { return "time orb"; }
string get_help() override { return "These orbs activate mechanisms for a limited time."; }
};
struct npc_or_trader : public entity {
string text;
string name;

View File

@ -268,6 +268,19 @@ extern int gold_id;
string shopitem::glyph() { if(bought) return powers[gold_id].get_glyph(); else return item::glyph(); }
color_t shopitem::color() { if(bought) return powers[gold_id].get_color(); else return item::color(); }
void timed_orb::act() {
if(gframeid > current_room->timed_orb_end) {
walls[wTimeDoor].glyph = '+';
walls[wTimeDoor].flags = W_BLOCK | W_BLOCKBIRD;
}
else {
walls[wTimeDoor].glyph = '\'';
walls[wTimeDoor].flags = W_TRANS;
}
if(intersect(get_pixel_bbox(), m.get_pixel_bbox()))
current_room->timed_orb_end = gframeid + duration;
}
void trader::act() {
bool any_purchases = false;
for(auto& e: current_room->entities) if(auto si = e->as_shopitem()) if(!si->existing) any_purchases = true;

View File

@ -58,7 +58,7 @@ struct ruwall {
enum eWall {
wAir, wWall, wBouncy, wSpike, wWater, wFrozen, wDoor, wSmashedDoor,
wLockedDoor, wFountain, wBluePortal, wOrangePortal, wPlatform, wStaircase,
wColumn, wForge, wWoodWall, wShopDoor, wSecretPassage, wSign, wWallSign, wGUARD };
wColumn, wForge, wWoodWall, wShopDoor, wSecretPassage, wSign, wWallSign, wTimeDoor, wGUARD };
flagtype W_BLOCK = 1;
flagtype W_TRANS = 2;
@ -94,6 +94,7 @@ ruwall walls[qwall] = {
{"secret passage", "#", 0xFFFF40FF, W_PLATFORM | W_BLOCKBIRD, "You have discovered a secret passage from the other side."},
{"sign", "X", 0xFFFF40FF, W_TRANS, "You need to wait close to this sign to read it."},
{"wall sign", "X", 0xFFFFC0FF, W_BLOCK, "You need to wait close to this sign to read it."},
{"time door", "#", 0x8080FFFF, W_BLOCK | W_STABLE, "A powerful door, opened by a mechanism."},
};
int sel = 1;

View File

@ -1400,10 +1400,10 @@ MAP
####....XXX.....................................................................
####.....|......................................................................
####.....|......................................................................
####--##########################################################################
####--##########################################################################
####-b............................................^^^^^......^..................
####--.................................^^.........^..........^..................
####--##################################################################--######
####--##################################################################--######
####-b............................................^^^^^......^..........--......
####--.................................^^.........^..........^..........--......
####-b................^...........................^..........^..................
####--#########--.............................^...^..........^.....--###########
####-b##########-.................................^..........^.....-############
@ -1451,3 +1451,60 @@ VTRAP 410 56
VTRAP 420 56
VTRAP 430 56
OK
MOVE 4 Bouncy Spike Maze
ROOM Timed Passage
# wall
' shop door
+ time door
- platform
. air
A staircase
MAP
################################################################################
################################################################################
################################################################################
################################################################################
..........................##..................##################################
..........................##..................##################################
..........................##..................##################################
..........................##..--..--..--..--..##################################
..........................''..................#####################....#####..##
..........................'b..................#####################....####....#
........................###########################################............#
######################--###########################################............#
######################--####################################################--##
##....................-b...................................................+-b..
##.........................................................................+....
##.........................................................................+....
####----#############################################################-------####
#####A...##########################################################......A######
######A...#######################################################......A########
#######A.....#################################################.......A##########
########A.......############################################......A#############
#########A.............#################################........A###############
###########A....................##################............A#################
#############A.......................########...............A###################
#################A........................................A#####################
#####################AA.................................A#######################
############################A........................A##########################
##################################A............A################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
#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
################################################################################
#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
################################################################################
#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
TIMEORB 30 117 3.9
TIMEORB 560 79 20
TRADER 236 67
Jack the trader
Do you want to buy anthing?\n\nSorry for the traps, last week a thief stole my stuff and escaped through some secret door. So I installed some for protection.\n\nNo idea where it is...
OK

View File

@ -180,6 +180,13 @@ void load_room(fhstream& f, cell *c) {
b->respawn = b->where; b->postfix();
r.entities.emplace_back(std::move(b));
}
else if(cap == "TIMEORB") {
auto b = std::make_unique<timed_orb>();
ld dur = 0;
sscanf(param.c_str(), "%lf%lf%lf", &b->where.x, &b->where.y, &dur);
b->duration = dur * game_fps;
r.entities.emplace_back(std::move(b));
}
else if(cap == "BAT") {
auto b = std::make_unique<bat>();
sscanf(param.c_str(), "%lf%lf", &b->where.x, &b->where.y);