I don't know how the game calculates spells, as Shadowheart almost always misses with her little Sacred Flame.
What is the game's methodology on that, do you know?
Some spells have attack rolls. Those spells use your spellcasting trait for a modifier. A wizard, for instance, uses Int. A sorcerer uses Cha, and a cleric uses Wis.
Of note: the cantrip that an elf or a half-elf get at character creation uses Int. So Shadowheart's firebolt uses her Int to calculate her chance to hit.
Other spells do not use an attack roll. Instead, they provide the target with a saving throw. Sacred Flame is such a spell. It does not roll to attack. Rather, the subject of the spell rolls a saving throw. The difficulty of the saving throw is determined by the spellcasting modifier of the caster. In the case of Shadowheart casting Sacred Flame, the difficulty level of the saving throw is being impacted by her Wis.
I believe the saving throw is calculated as follows:
8 + (proficiency bonus) + (spellcasting modifier) + (any potential equipment/consumable bonuses)
That creates a number that the target must roll to beat on a d20. The higher the number, the more difficult the save.
The spell itself will target a particular stat. The target uses that stat to roll a saving throw. They roll: d20 + (stat bonus) +(proficiency if applicable) + (any misc modifiers from conditions, etc.) Note: this is why there are a lot of effects in the game that do things like give disadvantage to--as an example--dexterity saving throws. You can potentially use those effects to bolster your chance of success with something like a Sacred Flame spell.