mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-08-25 15:02:19 +00:00
ru:: bats
This commit is contained in:
parent
0096f5f12b
commit
24222a41a5
@ -325,6 +325,17 @@ struct kestrel : public enemy {
|
||||
string get_help() override { return "A standard dungeon kestrel."; }
|
||||
};
|
||||
|
||||
struct bat : public enemy {
|
||||
int next_change;
|
||||
xy siz() override { return {6, 6}; }
|
||||
string glyph() override { return "B"; }
|
||||
color_t color() override { return 0xD0A0A0FF; }
|
||||
void act() override;
|
||||
void attacked(int s) override;
|
||||
string get_name() override { return "bat"; }
|
||||
string get_help() override { return "A cave bat."; }
|
||||
};
|
||||
|
||||
struct hint : public entity {
|
||||
string hint_text;
|
||||
int state;
|
||||
|
@ -394,6 +394,26 @@ void kestrel::act() {
|
||||
}
|
||||
}
|
||||
|
||||
void bat::act() {
|
||||
if(gframeid >= next_change && gframeid > invinc_end + 300) {
|
||||
next_change = gframeid + 300 + rand() % 300;
|
||||
int angle = rand() % 360;
|
||||
|
||||
auto dat = get_dat();
|
||||
ld v = dat.d * dat.modv;
|
||||
|
||||
vel.x = v * cos(angle);
|
||||
vel.y = v * sin(angle);
|
||||
}
|
||||
|
||||
apply_walls_reflect();
|
||||
apply_vel();
|
||||
|
||||
if(intersect(get_pixel_bbox(), m.get_pixel_bbox())) {
|
||||
if(m.reduce_hp(15)) addMessage("The bat bites you!");
|
||||
}
|
||||
}
|
||||
|
||||
void kestrel::attacked(int dmg) {
|
||||
current_target = this;
|
||||
reduce_hp(dmg);
|
||||
@ -402,4 +422,14 @@ void kestrel::attacked(int dmg) {
|
||||
if(where.x > m.where.x) vel.x = +abs(vel.x);
|
||||
}
|
||||
|
||||
void bat::attacked(int dmg) {
|
||||
current_target = this;
|
||||
reduce_hp(dmg);
|
||||
if(!existing) addMessage("You kill the bat."); else addMessage("You hit the bat.");
|
||||
if(where.x < m.where.x) vel.x = -abs(vel.x);
|
||||
if(where.x > m.where.x) vel.x = +abs(vel.x);
|
||||
if(where.y < m.where.y) vel.y = -abs(vel.y);
|
||||
if(where.y > m.where.y) vel.y = +abs(vel.y);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1166,4 +1166,19 @@ PENDULUM 200 208 303 235 6 0
|
||||
PENDULUM 344 229 513 231 5 0
|
||||
PENDULUM 551 215 554 70 6 0
|
||||
PENDULUM 510 60 60 60 5 0
|
||||
BAT 100 100
|
||||
BAT 200 100
|
||||
BAT 300 100
|
||||
BAT 400 100
|
||||
BAT 500 100
|
||||
BAT 100 160
|
||||
BAT 200 160
|
||||
BAT 300 160
|
||||
BAT 400 160
|
||||
BAT 500 160
|
||||
BAT 100 220
|
||||
BAT 200 220
|
||||
BAT 300 220
|
||||
BAT 400 220
|
||||
BAT 500 220
|
||||
OK
|
||||
|
@ -134,6 +134,12 @@ void load_room(fhstream& f, cell *c) {
|
||||
b->respawn = b->where;
|
||||
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);
|
||||
b->respawn = b->where;
|
||||
r.entities.emplace_back(std::move(b));
|
||||
}
|
||||
else if(cap == "KESTREL") {
|
||||
auto b = std::make_unique<kestrel>();
|
||||
sscanf(param.c_str(), "%lf%lf%lf%lf", &b->where.x, &b->where.y, &b->vel.x, &b->vel.y);
|
||||
|
Loading…
x
Reference in New Issue
Block a user