diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp index 2a514299..a6b83bc0 100644 --- a/src/game/boe.main.cpp +++ b/src/game/boe.main.cpp @@ -128,7 +128,8 @@ std::map> feature_flags = { {"store-spell-target", {"fixed"}}, {"store-spell-caster", {"fixed"}}, // Game balance - {"magic-resistance", {"fixed"}} // Resist Magic used to not help with magic damage! + {"magic-resistance", {"fixed"}}, // Resist Magic used to not help with magic damage! + {"door-town-difficulty", {"fixed"}} }; struct cParseEntrance { diff --git a/src/game/boe.party.cpp b/src/game/boe.party.cpp index 7c4bf839..aff1bc34 100644 --- a/src/game/boe.party.cpp +++ b/src/game/boe.party.cpp @@ -1385,10 +1385,10 @@ void cast_town_spell(location where) { case eSpell::UNLOCK: // TODO: Is the unlock spell supposed to have a max range? if(univ.scenario.ter_types[ter].special == eTerSpec::UNLOCKABLE){ - if(univ.scenario.ter_types[ter].flag2 == 10) + if(univ.scenario.ter_types[ter].flag2 == 10){ r1 = 10000; - else{ - r1 = get_ran(1,1,100) - 5 * adj + 5 * univ.town->difficulty; + }else{ + r1 = get_ran(1,1,100) - 5 * adj + 5 * univ.town.door_diff_adjust(); r1 += univ.scenario.ter_types[ter].flag2 * 7; } if(r1 < (135 - combat_percent[min(19,level)])) { diff --git a/src/game/boe.town.cpp b/src/game/boe.town.cpp index 091e3133..986b7505 100644 --- a/src/game/boe.town.cpp +++ b/src/game/boe.town.cpp @@ -1143,7 +1143,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.door_diff_adjust() * 7 - 5 * univ.party[pc_num].skill(eSkill::LOCKPICKING) - which_item->abil_strength * 7; // Nimble? @@ -1176,7 +1176,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.door_diff_adjust() * 4; if(univ.scenario.ter_types[terrain].special != eTerSpec::UNLOCKABLE) { add_string_to_buf(" Wrong terrain type."); diff --git a/src/scenedit/scen.core.cpp b/src/scenedit/scen.core.cpp index 641b9c66..c01d01f1 100644 --- a/src/scenedit/scen.core.cpp +++ b/src/scenedit/scen.core.cpp @@ -3344,6 +3344,8 @@ bool build_scenario() { scenario.feature_flags = { {"scenario-meta-format", "V2"}, {"resurrection-balm", "required"}, + // Town difficulty, due to a bug, used to not be added to door difficulty + {"door-town-difficulty", "fixed"} }; fs::path basePath = progDir/"Blades of Exile Base"/(grass ? "bladbase.boes" : "cavebase.boes"); diff --git a/src/universe/universe.cpp b/src/universe/universe.cpp index 9ba32428..327df733 100644 --- a/src/universe/universe.cpp +++ b/src/universe/universe.cpp @@ -116,6 +116,10 @@ const cTown& cCurTown::operator * () const { return *record(); } +int cCurTown::door_diff_adjust() { + return univ.scenario.has_feature_flag("door-town-difficulty") ? arena->difficulty : 0; +} + void cCurTown::place_preset_fields() { // Initialize barriers, etc. Note non-sfx gets forgotten if this is a town recently visited. fields.resize(record()->max_dim, record()->max_dim); diff --git a/src/universe/universe.hpp b/src/universe/universe.hpp index a4024676..17e9f8af 100644 --- a/src/universe/universe.hpp +++ b/src/universe/universe.hpp @@ -52,6 +52,7 @@ public: void import_legacy(unsigned char(& old_sfx)[64][64], unsigned char(& old_misc_i)[64][64]); void import_legacy(legacy::big_tr_type& old); + int door_diff_adjust(); cTown* operator -> (); cTown& operator * (); const cTown* operator -> () const;