1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-29 21:13:00 +00:00

ru:: deadly traps

This commit is contained in:
Zeno Rogue
2025-05-16 23:51:09 +02:00
parent 355d98f80d
commit 65f0ce2f0e
4 changed files with 118 additions and 11 deletions

View File

@@ -581,6 +581,21 @@ void bat::act() {
}
}
void vtrap::act() {
auto v = vel;
stay_on_screen();
apply_walls_reflect();
if(v.y * vel.y < 0) {
auto dat = get_dat();
vel.y = (rand() % 100 + 100) * (vel.y > 0 ? 1 : -1) * 0.005 * dat.modv * dat.d;
}
apply_vel();
if(intersect(get_pixel_bbox(), m.get_pixel_bbox())) {
if(m.reduce_hp(200)) addMessage("The trap zaps you!");
}
}
void kestrel::attacked(int dmg) {
enemy::attacked(dmg);
if(where.x < m.where.x) vel.x = -abs(vel.x);