pacifist gray LEDs for spells that harm. Fix #711

This commit is contained in:
2025-04-06 15:36:36 -05:00
parent 921e2048e7
commit 9928608199
2 changed files with 9 additions and 3 deletions

View File

@@ -102,6 +102,9 @@ std::map<std::string,std::vector<std::string>> feature_flags = {
// Legacy behavior of the X debug action (used by the OneOfEverything replay)
// kills the whole party with 'Absent' status
{"debug-kill-party", {"V2"}},
// Legacy behavior of pacifist spellcasting (used by some replays)
// lets the player select combat spells and click 'Cast' which will fail.
{"pacifist-spellcast-check", {"V2"}},
{"target-lock", {"V1"}},
// New in-game save file picker
{"file-picker-dialog", {"V1"}},

View File

@@ -1571,8 +1571,9 @@ bool pc_can_cast_spell(const cPlayer& pc,eSpell spell_num) {
if(spell_num == eSpell::NONE) return false;
short level,store_w_cast;
eSkill type = (*spell_num).type;
cSpell spell = *spell_num;
level = (*spell_num).level;
level = spell.level;
int effective_skill = pc.skill(type);
if(pc.status[eStatus::DUMB] < 0)
effective_skill -= pc.status[eStatus::DUMB];
@@ -1581,11 +1582,13 @@ bool pc_can_cast_spell(const cPlayer& pc,eSpell spell_num) {
return false; // From Windows version. It does kinda make sense, though this function shouldn't even be called in these modes.
if(!isMage(spell_num) && !isPriest(spell_num))
return false;
if(has_feature_flag("pacifist-spellcast-check", "V2") && pc.traits[eTrait::PACIFIST] && !spell.peaceful)
return false;
if(effective_skill < level)
return false;
if(pc.main_status != eMainStatus::ALIVE)
return false;
if(pc.cur_sp < (*spell_num).cost)
if(pc.cur_sp < spell.cost)
return false;
// TODO: Maybe get rid of the casts here?
if(type == eSkill::MAGE_SPELLS && !pc.mage_spells[int(spell_num)])
@@ -1599,7 +1602,7 @@ bool pc_can_cast_spell(const cPlayer& pc,eSpell spell_num) {
if(pc.status[eStatus::ASLEEP] > 0)
return false;
store_w_cast = (*spell_num).when_cast;
store_w_cast = spell.when_cast;
if(is_out() && WHEN_OUTDOORS &~ store_w_cast)
return false;
if(is_town() && WHEN_TOWN &~ store_w_cast)