Conversation
…lowerTierAdversary - Add `level: Int` (default 1) to `Player` and `PlayerConfig`, with custom `init(from:)` so existing JSON missing the field decodes to 1. - Forward `level` through `Player.asConfig()`. - Add `DifficultyBudget.tier(forLevel:)` per SRD tier mapping (L1→T1, L2–4→T2, L5–7→T3, L8–10→T4). - Add `DifficultyBudget.partyTier(levels:)` using median level, rounded up at tier boundaries; empty input returns T1. - Extend `suggestedAdjustments` with `adversaryTiers:[Int]` and `partyTier:Int?` params; auto-inserts `.lowerTierAdversary` when at least one adversary has a known tier strictly below the party tier. - All existing call sites remain source-compatible (new params are defaulted to `[]` / `nil`). Resolves #21.
…arameterized tier tests
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
level: Int(default1) toPlayerandPlayerConfig; backward-compatible with existing JSON via custominit(from:)that falls back to1when the key is absent.levelthroughPlayer.asConfig().DifficultyBudget.tier(forLevel:)— SRD tier mapping (L1→T1, L2–4→T2, L5–7→T3, L8–10→T4).DifficultyBudget.partyTier(levels:)— median level, rounded up at tier boundaries; empty input returns T1.suggestedAdjustmentswith optionaladversaryTiers:[Int]andpartyTier:Int?; auto-inserts.lowerTierAdversarywhen any adversary has a known tier strictly below party tier. All existing call sites are source-compatible (params default to[]/nil).Test plan
playerDefaultLevelIsOne— newPlayerhaslevel == 1playerLevelRoundTrip— level survives encode/decodeplayerLevelDefaultsToOneWhenAbsentInJSON— legacy JSON (nolevelkey) decodes to1asConfigPreservesAllFields—levelforwarded byasConfig()playerConfigCodableRoundTrip—PlayerConfigwith level roundtripsplayerConfigLevelDefaultsToOneWhenAbsentInJSON— legacyPlayerConfigJSON decodes to1tierForLevel*— all four tier boundary testspartyTier*— empty, single, odd count, even count with boundary roundinglowerTierAdversary*— detected, not detected when tiers match, not detected without partyTier, tier-zero ignoredsuggestedAdjustmentsBackwardCompatible— existing call sites still workAll 85 DHModelsTests pass. Closes #21.