diff --git a/src/game/boe.actions.cpp b/src/game/boe.actions.cpp index ea30c592..c492a410 100644 --- a/src/game/boe.actions.cpp +++ b/src/game/boe.actions.cpp @@ -887,7 +887,7 @@ static void handle_town_wait(bool& need_redraw, bool& need_reprint) { increase_age(); do_monsters(); do_monster_turn(); - int make_wand = get_ran(1,1,160 - univ.town.difficulty); + int make_wand = get_ran(1,1,160 - univ.town->difficulty); if(make_wand == 10) create_wand_monst(); for(int j = 0; j < 6; j++) @@ -1491,7 +1491,7 @@ void handle_monster_actions(bool& need_redraw, bool& need_reprint) { } } if(overall_mode == MODE_TOWN) { - if(get_ran(1,1,160 - univ.town.difficulty + univ.party.less_wm * 200) == 2) + if(get_ran(1,1,160 - univ.town->difficulty + univ.party.less_wm * 200) == 2) create_wand_monst(); } } diff --git a/src/game/boe.party.cpp b/src/game/boe.party.cpp index e309cf4b..1dc325af 100644 --- a/src/game/boe.party.cpp +++ b/src/game/boe.party.cpp @@ -1301,7 +1301,7 @@ void cast_town_spell(location where) { if(univ.scenario.ter_types[ter].flag2 == 10) r1 = 10000; else{ - r1 = get_ran(1,1,100) - 5 * adj + 5 * univ.town.difficulty; + r1 = get_ran(1,1,100) - 5 * adj + 5 * univ.town->difficulty; r1 += univ.scenario.ter_types[ter].flag2 * 7; } if(r1 < (135 - combat_percent[min(19,level)])) { @@ -1319,7 +1319,7 @@ void cast_town_spell(location where) { case eSpell::DISPEL_BARRIER: if((univ.town.is_fire_barr(where.x,where.y)) || (univ.town.is_force_barr(where.x,where.y))) { - r1 = get_ran(1,1,100) - 5 * adj + 5 * (univ.town.difficulty / 10) + 25 * univ.town->strong_barriers; + r1 = get_ran(1,1,100) - 5 * adj + 5 * (univ.town->difficulty / 10) + 25 * univ.town->strong_barriers; if(univ.town.is_fire_barr(where.x,where.y)) r1 -= 8; if(r1 < (120 - combat_percent[min(19,level)])) { diff --git a/src/game/boe.town.cpp b/src/game/boe.town.cpp index 79894cee..b444e00e 100644 --- a/src/game/boe.town.cpp +++ b/src/game/boe.town.cpp @@ -1149,7 +1149,7 @@ void pick_lock(location where,short pc_num) { if(r1 < 75) will_break = true; - r1 = get_ran(1,1,100) - 5 * univ.party[pc_num].stat_adj(eSkill::DEXTERITY) + univ.town.difficulty * 7 + r1 = get_ran(1,1,100) - 5 * univ.party[pc_num].stat_adj(eSkill::DEXTERITY) + univ.town->difficulty * 7 - 5 * univ.party[pc_num].skill(eSkill::LOCKPICKING) - which_item->abil_strength * 7; // Nimble? @@ -1186,7 +1186,7 @@ void bash_door(location where,short pc_num) { short r1,unlock_adjust; terrain = univ.town->terrain(where.x,where.y); - r1 = get_ran(1,1,100) - 15 * univ.party[pc_num].stat_adj(eSkill::STRENGTH) + univ.town.difficulty * 4; + r1 = get_ran(1,1,100) - 15 * univ.party[pc_num].stat_adj(eSkill::STRENGTH) + univ.town->difficulty * 4; if(univ.scenario.ter_types[terrain].special != eTerSpec::UNLOCKABLE) { add_string_to_buf(" Wrong terrain type."); diff --git a/src/game/boe.townspec.cpp b/src/game/boe.townspec.cpp index 2a4cfb63..57828164 100644 --- a/src/game/boe.townspec.cpp +++ b/src/game/boe.townspec.cpp @@ -57,7 +57,7 @@ bool run_trap(short pc_num,eTrapType trap_type,short trap_level,short diff) { int i = disarmer.stat_adj(eSkill::DEXTERITY); i += disarmer.get_prot_level(eItemAbil::THIEVING) / 2; skill = minmax(0,20,disarmer.skill(eSkill::DISARM_TRAPS) + - + disarmer.skill(eSkill::LUCK) / 2 + 1 - univ.town.difficulty + 2 * i); + + disarmer.skill(eSkill::LUCK) / 2 + 1 - univ.town->difficulty + 2 * i); r1 = get_ran(1,1,100) + diff; // Nimble? @@ -76,21 +76,21 @@ bool run_trap(short pc_num,eTrapType trap_type,short trap_level,short diff) { case TRAP_BLADE: for(short i = 0; i < num_hits; i++) { add_string_to_buf(" A knife flies out!"); - r1 = get_ran(2 + univ.town.difficulty / 14,1,10); + r1 = get_ran(2 + univ.town->difficulty / 14,1,10); damage_pc(disarmer,r1,eDamageType::WEAPON,eRace::UNKNOWN,0); } break; case TRAP_DART: add_string_to_buf(" A dart flies out."); - r1 = 3 + univ.town.difficulty / 14; + r1 = 3 + univ.town->difficulty / 14; r1 = r1 + trap_level * 2; disarmer.poison(r1); break; case TRAP_GAS: add_string_to_buf(" Poison gas pours out."); - r1 = 2 + univ.town.difficulty / 14; + r1 = 2 + univ.town->difficulty / 14; r1 = r1 + trap_level * 2; univ.party.poison(r1); break; @@ -98,14 +98,14 @@ bool run_trap(short pc_num,eTrapType trap_type,short trap_level,short diff) { case TRAP_EXPLOSION: for(short i = 0; i < num_hits; i++) { add_string_to_buf(" There is an explosion."); - r1 = get_ran(3 + univ.town.difficulty / 13,1,8); + r1 = get_ran(3 + univ.town->difficulty / 13,1,8); hit_party(r1,eDamageType::FIRE); } break; case TRAP_SLEEP_RAY: add_string_to_buf(" A purple ray flies out."); - r1 = 200 + univ.town.difficulty * 100; + r1 = 200 + univ.town->difficulty * 100; r1 = r1 + trap_level * 400; // TODO: It says sleep ray but is actually paralysis ray? disarmer.sleep(eStatus::PARALYZED, r1, 50); @@ -135,14 +135,14 @@ bool run_trap(short pc_num,eTrapType trap_type,short trap_level,short diff) { case TRAP_DISEASE: add_string_to_buf(" You prick your finger."); - r1 = 3 + univ.town.difficulty / 14; + r1 = 3 + univ.town->difficulty / 14; r1 = r1 + trap_level * 2; disarmer.disease(r1); break; case TRAP_DISEASE_ALL: add_string_to_buf(" A foul substance sprays out."); - r1 = 2 + univ.town.difficulty / 14; + r1 = 2 + univ.town->difficulty / 14; r1 = r1 + trap_level * 2; univ.party.disease(r1); break; diff --git a/src/universe/universe.cpp b/src/universe/universe.cpp index ccaf54f9..0f1362e9 100644 --- a/src/universe/universe.cpp +++ b/src/universe/universe.cpp @@ -29,8 +29,9 @@ void cCurOut::import_legacy(legacy::out_info_type& old){ void cCurTown::import_legacy(legacy::current_town_type& old){ univ.party.town_num = old.town_num; - difficulty = old.difficulty; record()->import_legacy(old.town); + // TODO: Is this right? Was current_town_type::difficulty just a mirror of town difficulty? + record()->difficulty = old.difficulty; for(int i = 0; i < 64; i++) for(int j = 0; j < 64; j++) fields[i][j] = old.explored[i][j]; @@ -824,7 +825,7 @@ void cCurOut::readFrom(std::istream& file) { void cCurTown::writeTo(cTagFile& file) const { auto& page = file.add(); page["TOWN"] << univ.party.town_num; - page["DIFFICULTY"] << difficulty; + page["DIFFICULTY"] << record()->difficulty; if(monst.hostile) page.add("HOSTILE"); page["AT"] << univ.party.town_loc.x << univ.party.town_loc.y; for(size_t i = 0; i < items.size(); i++) { @@ -851,7 +852,7 @@ void cCurTown::readFrom(const cTagFile& file){ for(const auto& page : file) { if(page.index() == 0) { page["TOWN"] >> univ.party.town_num; - page["DIFFICULTY"] >> difficulty; + page["DIFFICULTY"] >> record()->difficulty; monst.hostile = page.contains("HOSTILE"); page["AT"] >> univ.party.town_loc.x >> univ.party.town_loc.y; } else if(page.getFirstKey() == "FIELDS" || page.getFirstKey() == "TERRAIN") { @@ -982,7 +983,6 @@ void cCurTown::copy(const cCurTown& other) { cur_talk_loaded = other.cur_talk_loaded; quickfire_present = other.quickfire_present; belt_present = other.belt_present; - difficulty = other.difficulty; monst = other.monst; items = other.items; fields = other.fields; @@ -992,7 +992,6 @@ void cCurTown::swap(cCurTown& other) { std::swap(cur_talk_loaded, other.cur_talk_loaded); std::swap(quickfire_present, other.quickfire_present); std::swap(belt_present, other.belt_present); - std::swap(difficulty, other.difficulty); monst.swap(other.monst); std::swap(items, other.items); fields.swap(other.fields); diff --git a/src/universe/universe.hpp b/src/universe/universe.hpp index b7f77fd9..b43dfb5c 100644 --- a/src/universe/universe.hpp +++ b/src/universe/universe.hpp @@ -43,7 +43,6 @@ class cCurTown { public: bool quickfire_present = false, belt_present = false; // formerly current_town_type - short difficulty; cPopulation monst; std::vector items; // formerly town_item_list type