new debug action: fight an outdoor encounter
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
<dialog defbtn='okay'>
|
||||
<field name="number" type='int' top='33' left='90' width='75' height='16'/>
|
||||
<pict type='dlog' num='2' top='8' left='8'/>
|
||||
<text name='prompt' size='large' top='8' left='49' width='163' height='16'>How many?</text>
|
||||
<text name='prompt' size='large' top='8' left='49' width='193' height='16'>How many?</text>
|
||||
<button name='okay' type='regular' top='63' left='141'>OK</button>
|
||||
</dialog>
|
||||
|
@@ -52,6 +52,16 @@ cKey charToKey(char ch) {
|
||||
return {false, w('.'), mod_shift};
|
||||
case '!':
|
||||
return {false, w('1'), mod_shift};
|
||||
case '@':
|
||||
return {false, w('2'), mod_shift};
|
||||
case '#':
|
||||
return {false, w('3'), mod_shift};
|
||||
case '$':
|
||||
return {false, w('4'), mod_shift};
|
||||
case '%':
|
||||
return {false, w('5'), mod_shift};
|
||||
case '^':
|
||||
return {false, w('6'), mod_shift};
|
||||
case '?':
|
||||
return {false, w('/'), mod_shift};
|
||||
}
|
||||
|
@@ -1892,25 +1892,8 @@ void handle_menu_spell(eSpell spell_picked) {
|
||||
advance_time(did_something, need_redraw, need_reprint);
|
||||
}
|
||||
|
||||
void initiate_outdoor_combat(short i) {
|
||||
static void set_up_combat() {
|
||||
location to_place;
|
||||
|
||||
draw_terrain();
|
||||
|
||||
// Is combat too easy?
|
||||
if((univ.party.get_level() > ((out_enc_lev_tot(i) * 5) / 3) ) && (out_enc_lev_tot(i) < 200)
|
||||
&& !univ.party.out_c[i].what_monst.cant_flee) {
|
||||
add_string_to_buf("Combat: Monsters fled!");
|
||||
univ.party.out_c[i].exists = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Delay((long) 100,&dummy);
|
||||
|
||||
start_outdoor_combat(univ.party.out_c[i], univ.party.out_loc,count_walls(univ.party.out_loc));
|
||||
|
||||
univ.party.out_c[i].exists = false;
|
||||
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
to_place = pc.combat_pos;
|
||||
@@ -1925,6 +1908,25 @@ void initiate_outdoor_combat(short i) {
|
||||
draw_terrain();
|
||||
}
|
||||
|
||||
void initiate_outdoor_combat(short i) {
|
||||
// Make sure the player can see the monster they stepped next to
|
||||
draw_terrain();
|
||||
|
||||
// Is combat too easy?
|
||||
if((univ.party.get_level() > ((out_enc_lev_tot(i) * 5) / 3) ) && (out_enc_lev_tot(i) < 200)
|
||||
&& !univ.party.out_c[i].what_monst.cant_flee) {
|
||||
add_string_to_buf("Combat: Monsters fled!");
|
||||
univ.party.out_c[i].exists = false;
|
||||
return;
|
||||
}
|
||||
|
||||
start_outdoor_combat(univ.party.out_c[i], univ.party.out_loc,count_walls(univ.party.out_loc));
|
||||
|
||||
univ.party.out_c[i].exists = false;
|
||||
|
||||
set_up_combat();
|
||||
}
|
||||
|
||||
void show_inventory() {
|
||||
if(recording){
|
||||
record_action("show_inventory", "");
|
||||
@@ -1960,6 +1962,37 @@ void toggle_debug_mode() {
|
||||
print_buf();
|
||||
}
|
||||
|
||||
void debug_fight_encounter(bool wandering) {
|
||||
if(recording){
|
||||
record_action("debug_fight_encounter", bool_to_str(wandering));
|
||||
}
|
||||
if(!is_out()){
|
||||
ASB("Debug outdoor encounter: You have to be");
|
||||
ASB("outdoors!");
|
||||
print_buf();
|
||||
return;
|
||||
}
|
||||
|
||||
std::string prompt = "Which ";
|
||||
if(wandering){
|
||||
prompt += "wandering encounter?";
|
||||
}else{
|
||||
prompt += "special encounter?";
|
||||
}
|
||||
|
||||
int i = get_num_response(0, 3, prompt);
|
||||
|
||||
cOutdoors::cWandering encounter;
|
||||
if(wandering){
|
||||
encounter = univ.out->wandering[i];
|
||||
}else{
|
||||
encounter = univ.out->special_enc[i];
|
||||
}
|
||||
start_outdoor_combat(encounter, univ.party.out_loc, count_walls(univ.party.out_loc));
|
||||
|
||||
set_up_combat();
|
||||
}
|
||||
|
||||
void debug_give_item() {
|
||||
if(recording){
|
||||
record_action("debug_give_item", "");
|
||||
@@ -2331,7 +2364,7 @@ void show_debug_help() {
|
||||
}
|
||||
|
||||
// Non-comprehensive list of unused keys:
|
||||
// JUXYZ chijklnoqvy @#$%^-_+[]{},.'"`~/\|;:
|
||||
// JUXYZ chijklnoqvy @#$-_+[]{},.'"`~/\|;:
|
||||
void init_debug_actions() {
|
||||
add_debug_action({'B'}, "Leave town", debug_leave_town);
|
||||
add_debug_action({'C'}, "Get cleaned up (lose negative status effects)", debug_clean_up);
|
||||
@@ -2362,6 +2395,9 @@ void init_debug_actions() {
|
||||
add_debug_action({'<'}, "Make one day pass", debug_increase_age);
|
||||
add_debug_action({'>'}, "Reset towns (excludes the one you're in, if any)", debug_towns_forget);
|
||||
add_debug_action({'!'}, "Toggle Special Node Step-through Mode", debug_step_through);
|
||||
// std::bind won't work here for reasons
|
||||
add_debug_action({'%'}, "Fight wandering encounter from this section", []() -> void {debug_fight_encounter(true);});
|
||||
add_debug_action({'^'}, "Fight special encounter from this section", []() -> void {debug_fight_encounter(false);});
|
||||
add_debug_action({'/', '?'}, "Bring up this window", show_debug_help);
|
||||
}
|
||||
|
||||
|
@@ -84,6 +84,7 @@ void show_inventory();
|
||||
void toggle_debug_mode();
|
||||
void init_debug_actions();
|
||||
void show_debug_help();
|
||||
void debug_fight_encounter(bool wandering);
|
||||
void debug_give_item();
|
||||
void debug_print_location();
|
||||
void debug_step_through();
|
||||
|
@@ -251,11 +251,7 @@ effect_pat_type field[8] = {
|
||||
|
||||
bool center_on_monst;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void start_outdoor_combat(cOutdoors::cCreature encounter,location where,short num_walls) {
|
||||
void start_outdoor_combat(cOutdoors::cWandering encounter,location where,short num_walls) {
|
||||
short how_many,num_tries = 0;
|
||||
short low[10] = {15,7,4,3,2,1,1,7,2,1};
|
||||
short high[10] = {30,10,6,5,3,2,1,10,4,1};
|
||||
@@ -266,7 +262,7 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,location where,short nu
|
||||
nums[i] = get_ran(1,low[i],high[i]);
|
||||
for(short i = 0; i < 3; i++)
|
||||
nums[i + 7] = get_ran(1,low[i + 7],high[i + 7]);
|
||||
notify_out_combat_began(encounter.what_monst,nums);
|
||||
notify_out_combat_began(encounter,nums);
|
||||
print_buf();
|
||||
play_sound(23);
|
||||
|
||||
@@ -286,15 +282,15 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,location where,short nu
|
||||
|
||||
for(short i = 0; i < 7; i++) {
|
||||
how_many = nums[i];
|
||||
if(encounter.what_monst.monst[i] != 0)
|
||||
if(encounter.monst[i] != 0)
|
||||
for(short j = 0; j < how_many; j++)
|
||||
set_up_monst(eAttitude::HOSTILE_A,encounter.what_monst.monst[i]);
|
||||
set_up_monst(eAttitude::HOSTILE_A,encounter.monst[i]);
|
||||
}
|
||||
for(short i = 0; i < 3; i++) {
|
||||
how_many = nums[i + 7];
|
||||
if(encounter.what_monst.friendly[i] != 0)
|
||||
if(encounter.friendly[i] != 0)
|
||||
for(short j = 0; j < how_many; j++)
|
||||
set_up_monst(eAttitude::FRIENDLY,encounter.what_monst.friendly[i]);
|
||||
set_up_monst(eAttitude::FRIENDLY,encounter.friendly[i]);
|
||||
}
|
||||
|
||||
// place PCs
|
||||
@@ -371,6 +367,10 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,location where,short nu
|
||||
|
||||
}
|
||||
|
||||
void start_outdoor_combat(cOutdoors::cCreature encounter,location where,short num_walls) {
|
||||
start_outdoor_combat(encounter.what_monst, where, num_walls);
|
||||
}
|
||||
|
||||
bool pc_combat_move(location destination) {
|
||||
std::string create_line;
|
||||
short s1;
|
||||
|
@@ -9,6 +9,9 @@
|
||||
#include "boe.global.hpp"
|
||||
#include "spell.hpp"
|
||||
|
||||
// For debug purposes, allow directly starting an outdoor encounter without
|
||||
// a wandering monster
|
||||
void start_outdoor_combat(cOutdoors::cWandering encounter,location where,short num_walls);
|
||||
void start_outdoor_combat(cOutdoors::cCreature encounter,location where,short num_walls);
|
||||
bool pc_combat_move(location destination);
|
||||
void char_parry();
|
||||
|
@@ -875,6 +875,8 @@ static void replay_action(Element& action) {
|
||||
easter_egg(boost::lexical_cast<int>(action.GetText()));
|
||||
}else if(t == "show_debug_panel"){
|
||||
show_debug_help();
|
||||
}else if(t == "debug_fight_encounter"){
|
||||
debug_fight_encounter(str_to_bool(action.GetText()));
|
||||
}else if(t == "advance_time"){
|
||||
// This is bad regardless of strictness, because visual changes may have occurred which won't get redrawn/reprinted
|
||||
throw std::string { "Replay system internal error! advance_time() was supposed to be called by the last action, but wasn't: " } + _last_action_type;
|
||||
|
Reference in New Issue
Block a user