
ForgeRework
Safe Forge of Potential refinement with configurable success odds and an independent maximum item level.Forge Rework
A small BepInEx mod for Valheim's Forge of Potential. Successful attempts increase the item's current quality by one. Failed attempts consume the normal idol cost and leave the item unchanged: no destruction, downgrade, durability loss, or damaging failure explosion. Ordinary crafting and other crafting stations keep their normal behavior.
Configuration
On first launch, BepInEx creates BepInEx/config/MerlinofMines.ForgeRework.cfg
in the active profile. Settings also appear in BepInEx Configuration Manager.
Changes made through Configuration Manager apply immediately. Restart after
editing the file outside the game.
Levels use standard integer inputs. Min Level defaults to 0 and Max Level to 10; 0 disables the maximum-level cap. Probabilities use standard 0–100 sliders. Existing settings are migrated automatically to the new sections and names.
[Levels]
Min Level = 0
Max Level = 10
[Probabilities]
Max Probability = 100
Min Probability = 0
Probability Dropoff Per Level = 10
Percentages use 0–100, and dropoff is in percentage points per level.
chance = max(Min Probability, Max Probability - Probability Dropoff Per Level * max(0, currentQuality - Min Level))
Max Level is a separate hard cap on the resulting item quality. At or above it,
attempts are disabled even if the curve still gives a positive percentage.
Both the item status and disabled refinement button display MAX, either at
the hard cap or when the success probability reaches zero.
Those items also have greyed-out names and dimmed, visible icons in the forge list.
They remain selectable so you can inspect them. Changing the curve refreshes the
list, allowing items to become available again.
Set it to 0 to disable the hard cap. A zero success chance still blocks
attempts, without charging any resources. Existing items above the cap are
left unchanged. Min Level controls where the dropoff begins, not the item's
initial quality or eligibility. Below Min Level the odds stay at Max Probability.
Min Probability must not exceed Max Probability. Invalid combined settings retain the last valid curve (defaults if none) and produce a warning in the log.
Default probability preview
Level means current displayed item quality, not the number of forge upgrades. Level 0 is included to illustrate the formula; normal gear starts at quality 1.
| Upgrade | Success | Unchanged on failure |
|---|---|---|
| 0 → 1 | 100% | 0% |
| 1 → 2 | 90% | 10% |
| 2 → 3 | 80% | 20% |
| 3 → 4 | 70% | 30% |
| 4 → 5 | 60% | 40% |
| 5 → 6 | 50% | 50% |
| 6 → 7 | 40% | 60% |
| 7 → 8 | 30% | 70% |
| 8 → 9 | 20% | 80% |
| 9 → 10 | 10% | 90% |
| 10+ | Blocked | No cost |
Destruction and downgrade chances are always 0%.
For a constant 25% success chance up to level 20, use Max Probability=25, Min Probability=25, Probability Dropoff Per Level=0, and Max Level=20. Level 19 → 20 has a 25% chance; level 20 → 21 is blocked. Alternatively, a falling curve such as 100% minus 10 points per level with a 20% floor and Max Level=15 gives:
| Current level | Success |
|---|---|
| 4 | 60% |
| 5 | 50% |
| 6 | 40% |
| 7 | 30% |
| 8–14 | 20% |
| 15+ | Blocked |
Build and try it
Requires .NET SDK 9, a local Valheim installation, and BepInEx 5.
.\build.ps1
This builds the mod, runs automated tests, verifies Harmony/private member
bindings against the installed game, creates an importable ZIP in artifacts,
and copies the package into the Thunderstore cache under
MerlinofMines-ForgeRework/1.0.0. It also updates the installed copy in the
ValheimVR profile, so subsequent builds do not require another import. Close
Valheim before building, then launch it again to load the new DLL. Disabled mods
are left disabled. Override GamePath, BepInExPath, CachePath or ProfilePath with
script parameters; use -NoDeploy to build/package only.
A cache copy does not itself enable the mod in an existing profile. Import
artifacts/MerlinofMines-ForgeRework-1.0.0.zip using Thunderstore Mod Manager's
local-mod import, then launch the profile. Alternatively copy ForgeRework.dll
into that profile's BepInEx/plugins/ForgeRework folder. Do not install two copies.
Confirm Forge Rework loaded appears in the BepInEx log.
Validation
dotnet run --project tests/ForgeRework.Tests.csproj -c Release
.\tests\Verify-GameBindings.ps1
Tests exercise the actual probability and game-adapter source with minimal game doubles: deterministic roll distributions, exact RNG endpoints, invalid settings, hard caps with positive minimum odds, costs, item preservation, ordinary crafting pass-through, and displayed odds. Binding checks inspect the installed game's assembly. These do not execute Unity or prove compatibility with other mods.
Built against the locally installed Valheim 1.0.16. In-game verification remains:
- Check level-4 gear displays only
Chance To Upgrade: 60%. - Attempt refinement and check idol consumption, unchanged failures, and +1 successes.
- Test with a full inventory; no free slots are needed for broken-item refunds.
- Set a positive floor and a low Max Level; verify the cap still blocks attempts.
- Check a normal workbench/forge still crafts and upgrades normally.
This is a client-side patch with local configuration; it does not synchronize or enforce settings across multiplayer clients. Successful refinement repairs and unequips the item, as ordinary upgrades do, while preserving its existing identity and custom data. Original game eligibility and idol requirements still apply.