PeglinRelicRerolls
Reroll the relics you're offered after minibosses, bosses, chests and in shops. Start each run with 5 rerolls and buy more in shops.
| Date uploaded | 3 days ago |
| Version | 1.1.0 |
| Download link | PierreMarais-PeglinRelicRerolls-1.1.0.zip |
| Downloads | 14 |
| Dependency string | PierreMarais-PeglinRelicRerolls-1.1.0 |
This mod requires the following mods to function
BepInEx-BepInExPack_Peglin
BepInEx pack for Peglin. Preconfigured and ready to go.
Preferred version: 5.4.2100README
PeglinRelicRerolls
Don't like the relics you're offered? Reroll them.
Features
- Start every run with 5 relic rerolls. Higher Cruciball means fewer: one less at Cruciball 5, 10 and 15.
- Reroll relic rewards after minibosses, floor bosses and chests. Press T on a keyboard, R3 (click the right stick) on a controller, or click the Reroll button.
- No repeats. You won't see the same relic twice on one screen, or a relic you already own. If there's nothing left to reroll into, the button tells you why.
- Floor boss rewards can be rerolled once.
- Chests. Rerolling a common chest has a chance to offer a rare relic. Rerolling a rare chest has an ultra rare chance that something very special happens...
- Reroll die in every shop. One common relic is swapped for a die you can buy for 20 gold (doubled in act 4 and with Wand of Greed, like relic prices). One die per shop.
- Shop rerolls. Spend a reroll to swap the shop's unbought relics for new ones, up to 3 times per shop. Prices stay the same.
- Reroll counter. A die above your first relic shows how many rerolls you have, with the count in its corner like the game's own relic counts.
- Saved with your run. Quitting and continuing can't give you extra rerolls or refund spent ones.
For mod authors
Other mods can work with the rerolls through RelicRerollsApi, a static class in this plugin. This mod doesn't know about your mod: you find the class by name, check ApiVersion, and register with your own plugin GUID. Registering again with the same GUID replaces your earlier registration, and RemoveAll(guid) removes everything you registered. A callback that throws is logged once and treated as "no opinion". With nothing registered the mod behaves as normal.
| Member | What it does |
|---|---|
ApiVersion |
Currently 1 |
RerollCount |
Rerolls left in the current run |
AddRerolls(int) |
Adds rerolls, or removes them if negative (never below 0) |
SetStartingCountProvider(guid, Func<int?>) |
Starting rerolls for a new run. null means no opinion (the usual rule, with the Cruciball penalty). Only asked when a new run starts, never when a run is continued |
SetRelicScreenFilter(guid, Func<RelicRarity, bool, int?>) |
Per relic screen, given its rarity and whether it is a chest: null no opinion, 0 no reroll button, -1 unlimited, n at most n rerolls. The smallest answer wins, and it replaces BossRerollLimit for that screen |
SetShopFilter(guid, Func<bool>) |
false from anyone hides the reroll die and shop relic rerolls |
SetRelicFilter(guid, Func<Relic, bool>) |
false from anyone keeps that relic out of every reroll |
SetStateSlotProvider(guid, Func<string>) |
The state slot for the current run. null or empty is the default slot (PeglinRelicRerolls.state); other names use PeglinRelicRerolls.<slot>.state. Use lowercase letters, digits, - and _; anything else is replaced and a short hash is added so different names never share a file |
SetAutoSaveFilter(guid, Func<bool>) |
false from anyone stops the mod saving and loading the count by itself when the game saves or continues a run; the mode then calls Commit() and Restore() at its own save and load points. A new run still resets the count |
Commit() / Restore() |
Save or load the count for the current slot now, for modes with their own save flow |
SetRerollListener(guid, Action<string, Relic[]>) |
Called after every reroll that changed the offer (never a refunded one), with where it happened (relic_screen, chest or shop; more names may be added, so ignore ones you don't know) and every relic now offered there, in slot order. Read RerollCount for the rerolls left |
RemoveAll(guid) |
Removes everything you registered |
Notes: a starting-count provider can be asked more than once while a new run starts, so return the same value each time. When a run is continued and its slot has no saved state, the normal starting count is used, not your provider's. If a slot provider throws, or calls Commit() or Restore() while it is being asked, nothing is saved or loaded that time, so one mode's rerolls never land in another's file.
Example, using reflection so your mod doesn't need a reference to this one:
using System;
using System.Linq;
using BepInEx.Bootstrap;
// In your plugin, after BepInEx has loaded the other plugins (e.g. in Start, or declare
// [BepInDependency("PeglinRelicRerolls", BepInDependency.DependencyFlags.SoftDependency)]).
if (Chainloader.PluginInfos.TryGetValue("PeglinRelicRerolls", out var info))
{
Type api = info.Instance.GetType().Assembly.GetTypes().FirstOrDefault(t => t.Name == "RelicRerollsApi");
int version = api == null ? 0 : (int)api.GetProperty("ApiVersion").GetValue(null, null);
if (version >= 1)
{
// Ten starting rerolls and no shop rerolls while my mode is running.
api.GetMethod("SetStartingCountProvider").Invoke(null, new object[] { "my.mod.guid", new Func<int?>(() => 10) });
api.GetMethod("SetShopFilter").Invoke(null, new object[] { "my.mod.guid", new Func<bool>(() => false) });
}
}
Installation
With a mod manager (recommended):
- Install r2modman or the Thunderstore Mod Manager.
- Search for PeglinRelicRerolls and install it. BepInEx is installed for you.
- Launch Peglin.
Manually:
- Install BepInExPack_Peglin.
- Put
PeglinRelicRerolls.dllinPeglin/BepInEx/plugins/. - Start the game once to create the config file.
Settings
Change these in BepInEx/config/PeglinRelicRerolls.cfg (start the game once to create it). Restart the game after changing them.
| Setting | Default | What it does |
|---|---|---|
StartingRerolls |
5 | Rerolls at the start of every new run |
RerollHotkey |
T | Keyboard key for rerolling |
ControllerRerollButton |
JoystickButton9 (R3) | Controller button for rerolling. None turns it off |
ShowRerollBadge |
true | Show the reroll counter above your relics |
EnableLogging |
true | Write reroll details to BepInEx/LogOutput.log |
EnableBattleReroll |
true | Allow rerolls after miniboss and boss battles |
EnableChestReroll |
true | Allow rerolls in chests |
ChestRareUpgradeChance |
0.15 | Chance that rerolling a common chest offers a rare relic |
ChestBossUpgradeChance |
0.001 | Chance of something special when rerolling a rare chest |
BossRerollLimit |
1 | Rerolls allowed on floor boss rewards. -1 for no limit |
EnableShopReroll |
true | Put a reroll die in every shop |
EnableShopRelicReroll |
true | Allow rerolling the shop's relics |
ShopRerollLimit |
3 | Shop rerolls allowed per shop. -1 for no limit |
ShopRerollCost |
20 | Gold price of the reroll die |
PenaltyLevels |
5,10,15 | Cruciball levels that each take rerolls away |
PenaltyPerLevel |
1 | Rerolls taken away at each of those levels. 0 turns it off |
Compatibility
- Built for Peglin v2.0.12. On other versions the mod writes a warning to the log, as some features may not work.
- Requires BepInExPack_Peglin.
Good to know
- The starting relic choice and relics from events can't be rerolled.
- Your rerolls are kept in their own file in
BepInEx/config, separate from your Peglin save, which the mod doesn't touch. They aren't synced by Steam Cloud, so continuing a run on another computer starts you with the default number of rerolls. - Quitting before the game saves (for example on a reward screen) takes the run back to its last save, rerolls included.
- The controller button assumes an Xbox-style layout, which is what Steam Input uses. Without Steam Input, a PlayStation controller may need a different
ControllerRerollButton.
Some of my other mods
- PeglinBalatroScore — a Balatro-style pegs × damage score, with flames and a bomb chest.
- PeglinFonts — change the font of every text in the game.
- PeglinKeybinds — rebind keyboard and controller controls from inside the game.
- PeglinMaxSpeed — play at up to 15× speed without physics bugs.
- PeglinQuickRestart — hold a button to restart your run.
Please consider buying me a coffee ☕
CHANGELOG
Changelog
1.1.0
- Added a public API (
RelicRerollsApi) so other mods can work with rerolls: read and change the reroll count, set the starting count, limit or switch off rerolls per relic screen, switch off shop rerolls, keep chosen relics out of rerolls, and keep rerolls in their own save slot. With no mod using it, nothing changes. - Mods with their own save flow can switch off the automatic saving and loading of the reroll count and save it themselves.
- Mods can listen for rerolls: they're told where each reroll happened (a relic screen, a chest or a shop) and which relics are now offered.
- A relic screen that shows a rarer relic than its own rarity (such as a mod's relic draft with rares among commons) rerolls that slot at the relic's own rarity. Every other slot, including the game's own fallback when a pool runs dry, rerolls at the screen's rarity as before.
- Reroll state can now live in separate slots, one file per slot. The default slot is the same
PeglinRelicRerolls.statefile as before, so your current run's rerolls carry over. - A relic with a rarity the mod doesn't know is no longer treated as Common: it can't be picked for the reroll die and isn't rerolled in shops.
- The reroll die's price now follows the price multiplier of the shop slot it replaces (Wand of Greed, act 4) instead of checking for act 4, so it stays in step with relic prices. Prices are unchanged.
- Fixed the floor boss reroll being counted as used when another relic pick was opened on the same screen first (for example a mod's relic draft before the boss relic).
- Fixed shop purchases with the curse that makes things cost HP: buying the reroll die or a relic took the HP but gave nothing, and heals and damage in later battles threw errors until the game was restarted.
1.0.1
- Fixed the controller reroll button (R3 by default) doing nothing when pressed.
- The Reroll button shows the reroll die before its text.
- The reroll counter's number is bigger and sits in the die's corner, like the game's relic counts.
1.0.0
- First release: relic rerolls for miniboss, floor boss and chest rewards, a reroll die and relic rerolls in shops, a reroll counter above your relics, and fewer rerolls at Cruciball 5, 10 and 15.