record and replay debug kill

This commit is contained in:
2024-08-27 15:59:12 -05:00
committed by Celtic Minstrel
parent 7182e86e08
commit 4335dd5b76
3 changed files with 22 additions and 12 deletions

View File

@@ -1843,6 +1843,24 @@ void debug_leave_town() {
redraw_screen(REFRESH_ALL);
}
void debug_kill() {
if(recording){
record_action("debug_kill", "");
}
for(short i = 0; i < univ.town.monst.size(); i++) {
if(is_combat() && univ.town.monst[i].is_alive() && !univ.town.monst[i].is_friendly())
univ.town.monst[i].active = eCreatureStatus::DEAD;
if(univ.town.monst[i].is_alive() && !univ.town.monst[i].is_friendly()
&& (dist(univ.town.monst[i].cur_loc,univ.party.town_loc) <= 10) )
damage_monst(univ.town.monst[i], 7,1000,eDamageType::SPECIAL,0);
}
// kill_monst(&univ.town.monst[i],6);
draw_terrain();
add_string_to_buf("Debug: Kill things.");
print_buf();
}
bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
bool are_done = false;
location pass_point; // TODO: This isn't needed
@@ -2101,18 +2119,7 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
case 'K':
if(!univ.debug_mode) break;
for(short i = 0; i < univ.town.monst.size(); i++) {
if(is_combat() && univ.town.monst[i].is_alive() && !univ.town.monst[i].is_friendly())
univ.town.monst[i].active = eCreatureStatus::DEAD;
if(univ.town.monst[i].is_alive() && !univ.town.monst[i].is_friendly()
&& (dist(univ.town.monst[i].cur_loc,univ.party.town_loc) <= 10) )
damage_monst(univ.town.monst[i], 7,1000,eDamageType::SPECIAL,0);
}
// kill_monst(&univ.town.monst[i],6);
draw_terrain();
add_string_to_buf("Debug: Kill things.");
print_buf();
debug_kill();
break;
case 'N':

View File

@@ -75,5 +75,6 @@ void debug_give_item();
void debug_print_location();
void debug_step_through();
void debug_leave_town();
void debug_kill();
#endif

View File

@@ -489,6 +489,8 @@ static void replay_next_action() {
debug_step_through();
}else if(t == "debug_leave_town"){
debug_leave_town();
}else if(t == "debug_kill"){
debug_kill();
}
// TODO some of these actions shouldn't call advance_time(). They should return