Set Bonuses
Set bonuses reward wearing matching pieces of gear together. A set has steps, such as 2 pieces and 4 pieces, and every step the player has reached adds its bonus on top of the earlier ones. The bonuses are worked out fresh from what is worn, so swapping gear can never leave a bonus behind.

Paste this to your AI
Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.
Add "Set Bonuses" to my game.
What it should do: A set gives the player a reason to collect and plan. Chasing the last piece, or choosing between a set and a single stronger item, makes gear a real decision.
Build it exactly as this state machine. First check that it fits my game, then build it like this:
```mermaid
stateDiagram-v2
[*] --> none
none: No set bonus
partial: Some bonuses
full: Set complete
none --> none: gear changes
none --> partial: reach a step
partial --> none: lose the last step
partial --> partial: gear changes
partial --> full: complete a set
full --> partial: take a piece off
full --> full: gear changes
```
Use these starting values:
- slots: 6
- bonusScale: 1 x
Watch out for these common mistakes:
- Two of the same ring give a set bonus: Tell your AI: count the different pieces that are worn, not the slots that are full.
- A bonus stays behind after swapping gear: Tell your AI: never add and subtract. After any change, work the bonuses out again from what is worn.
- The 4-piece bonus replaces the 2-piece bonus: Tell your AI: add up every step reached, not just the highest one. If a step should replace the earlier one, write that into the set on purpose.
- One piece from each set makes a pair: Tell your AI: count the pieces of each set on its own.
- Gear in the backpack gives a bonus: Tell your AI: only gear in an equipment slot counts toward a set.
- A set that cannot be finished: Tell your AI: check each set against the number of slots when the game starts, and report any step that no gear can reach.
Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP
What it does
A set gives the player a reason to collect and plan. Chasing the last piece, or choosing between a set and a single stronger item, makes gear a real decision.
How it runs, as a diagram
Everything it can be in, and what moves it on. Your AI builds from exactly this.
How it runs, as a diagram
- No set bonus → No set bonus: gear changes
- No set bonus → Some bonuses: reach a step
- Some bonuses → No set bonus: lose the last step
- Some bonuses → Some bonuses: gear changes
- Some bonuses → Set complete: complete a set
- Set complete → Some bonuses: take a piece off
- Set complete → Set complete: gear changes
Good starting values
| Value | Start with | What it changes |
|---|---|---|
| slots | 6 | How many places the character can wear gear in. It must be at least as many as the biggest set has pieces, or that set can never be finished. |
| bonusScale | 1 x | A multiplier on every set bonus, for easy and hard modes or for tuning. At 1 the bonuses are as written, and at 0 they are switched off while the sets still count. |
What usually goes wrong
Two of the same ring give a set bonus
The character has two ring slots and wears the same ring in both. Each slot is counted, so one piece counts as two and the first step arrives for free.
Fix: Tell your AI: count the different pieces that are worn, not the slots that are full.
A bonus stays behind after swapping gear
The code adds a bonus when a piece goes on and takes it off when the piece comes off. Putting a new item straight over an old one skips the taking off, so the old bonus stays for good.
Fix: Tell your AI: never add and subtract. After any change, work the bonuses out again from what is worn.
The 4-piece bonus replaces the 2-piece bonus
The code picks only the highest step reached. A player with four pieces loses the speed they had with two, and a full set can feel weaker than a half set.
Fix: Tell your AI: add up every step reached, not just the highest one. If a step should replace the earlier one, write that into the set on purpose.
One piece from each set makes a pair
The code counts all set pieces together instead of per set. One wolf cap and one ember ring then count as two pieces and give a bonus that belongs to neither set.
Fix: Tell your AI: count the pieces of each set on its own.
Gear in the backpack gives a bonus
The code looks at everything the player owns, so a whole set in the backpack gives its full bonus without anyone wearing it.
Fix: Tell your AI: only gear in an equipment slot counts toward a set.
A set that cannot be finished
A set has four pieces but the character has only three slots for them. The last step can never be reached, and players blame themselves.
Fix: Tell your AI: check each set against the number of slots when the game starts, and report any step that no gear can reach.
How to check it works
- You wear no gear. you put on the wolf cap: the game counts one of four wolf pieces and gives no bonus.
- You wear the wolf cap. you also put on the wolf vest: you get +5 speed.
- You wear all four wolf pieces. you look at your bonuses: you have +5 speed and +12 armor, and with only three pieces you have just the +5 speed.
- You have a free slot next to the wolf cap. you wear a second wolf cap in it, or the same ember ring in three slots: each counts as one piece and no bonus arrives.
- You wear two wolf pieces and two ember pieces. you look at your bonuses: you get +5 speed from the wolf set and +10 fire from the ember set, and one piece from each set gives nothing.
- You wear two wolf pieces and get +5 speed. you take one off: the bonus is gone, and taking off from an empty slot changes nothing.
- You wear all four wolf pieces. you put plain boots over the wolf boots, then an ember cloak over the gloves, then an ember ring over the vest: your bonus goes from speed and armor, to speed only, to speed only, to +10 fire only.
- You have 6 slots and wear a wolf cap. you put gear in slot 6, slot minus 1, slot 2.5, or put on an item with no name: nothing changes.
- The bonus scale is 0.5. you wear all three ember pieces: you get 12.5 fire and 1.5 luck, half of the written 25 and 3.
- The same five items. you put them on in a different order, or swap one out and back: the bonuses are exactly the same.
Works well with
- Equipment Slots: Give the set code the list of worn items and nothing else. It never needs to know which slot holds which piece. Equipment slots decide what can be worn where. Set bonuses then read what is worn.
- Item Rarity: Let pieces of different rarity count for the same set, or players have to hunt twice. Rarity sets an item's own power, and the set adds its bonus on top.
- Health and Damage: When a piece comes off while the player is hurt, keep their current health inside the new, lower maximum. Work out set bonuses first, then apply them to health and damage.
Common questions
how do set bonuses work in games
Pieces of gear belong to a set. Wearing two, three or four pieces of the same set unlocks bonuses in steps. The game counts the different pieces worn and works the bonuses out again after every change.
should higher set bonuses stack on the lower ones
Usually yes, because a full set that feels weaker than a half set is confusing. Stacking is also easier to explain. If you want a step to replace the earlier one, say so in the set's description.
how big should a set bonus be
Make the first step small, so two pieces are a nice extra. Make the last step worth chasing, roughly as much as one extra strong item. If the bonus is too large, players ignore every item that is not in the set.
what do i tell my ai to add set bonuses
Paste this: Gear pieces can belong to a set. After every equip or unequip, count the different pieces of each set that are worn and add every step the player has reached. Count each piece once, and work the bonuses out fresh each time.
Where it comes from
We could not find a reliable origin for this one yet.
What was checked
- 14 tests pass on the reference code.
- The state diagram was checked against the code, at the default values and at every listed low and high value.
Your AI gets the code
Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it