Skip to content

Commit

Permalink
Merge pull request #724 from doug1234/OverExlandedSpellKnowledge
Browse files Browse the repository at this point in the history
Now filtering out nonarcane spells from expanded spell knowledge.  This should fix the crashreported on Co8.
  • Loading branch information
doug1234 authored Sep 28, 2023
2 parents 44408ea + 3908f4d commit 13407c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions TemplePlus/python/python_spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,11 @@ static PyObject* PySpellStore_GetClass(PyObject* obj, void*) {

static PyObject* PySpellStore_GetCasterClass(PyObject* obj, void*) {
auto self = (PySpellStore*)obj;

if (spellSys.isDomainSpell(self->spellData.classCode)) {
return PyInt_FromLong(0);
}

return PyInt_FromLong(spellSys.GetCastingClass(self->spellData.classCode));
}

Expand Down
7 changes: 4 additions & 3 deletions tpdatasrc/tpgamefiles/scr/tpModifiers/ultimate_magus.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,15 @@ def ExpandedSpellKnowledgeRadial(attachee, args, evt_obj):

known_spells = attachee.spells_known

#Find all known spontaneous spells so we don't add them to the selectable spells
#Find all known spontaneous spells arcane so we don't add them to the selectable spells
spontaneous_known = []
for knSp in known_spells:
if knSp.caster_class == spontaneousCastingClass:
if (knSp.caster_class == spontaneousCastingClass) and (knSp.caster_class > 0) and attachee.is_arcane_spell_class(knSp.caster_class):
spontaneous_known.append(knSp.spell_enum)

#Add each arcane spell under the level that is not alreay in the spontaneous spell list
for knSp in known_spells:
if knSp.spell_level <= level:
if knSp.spell_level <= level and (knSp.caster_class > 0) and attachee.is_arcane_spell_class(knSp.caster_class):
if knSp.spell_enum not in spontaneous_known:
spell_node = tpdp.RadialMenuEntryPythonAction(knSp, D20A_PYTHON_ACTION, expandedSpellKnowledgeEnum, level)
spell_node.add_as_child(attachee, spell_level_ids[knSp.spell_level])
Expand Down

0 comments on commit 13407c6

Please sign in to comment.