Class SkillOwnershipTests
- Namespace
- GrindFest
- Assembly
- GrindFest.dll
Locks the rules of the skill system that the rest of the game walks over: what a character owns, what a
repeated add/use does, and what removing or clearing has to clean up. These are the rules whose violation
is invisible until much later — the duplicate-AddSkill regression left a hero holding 271 skills
(267 identical MeleeAttacks) without failing anything.
On identity. Today a character owns at most one instance per skill type and the type name is what a save stores. That is a convention, not a law of the design — skills are meant to carry levels (and later experience), and identity may well move to a definition object so that variants can coexist. So these tests assert the part that must survive any such change: nothing accumulates. Where the convention shows up (adding the same type twice, adding twice through a use) they assert the resulting count and that a usable instance is there — not that the very same object came back.
Monsters are used as the character under test so the hero's own skills stay untouched; the one test that has to drive the hero's real use path snapshots and restores them.
public class SkillOwnershipTests : DevTest
- Inheritance
-
objectSkillOwnershipTests
- Inherited Members
Methods
- AddSameSkillTwiceKeepsOneEntry()
Adding a skill the character already has must not add a second entry. Callers hand a freshly created instance in (books, scrolls, save load, shrines), so this is the path they all take.
- ClearingAllSkillsClearsBuffsToo()
Clearing is what rebuilding a character from a save does, and it has to take the buff list with it.
- ReapplyingABuffRefreshesItInsteadOfStacking()
A second application of a buff refreshes it instead of leaving two live copies behind. Two copies would mean two timers, two effect objects and a stat applied twice.
- RemovingASkillLeavesNothingBehind()
A removed skill has to leave both lists, otherwise GetBuff<T>() keeps answering for a skill the character no longer has (the AI asks it before deciding to flee).
- RepeatedUseDoesNotAccumulate()
The regression that a play run caught: UseSkill(Skill, bool) hands the skill back to AddSkill(Skill) on every use, so a character that fights for a while used to collect one copy of its attack per swing.
- StartingSkillNamesCarryTheirLevel()
A prefab names its starting skills by type, and may ask for a starting level with "Name:3".
- TwoCharactersKeepTheirOwnSkillState()
Skills belong to a character, never to the class: leveling one character's skill must not move another's. (The shared, never-mutated definition is the catalog's prototype — see SkillFactoryContractTests.)