make resurrection balm a feature flag. fix #703

This makes it so the built-in scenarios do not require balm,
even though they are not legacy scenarios.

If we add balm to the scenarios, we can change this.

If I find balm in ZKR I will change it.
This commit is contained in:
2025-05-14 16:22:57 -05:00
parent e35086d6b2
commit 36ddc9e8fb
6 changed files with 27 additions and 5 deletions

View File

@@ -87,6 +87,21 @@ static void put_spell_info(cDialog& me, eSkill display_mode) {
else me["range"].setTextToNum(ran);
me["desc"].setText(get_str(res, pos + 1));
// Spells that require resurrection balm need to adapt their description based on whether the scenario supports it.
if(spell == eSpell::RAISE_DEAD || spell == eSpell::RESURRECT){
if(!univ.party.scen_name.empty() && univ.scenario.has_feature_flag("resurrection-balm")){
// Balm supported, so remove the markup around the balm part of the description
me["desc"].replaceText("<", "");
me["desc"].replaceText(">", "");
}else{
// Scenario doesn't support balm, so erase it from the description.
size_t start_balm_message = me["desc"].getText().find("<");
size_t end_balm_message = me["desc"].getText().find(">") + 1;
std::string balm_message = me["desc"].getText().substr(start_balm_message, end_balm_message - start_balm_message);
me["desc"].replaceText(balm_message, "");
}
}
me["when"].setText(get_str("spell-times", (*spell).when_cast));
}

View File

@@ -98,6 +98,8 @@ std::string help_text_rsrc = "help";
}
*/
std::map<std::string,std::vector<std::string>> feature_flags = {
// Legacy scenario flags
{"resurrection-balm", {"required"}}, // This means it CAN be supported, if the scenario has the flag.
// Legacy behavior of the T debug action (used by some replays)
// does not change the party's outdoors location
{"debug-enter-town", {"move-outdoors"}},

View File

@@ -1148,8 +1148,8 @@ void do_priest_spell(short pc_num,eSpell spell_num,bool freebie) {
play_sound(52);
sout.str(" Your items glow.");
} else {
if(!univ.scenario.is_legacy) {
// Scenario feature flag: requiring resurrection balm
if(univ.scenario.has_feature_flag("resurrection-balm")) {
if(cInvenSlot item = univ.party[pc_num].has_abil(eItemAbil::RESURRECTION_BALM)) {
univ.party[pc_num].take_item(item.slot);
} else {

View File

@@ -84,6 +84,7 @@ cScenario::cScenario() {
cScenario::cScenario(const cScenario& other)
: difficulty(other.difficulty)
, intro_pic(other.intro_pic)
, feature_flags(other.feature_flags)
, default_ground(other.default_ground)
, bg_out(other.bg_out)
, bg_fight(other.bg_fight)
@@ -151,6 +152,7 @@ void swap(cScenario& lhs, cScenario& rhs) {
using std::swap;
swap(lhs.difficulty, rhs.difficulty);
swap(lhs.intro_pic, rhs.intro_pic);
swap(lhs.feature_flags, rhs.feature_flags);
swap(lhs.default_ground, rhs.default_ground);
swap(lhs.bg_out, rhs.bg_out);
swap(lhs.bg_fight, rhs.bg_fight);
@@ -210,6 +212,8 @@ cScenario::cItemStorage::cItemStorage() : ter_type(-1), property(0) {
void cScenario::import_legacy(legacy::scenario_data_type& old){
is_legacy = true;
// TODO eventually the absence of feature flags here will replace is_legacy altogether
feature_flags = {};
difficulty = old.difficulty;
intro_pic = old.intro_pic;
default_ground = old.default_ground * 2;

View File

@@ -2986,7 +2986,8 @@ bool build_scenario() {
scenario.default_ground = grass ? 2 : 0;
scenario.feature_flags = {
{"scenario-meta-format", "V2"}
{"scenario-meta-format", "V2"},
{"resurrection-balm", "required"},
};
fs::path basePath = progDir/"Blades of Exile Base"/(grass ? "bladbase.boes" : "cavebase.boes");