Enable the hunting code path for an additional advantage of cave lore/woodsman traits
- However, this won't be enabled in legacy scenarios since it requires setting terrain special abilities
This commit is contained in:
@@ -2492,32 +2492,27 @@ void increase_age() {
|
||||
}
|
||||
|
||||
void handle_hunting() {
|
||||
short i,pic;
|
||||
ter_num_t ter;
|
||||
|
||||
if(!is_out())
|
||||
return;
|
||||
if(flying())
|
||||
return;
|
||||
ter_num_t ter = univ.out[univ.party.p_loc.x][univ.party.p_loc.y];
|
||||
if(!wilderness_lore_present(ter))
|
||||
return;
|
||||
eTrait trait = eTrait::PACIFIST;
|
||||
if(univ.scenario.ter_types[ter].special == eTerSpec::WILDERNESS_CAVE)
|
||||
trait = eTrait::CAVE_LORE;
|
||||
else if(univ.scenario.ter_types[ter].special == eTerSpec::WILDERNESS_SURFACE)
|
||||
trait = eTrait::WOODSMAN;
|
||||
if(trait == eTrait::PACIFIST)
|
||||
return;
|
||||
|
||||
// TODO: Resupport this!
|
||||
ter = univ.out[univ.party.p_loc.x][univ.party.p_loc.y];
|
||||
pic = univ.scenario.ter_types[ter].picture;
|
||||
for(i = 0; i < 6; i++)
|
||||
if(univ.party[i].main_status == eMainStatus::ALIVE && univ.party[i].traits[eTrait::CAVE_LORE] && get_ran(1,0,12) == 5
|
||||
&& (((pic >= 0) && (pic <= 1)) || ((pic >= 70) && (pic <= 76))) ) {
|
||||
for(int i = 0; i < 6; i++)
|
||||
if(univ.party[i].is_alive() && univ.party[i].traits[trait] && get_ran(1,0,12) == 5) {
|
||||
univ.party.food += get_ran(2,1,6);
|
||||
add_string_to_buf(univ.party[i].name + "hunts.");
|
||||
put_pc_screen();
|
||||
}
|
||||
for(i = 0; i < 6; i++)
|
||||
if(
|
||||
univ.party[i].main_status == eMainStatus::ALIVE && univ.party[i].traits[eTrait::WOODSMAN] && get_ran(1,0,12) == 5
|
||||
&& (((pic >= 2) && (pic <= 4)) || ((pic >= 79) && (pic <= 84)))) {
|
||||
univ.party.food += get_ran(2,1,6);
|
||||
add_string_to_buf(univ.party[i].name + "hunts.");
|
||||
put_pc_screen();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void switch_pc(short which) {
|
||||
@@ -2676,10 +2671,12 @@ static eDirection find_waterfall(short x, short y, short mode){
|
||||
bool to_dir[8];
|
||||
for(eDirection i = DIR_N; i < DIR_HERE; i++){
|
||||
if(mode == 0){
|
||||
to_dir[i] = univ.scenario.ter_types[univ.town->terrain(x + dir_x_dif[i],y + dir_y_dif[i])].special == eTerSpec::WATERFALL;
|
||||
eTerSpec spec = univ.scenario.ter_types[univ.town->terrain(x + dir_x_dif[i],y + dir_y_dif[i])].special;
|
||||
to_dir[i] = spec == eTerSpec::WATERFALL_CAVE || spec == eTerSpec::WATERFALL_SURFACE;
|
||||
if(univ.scenario.ter_types[univ.town->terrain(x + dir_x_dif[i],y + dir_y_dif[i])].flag1.u != i) to_dir[i] = false;
|
||||
}else{
|
||||
to_dir[i] = univ.scenario.ter_types[univ.out[x + dir_x_dif[i]][y + dir_y_dif[i]]].special == eTerSpec::WATERFALL;
|
||||
eTerSpec spec = univ.scenario.ter_types[univ.out[x + dir_x_dif[i]][y + dir_y_dif[i]]].special;
|
||||
to_dir[i] = spec == eTerSpec::WATERFALL_CAVE || spec == eTerSpec::WATERFALL_SURFACE;
|
||||
if(univ.scenario.ter_types[univ.out[x + dir_x_dif[i]][y + dir_y_dif[i]]].flag1.u != i) to_dir[i] = false;
|
||||
}
|
||||
}
|
||||
@@ -2726,7 +2723,7 @@ static void run_waterfalls(short mode){ // mode 0 - town, 1 - outdoors
|
||||
}
|
||||
draw_terrain();
|
||||
print_buf();
|
||||
if((wilderness_lore_present() > 0) && (get_ran(1,0,1) == 0))
|
||||
if(wilderness_lore_present(coord_to_ter(x - dir_x_dif[dir], y - dir_y_dif[dir]) > 0) && get_ran(1,0,1) == 0)
|
||||
add_string_to_buf(" (No supplies lost.)");
|
||||
else if(univ.party.food > 1800){
|
||||
add_string_to_buf(" (Many supplies lost.)");
|
||||
|
@@ -1032,7 +1032,8 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon
|
||||
|
||||
case eTerSpec::BLOCKED_TO_MONSTERS:
|
||||
case eTerSpec::TOWN_ENTRANCE:
|
||||
case eTerSpec::WATERFALL:
|
||||
case eTerSpec::WATERFALL_CAVE:
|
||||
case eTerSpec::WATERFALL_SURFACE:
|
||||
can_enter = false;
|
||||
break;
|
||||
|
||||
|
@@ -2806,11 +2806,13 @@ short race_present(eRace which_race) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
short wilderness_lore_present() {
|
||||
// TODO: Add contional statement to choose between these
|
||||
// (Probably requires something added to terrain types to specify that it's cave/surface wilderness.)
|
||||
return trait_present(eTrait::CAVE_LORE); // Cave Lore
|
||||
return trait_present(eTrait::WOODSMAN); // Woodsman
|
||||
short wilderness_lore_present(ter_num_t ter_type) {
|
||||
cTerrain& ter = univ.scenario.ter_types[ter_type];
|
||||
if(ter.special == eTerSpec::WILDERNESS_CAVE || ter.special == eTerSpec::WATERFALL_CAVE)
|
||||
return trait_present(eTrait::CAVE_LORE);
|
||||
else if(ter.special == eTerSpec::WILDERNESS_SURFACE || ter.special == eTerSpec::WATERFALL_SURFACE)
|
||||
return trait_present(eTrait::WOODSMAN);
|
||||
return false;
|
||||
}
|
||||
|
||||
short party_size(bool only_living) {
|
||||
|
@@ -43,7 +43,7 @@ void set_pc_moves();
|
||||
void take_ap(short num);
|
||||
short trait_present(eTrait which_trait);
|
||||
short race_present(eRace which_race);
|
||||
short wilderness_lore_present();
|
||||
short wilderness_lore_present(ter_num_t ter);
|
||||
void print_spell_cast(eSpell spell,eSkill which);
|
||||
void put_party_in_scen(std::string scen_name);
|
||||
short party_size(bool only_living);
|
||||
|
@@ -445,6 +445,10 @@ bool check_special_terrain(location where_check,eSpecCtx mode,cPlayer& which_pc,
|
||||
else bash_door(where_check,door_pc);
|
||||
}
|
||||
break;
|
||||
case eTerSpec::WILDERNESS_CAVE:
|
||||
case eTerSpec::WILDERNESS_SURFACE:
|
||||
handle_hunting();
|
||||
break;
|
||||
}
|
||||
|
||||
// Action may change terrain, so update what's been seen
|
||||
|
@@ -220,11 +220,11 @@ enum class eTerSpec {
|
||||
CALL_SPECIAL = 12, // formerly "call local special"
|
||||
UNUSED3 = 13, // formerly "call scenario special"
|
||||
IS_A_CONTAINER = 14,
|
||||
WATERFALL = 15,
|
||||
CONVEYOR = 16, // formerly "conveyor north"
|
||||
UNUSED4 = 17, // formerly "conveyor east"
|
||||
UNUSED5 = 18, // formerly "conveyor south"
|
||||
UNUSED6 = 19, // formerly "conveyor west"
|
||||
WILDERNESS_CAVE = 15,
|
||||
WILDERNESS_SURFACE = 16, // formerly "conveyor north"
|
||||
WATERFALL_CAVE = 17, // formerly "conveyor east"
|
||||
WATERFALL_SURFACE = 18, // formerly "conveyor south"
|
||||
CONVEYOR = 19, // formerly "conveyor west"
|
||||
BLOCKED_TO_MONSTERS = 20,
|
||||
TOWN_ENTRANCE = 21,
|
||||
CHANGE_WHEN_USED = 22,
|
||||
|
@@ -208,7 +208,7 @@ void cTerrain::append(legacy::terrain_type_type& old){
|
||||
flag3.u = 0;
|
||||
break;
|
||||
case 15:
|
||||
special = eTerSpec::WATERFALL;
|
||||
special = eTerSpec::WATERFALL_CAVE;
|
||||
flag1.u = DIR_S;
|
||||
flag3.u = 0;
|
||||
break;
|
||||
|
@@ -230,7 +230,8 @@ static short get_small_icon(ter_num_t ter){
|
||||
case eTerSpec::IS_A_CONTAINER:
|
||||
icon = 36;
|
||||
break;
|
||||
case eTerSpec::WATERFALL:
|
||||
case eTerSpec::WATERFALL_CAVE:
|
||||
case eTerSpec::WATERFALL_SURFACE:
|
||||
icon = -1;
|
||||
break;
|
||||
case eTerSpec::CONVEYOR:
|
||||
|
Reference in New Issue
Block a user