1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-25 10:57:59 +00:00

ru:: guinea pigs

This commit is contained in:
Zeno Rogue
2025-08-04 19:56:19 +02:00
parent 02cea1ad28
commit 09209e56e0
4 changed files with 198 additions and 37 deletions

View File

@@ -635,6 +635,23 @@ struct bat : public enemy {
int max_hp() { return 10; }
};
struct guineapig : public enemy {
int ca;
bool falling;
int spindir, respawn_spindir;
ld pigvel;
xy siz() override { return {10, 10}; }
string glyph() override { return "G"; }
color_t color() override { return 0xD0A0A0FF; }
void act() override;
void attacked(int s) override;
string get_name() override { return "guinea pig"; }
string get_help() override { return "A standard dungeon guinea pig."; }
void regenerate() override { enemy::regenerate(); falling = true; spindir = respawn_spindir; }
int base_xp() { return 30; }
int max_hp() { return 300; }
};
struct hint : public entity {
string hint_text;
int state;

View File

@@ -670,6 +670,78 @@ void bat::act() {
}
}
void guineapig::act() {
if(falling) {
stay_on_screen();
kino();
if(on_floor) { ca = 0; falling = false; }
return;
}
auto nonblocked = [this] (int angle, int mul) {
auto w1 = from_hyper(eupush(to_hyper(where)) * xspinpush0(angle * 45._deg * spindir, pigvel * mul));
auto obb = pixel_to_block(get_pixel_bbox());
auto nbb = pixel_to_block(get_pixel_bbox_at(w1));
auto jbb = join(obb, nbb);
flagtype blocking = (W_BLOCK | W_BLOCKBIRD);
bool ok = true;
if(w1.x < 0 || w1.x > screen_x || w1.y < 0 || w1.y > screen_y) ok = false;
for(int x = obb.minx; x < obb.maxx; x++) for(int y = obb.maxy; y < jbb.maxy; y++) {
eWall b = current_room->at(x, y);
if(walls[b].flags & blocking) ok = false;
}
for(int x = obb.minx; x < obb.maxx; x++) for(int y = jbb.miny; y < obb.miny; y++) {
eWall b = current_room->at(x, y);
if(walls[b].flags & blocking) ok = false;
}
for(int x = nbb.minx; x < nbb.maxx; x++) for(int y = jbb.miny; y < jbb.maxy; y++) {
eWall b = current_room->at(x, y);
if(walls[b].flags & blocking) ok = false;
}
for(int x = obb.maxx; x < jbb.maxx; x++) for(int y = jbb.miny; y < jbb.maxy; y++) {
eWall b = current_room->at(x, y);
if(walls[b].flags & blocking) ok = false;
}
return pair(w1, ok);
};
for(int s: {1, 2, 3}) {
for(int i=0; i<8; i++) {
if(!nonblocked(ca+i-3, s).second) {
for(int j=i+1; j<i+8; j++) {
if(nonblocked(ca+j-3, s).second) {
where = nonblocked(ca = gmod(ca+j-3, 8), s).first;
if(intersect(get_pixel_bbox(), m.get_pixel_bbox())) {
if(m.reduce_hp(15)) {
addMessage("The guinea pig bites you!");
spindir *= -1;
}
}
return;
}
}
}
}
}
falling = true; vel = xy(0, 0);
}
void guineapig::attacked(int dmg) {
enemy::attacked(dmg);
spindir *= -1;
}
void vtrap::act() {
auto v = vel;
stay_on_screen();

View File

@@ -870,53 +870,53 @@ OK
MOVE 3 Central Cavern
ROOM Central Cavern Bottom Right
# wall
' smashed door
+ door
- staircase
. air
A platform
B secret passage
| column
MAP
....#....#.-..........-....#A..........#########################################
....#....+..-........-.....#A..........#########################################
....#....+...-......-......#A...........########################################
....##########AAAAA-########A............#######################################
....#.............-.#......#A.............++....................................
....#............-..#......#A.............+b....................................
....#...........-...#......#A............#######################################
....#..........-....#......#A...........##.#####################################
....#.........-.....+......#A..........##..#####################################
....#........-......+......#A........####..#####################################
....###AAAAA-###############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
....#.............-.#......#A.............''....................................
....#............-..#......#A.............'b....................................
....#...........-...#......#A............##########-############################
....#..........-....#......#A...........###########-############################
....#.........-.....+......#A..........############-....########################
....#........-......+......#A........##############-....########################
....###AAAAA-###############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#b
NPC 56 14 FF00FFFF
@Commoner
Do you like the Central Cavern?
@@ -2545,3 +2545,68 @@ MAP
######..............||......||..................................................
#b#b#b..............|b......|b..................................................
OK
MOVE 3 Central Cavern Bottom Right
ROOM Guinea Pig Pen
# wall
- staircase
. air
A platform
MAP
############################--##################################################
############################--##################################################
############################...............................................#####
############################...............................................#####
############################...............................................#####
############################..########...........#########.................#####
############################..########...........#########....##########...#####
############################..########...........#########....##########...#####
############################..########....####................##########...#####
############################..########....####................##########...#####
############################..............####.............................#####
############################..............####...####......................#####
############################..............####...####......................#####
############################....########..####...####..........####...##...#####
############################....########..####...####..........####...##...#####
############################....########.........####..#####...####...##...#####
############################....########.........####..#####...####...##...#####
############################....########.........####..#####...####...##...#####
############################....########...............#####...####...##...#####
############################...........................#####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
GUINEAPIG 270 24 .25 1
GUINEAPIG 287 92 .25 1
GUINEAPIG 284 164 .25 1
GUINEAPIG 345 41 .25 1
GUINEAPIG 355 154 .25 1
GUINEAPIG 355 204 .25 1
GUINEAPIG 430 24 .25 1
GUINEAPIG 407 73 .25 1
GUINEAPIG 412 191 .25 1
GUINEAPIG 469 99 .25 1
GUINEAPIG 456 165 .25 1
GUINEAPIG 520 90 .25 1
GUINEAPIG 567 87 .25 1
GUINEAPIG 529 27 .25 1
GUINEAPIG 535 186 .25 1
GUINEAPIG 484 229 .25 1
OK

View File

@@ -224,6 +224,13 @@ void load_room(fhstream& f, cell *c) {
b->respawn = b->where; b->postfix();
r.entities.emplace_back(std::move(b));
}
else if(cap == "GUINEAPIG") {
auto b = std::make_unique<guineapig>();
sscanf(param.c_str(), "%lf%lf%lf%d", &b->where.x, &b->where.y, &b->pigvel, &b->spindir);
b->pigvel /= game_fps; b->falling = true; b->vel = xy{0,0};
b->respawn = b->where; b->respawn_spindir = b->spindir; b->postfix();
r.entities.emplace_back(std::move(b));
}
else if(cap == "VTRAP") {
auto b = std::make_unique<vtrap>();
sscanf(param.c_str(), "%lf%lf", &b->where.x, &b->where.y);