Prevent teleport control from working on twitch redeems to teleport the player

This commit is contained in:
2026-04-22 20:37:00 -07:00
parent 6642a731c7
commit eee77d0f1b

View File

@@ -34,7 +34,7 @@ void check_twitch(void) {
} }
time_t now = getnow(); time_t now = getnow();
if (timet_delta(now, last_check) < 2) { if (timet_delta(now, last_check) < 5) {
return; return;
} }
@@ -94,13 +94,31 @@ staticfn void process_twitch_cmd(char *cmd) {
identify_pack(1, TRUE); identify_pack(1, TRUE);
successful_effect(id); successful_effect(id);
} else if (!strcmp(effect, "teleport")) { } else if (!strcmp(effect, "teleport")) {
/* Temporarily stun the player, if they are not already, to prevent teleport control */
boolean removestun = FALSE;
if (!Stunned) {
removestun = TRUE;
make_stunned(1L, FALSE);
}
tele(); tele();
if (removestun) {
make_stunned(0L, FALSE);
}
successful_effect(id); successful_effect(id);
} else if (!strcmp(effect, "level_teleport")) { } else if (!strcmp(effect, "level_teleport")) {
if (u.uhave.amulet || In_endgame(&u.uz) || In_sokoban(&u.uz)) { if (u.uhave.amulet || In_endgame(&u.uz) || In_sokoban(&u.uz)) {
failed_effect(id); failed_effect(id);
} else { } else {
/* Temporarily stun the player, if they are not already, to prevent teleport control */
boolean removestun = FALSE;
if (!Stunned) {
removestun = TRUE;
make_stunned(1L, FALSE);
}
level_tele(); level_tele();
if (removestun) {
make_stunned(0L, FALSE);
}
successful_effect(id); successful_effect(id);
} }
} else if (!strcmp(effect, "healing")) { } else if (!strcmp(effect, "healing")) {