Spawn, merchant, and formula tweaks#333
Draft
Caeldeth wants to merge 4 commits into
Draft
Conversation
- HS-1481: Downgrade "no empty tiles" spawn log from Fatal to Warning - HS-1491: Use Merchant DisplayName (when set) in chat messages - HS-1295: Respect DisableForget on NPC roles — hide Forget Skill/Spell options when merchant template has DisableForget=true - Remove viewport-based radius cap on cone intents — cone was the only shape with this artificial limit - Add [FormulaVariable] to 12 ItemObject properties (Weight, MinLevel, MaxLevel, MinAbility, MaxAbility, Value, Durability, MaximumDurability, MinLDamage, MaxLDamage, MinSDamage, MaxSDamage) - Implement Repair.Type filtering — weapon-only and armor-only repair NPCs now respect their configured type Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Creatures were allocating all stat points in a single batch at their spawn level, causing MpHpIncrease() to evaluate the HP growth formula with final-level stats every time instead of compounding level-by-level. Now iterates from level 1 to target level, allocating 2 stat points per level and evaluating MonsterHpGainPerLevel with the correct accumulated stats at each step. Extracted pattern-based allocation into AllocatePatternPoints() for clarity. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Recursive creature HP allocation: level restored after init, higher level monsters have more HP and higher total stats - ItemObject FormulaVariables: verify 12 properties annotated, expected names present, FormulaParser discovers them at startup - Cone radius cap: verify viewport cap pattern removed from source Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3ed85c7 to
9343282
Compare
Move the tests added in 9343282 into the existing per-subject files matching the repo convention (one class per subject area): - MonsterAllocateStats / HP scaling -> Hybrasyl.Tests/Monster.cs - ItemObject FormulaVariable annotations -> Hybrasyl.Tests/Items.cs - Cone radius cap regression -> Hybrasyl.Tests/Targeting.cs Drop FormulaParserScansItemObjectForVariables: FormulaParser is internal and the test never compiled (typeof on inaccessible type). The two remaining FormulaVariable tests already cover the contract - that 12 ItemObject properties carry the expected annotation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
baughj
requested changes
May 17, 2026
| } | ||
|
|
||
| [Fact] | ||
| public void ItemObjectHas12FormulaVariables() |
Member
There was a problem hiding this comment.
What's the purpose of this test? Either something has an attribute or it doesn't - removing an attribute isn't very likely. Is this just to ensure there aren't any unnoticeable scripting changes?
| } | ||
|
|
||
| [Fact] | ||
| public void ConeRadiusNotCappedByViewport() |
Member
There was a problem hiding this comment.
This test needs to test the actual expected behavior versus checking for what is effectively a regression, and also doing it in a way that is fragile?
| case Direction.East: | ||
| { | ||
| obj = Map.EntityTree.FirstOrDefault(predicate: x => x.X == X + 1 && x.Y == Y && x is Creature); | ||
| case Direction.East: |
Member
There was a problem hiding this comment.
is this just tab / spacing changes?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DisplayNamein chat), HS-1295 (respectDisableForgeton NPC roles), remove viewport-based radius cap on cone intents, add[FormulaVariable]to 12ItemObjectproperties, implementRepair.Typefiltering for weapon-only/armor-only repair NPCsMpHpIncrease()to evaluateMonsterHpGainPerLevelwith final-level stats every iteration instead of compounding level-by-levelEasyWins.cscovers recursive HP allocation,ItemObjectFormulaVariables registration, and the cone radius cap removalTest plan
EasyWins.HpAllocation_IsRecursive— higher-level monsters have more HP and higher total stats than low-levelEasyWins.ItemObject_FormulaVariables_Present— 12 annotated properties discovered byFormulaParserat startupEasyWins.ConeIntent_NoViewportRadiusCap— viewport cap pattern removed fromCreature.csDisplayNameset and verify chat uses display name; configure a weapon-only repair NPC and verify only weapons offered