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 {