feature flag keep doors easier in old scenarios

This commit is contained in:
2025-08-09 15:28:36 -05:00
parent 7ff53365e0
commit a82ab06523
6 changed files with 14 additions and 6 deletions

View File

@@ -129,7 +129,8 @@ std::map<std::string,std::vector<std::string>> 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 {

View File

@@ -1384,10 +1384,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)])) {

View File

@@ -1144,7 +1144,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?
@@ -1177,7 +1177,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.");

View File

@@ -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");

View File

@@ -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);

View File

@@ -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;