CleverRaven / CleverRaven/Cataclysm-DDA
[Xedra Evolved, Magiclysm] Spells with low max level can't be mastered
- Dominant language
- C++
- Stars
- 13.2k
- Forks
- 4.6k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 205
Description
### Describe the bug
The failure chance of a spell is determined by the following effective_skill calculation:
`2*(spell level - spell difficult) + Intelligence + Skill`
The higher this effective_skill, the lower the failure chance. If it's higher than 30, the spell automatically succeeds, regardless of penalties it would normally take due to wearing gloves, having low Focus, etc.
This math works pretty well for the typical Magiclysm spells, which usually have about 20 levels. It ensures that spell skill is the most important factor, but more difficult spells will require high Int and/or Spellcraft values to truly master.
However, it quickly breaks down in circumstances where the max spell level is lower. The most obvious way this happens is that "level 0" utility spells like Magiclysm's "[Class]Rune" spells have surprisingly high failure rates. It also prevents any other mod from breaking away from Magiclysm's spell balance, as is currently the case with Xedra Evolved.
The XE spell "Spring-heeled leap" has a max level of 6, presumably because all it does is move you up to 6 tiles, and it would feel pretty terrible to give it 20 levels and only actually improve it every third or fourth level. So instead it only has six levels and moves you a full tile further with each one. But because effective_skill only cares about absolute spell level, even when maxed out this ostensibly simple Difficult 3 spell gets stuck with a dangling failure chance, even as much harder spells hit 0%.
### Steps to reproduce
1. Max out a spell with low max level, like spring-heeled leap
2. Marvel at the fact you can still screw it up, when ostensibly much harder spells go off without a hitch.
### Expected behavior
A max-level spell should be considered max-level for casting purposes, regardless of what that max level actually is. Naïve solution would be to change the "spell level" bit to be a ratio between spell level and max spell level, with the difficulty pulled into the rest of the equation. Something like:
`20*(spell level/max spell level) - difficulty + Int + Skill`
However, this would lose the current behavior where easy spells are mastered quite quickly, hard spells are basically impossible until you've leveled them above their difficulty, and there's an exponential dropoff in failure chance where you hit decent odds quickly and then slowly drift towards 0% failure, all of which I think are pretty good. I don't know exactly what the equation should look like, or if perhaps the best solution is just to leave it as is and enforced a max level of ~20 of all spells, but that feels a bit limiting.
### Screenshots

Sprin-heeled leap at max level with 10 int and all skills at 10. Any Magiclysm spell would've hit 0% chance under these conditions.

A character with 8 int and 10 spellcraft, still struggling to create a simple rune.
### Versions and configuration
- OS: Windows
- OS Version: 10.0.19043.1889 (21H1)
- Game Version: 9c88952 [64-bit]
- Graphics Version: Tiles
- Game Language: English [en]
- Mods loaded: [
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
No Fungal Growth [no_fungal_growth],
Bionic Professions [package_bionic_professions],
Bionic Slots [cbm_slots],
Xedra Evolved [xedra_evolved]
]
### Additional context
spell_fail, the function that handles spell failure, starts at line 1060 in magic.cpp
Also I beleive the "skill" portion of the equation is supposed to be whatever skill a spell is tied to, but that might be hardcoded to Spellcraft at the moment.
Contributor guide
Research direction
Start with spell_fail in magic.cpp around line 1060 and reproduce the failure chance for a maxed low-level spell such as Spring-heeled leap or a Class Rune spell. Compare the current effective_skill behavior with the max-level expectation and review the proposed ratio-based approach. Done means agreeing on and implementing a casting-failure model that handles low maximum spell levels without regressing existing difficulty and mastery behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100