feature flag keep doors easier in old scenarios

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

View File

@@ -128,7 +128,8 @@ std::map<std::string,std::vector<std::string>> feature_flags = {
{"store-spell-target", {"fixed"}}, {"store-spell-target", {"fixed"}},
{"store-spell-caster", {"fixed"}}, {"store-spell-caster", {"fixed"}},
// Game balance // 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 { struct cParseEntrance {

View File

@@ -1385,10 +1385,10 @@ void cast_town_spell(location where) {
case eSpell::UNLOCK: case eSpell::UNLOCK:
// TODO: Is the unlock spell supposed to have a max range? // 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].special == eTerSpec::UNLOCKABLE){
if(univ.scenario.ter_types[ter].flag2 == 10) if(univ.scenario.ter_types[ter].flag2 == 10){
r1 = 10000; r1 = 10000;
else{ }else{
r1 = get_ran(1,1,100) - 5 * adj + 5 * univ.town->difficulty; r1 = get_ran(1,1,100) - 5 * adj + 5 * univ.town.door_diff_adjust();
r1 += univ.scenario.ter_types[ter].flag2 * 7; r1 += univ.scenario.ter_types[ter].flag2 * 7;
} }
if(r1 < (135 - combat_percent[min(19,level)])) { if(r1 < (135 - combat_percent[min(19,level)])) {

View File

@@ -1143,7 +1143,7 @@ void pick_lock(location where,short pc_num) {
if(r1 < 75) if(r1 < 75)
will_break = true; 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; - 5 * univ.party[pc_num].skill(eSkill::LOCKPICKING) - which_item->abil_strength * 7;
// Nimble? // Nimble?
@@ -1176,7 +1176,7 @@ void bash_door(location where,short pc_num) {
short r1,unlock_adjust; short r1,unlock_adjust;
terrain = univ.town->terrain(where.x,where.y); 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) { if(univ.scenario.ter_types[terrain].special != eTerSpec::UNLOCKABLE) {
add_string_to_buf(" Wrong terrain type."); add_string_to_buf(" Wrong terrain type.");

View File

@@ -3344,6 +3344,8 @@ bool build_scenario() {
scenario.feature_flags = { scenario.feature_flags = {
{"scenario-meta-format", "V2"}, {"scenario-meta-format", "V2"},
{"resurrection-balm", "required"}, {"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"); 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(); return *record();
} }
int cCurTown::door_diff_adjust() {
return univ.scenario.has_feature_flag("door-town-difficulty") ? arena->difficulty : 0;
}
void cCurTown::place_preset_fields() { void cCurTown::place_preset_fields() {
// Initialize barriers, etc. Note non-sfx gets forgotten if this is a town recently visited. // Initialize barriers, etc. Note non-sfx gets forgotten if this is a town recently visited.
fields.resize(record()->max_dim, record()->max_dim); 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(unsigned char(& old_sfx)[64][64], unsigned char(& old_misc_i)[64][64]);
void import_legacy(legacy::big_tr_type& old); void import_legacy(legacy::big_tr_type& old);
int door_diff_adjust();
cTown* operator -> (); cTown* operator -> ();
cTown& operator * (); cTown& operator * ();
const cTown* operator -> () const; const cTown* operator -> () const;