Update labels for If Context node and add a picker for the spell when context is "targeting"

This commit is contained in:
2025-03-17 19:37:49 -04:00
parent c73cb6220b
commit 4bb83e6f59
4 changed files with 31 additions and 4 deletions

View File

@@ -449,7 +449,7 @@ Unused
Unused
Unused
Which context
Prevent entry?
Unused|Prevent entry?|Spell being cast (-1 = any spell)
If context matches, call this special ...
Unused
Unused

View File

@@ -107,8 +107,13 @@ namespace {
.ex1b(eSpecPicker::NODE);
node_properties_t S_CONTEXT = node_builder_t(eSpecType::IF_CONTEXT)
.ex1a(STRT_CONTEXT)
.ex1c(eSpecPicker::NODE)
.when(eSpecField::EX1A < 3, 1)
.ex1b(eSpecPicker::TOGGLE)
.ex1c(eSpecPicker::NODE);
.end()
.when(eSpecField::EX1A == 16, 2)
.ex1b(STRT_ANY_SPELL)
.end();
node_properties_t S_NUM = node_builder_t(eSpecType::IF_NUM_RESPONSE)
.msg1(+eSpecPicker::MSG_SINGLE)
.pict(STRT_CMP_MODE)

View File

@@ -137,7 +137,7 @@ enum eStrType {
STRT_MONST, STRT_ITEM, STRT_TER, STRT_BUTTON,
STRT_SPEC_ITEM, STRT_MAGE, STRT_PRIEST, STRT_ALCHEMY,
STRT_TOWN, STRT_SECTOR, STRT_SKILL, STRT_SKILL_CHECK,
STRT_TRAIT, STRT_RACE,
STRT_TRAIT, STRT_RACE, STRT_ANY_SPELL,
STRT_PICT, STRT_CMP, STRT_ACCUM, STRT_TRAP,
STRT_ATTITUDE, STRT_STAIR, STRT_LIGHT, STRT_CONTEXT,
STRT_SHOP, STRT_COST_ADJ, STRT_STAIR_MODE, STRT_TALK_NODE,

View File

@@ -461,6 +461,14 @@ short choose_text(eStrType list, unsigned short cur_choice, cDialog* parent, std
strings.push_back((*cSpell::fromNum(eSkill::PRIEST_SPELLS, i)).name());
}
break;
case STRT_ANY_SPELL:
for(int i = 0; i < 255; i++) {
eSpell spell = cSpell::fromNum(i);
if(spell != eSpell::NONE) {
strings.push_back((*spell).name());
}
}
break;
case STRT_ALCHEMY:
for(int i = 0; i < 20; i++) {
strings.push_back(get_str("magic-names", i + 200));
@@ -1131,6 +1139,7 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
case STRT_ALCHEMY: title = "Which recipe?"; break;
case STRT_MAGE: title = "Which spell?"; break;
case STRT_PRIEST: title = "Which spell?"; break;
case STRT_ANY_SPELL: title = "Which spell?"; break;
case STRT_SKILL: title = "Which statistic?"; break;
case STRT_SKILL_CHECK: title = "Which statistic?"; break;
case STRT_TRAIT: title = "Which trait?"; break;
@@ -1175,10 +1184,21 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
break;
}
auto otherField = get_control_for_field(fcn.continuation);
static int nMageSpells;
if(fcn.str_type == STRT_SECTOR) {
val = val * scenario.outdoors.height() + me[otherField].getTextAsNum();
} else if(fcn.str_type == STRT_SKILL_CHECK && val >= 100) {
val -= 79;
} else if(fcn.str_type == STRT_ANY_SPELL && val >= 100) {
if(nMageSpells == 0) {
for(int i = 0; i < 100; i++) {
if(cSpell::fromNum(i) == eSpell::NONE) {
nMageSpells = i;
break;
}
}
}
val -= 100 - nMageSpells;
}
store = choose_text(fcn.str_type, val + fcn.adjust, &me, title) - fcn.adjust;
if(fcn.str_type == STRT_SECTOR) {
@@ -1186,6 +1206,8 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
store /= scenario.outdoors.height();
} else if(fcn.str_type == STRT_SKILL_CHECK && store > 20) {
store += 79;
} else if(fcn.str_type == STRT_ANY_SPELL && store >= nMageSpells) {
store += 100 - nMageSpells;
}
} break;
case eSpecPicker::PICTURE: {