Item Rarity
Item rarity sorts drops into five tiers, from common to legendary, where each tier is rarer than the one below and stronger. One random roll picks the tier, a luck value tilts the odds toward the higher tiers, and the tier alone sets the item's power. Luck is capped so common drops never vanish.

Paste this to your AI
Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.
Add "Item Rarity" to my game.
What it should do: Rare items give the player something to hope for, and a clear ladder of tiers lets them see at a glance how good a drop is and what it is worth.
Use these starting values:
- rarityStep: 3 x
- luckCap: 1
- powerStep: 1.4 x
Watch out for these common mistakes:
- A legendary item with common power: Tell your AI: roll the tier first and get the power from the tier. If you want some variety inside a tier, keep it small enough that no tier overlaps the next.
- Luck with no limit: Tell your AI: limit luck to the range from zero up to a cap, and treat anything that is not a number as zero.
- A roll of exactly 1 gives no item: Tell your AI: keep the roll between 0 and 1, and if no tier matched, give the top tier.
- Percentages that do not add up: Tell your AI: store weights, not percentages, and divide each weight by the total to get its chance.
- The tier changes when the game is loaded: Tell your AI: roll the tier once, when the item is created, and save the tier with the item.
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
Rare items give the player something to hope for, and a clear ladder of tiers lets them see at a glance how good a drop is and what it is worth.
Good starting values
| Value | Start with | What it changes |
|---|---|---|
| rarityStep | 3 x | How many times rarer each tier is than the one below it. At 3, about two drops in three are common and about one in 120 is legendary. It stays above 1, or higher tiers would not be rarer. |
| luckCap | 1 | The most luck that counts. At 1, a lucky player gets about nine times as many legendary drops, and common drops still happen. Keep it below the rarity step minus 1, or the higher tiers stop being rarer. Without a cap, enough luck would turn every drop legendary. |
| powerStep | 1.4 x | How many times stronger each tier is than the one below it. At 1.4, a legendary item is about four times as strong as a common one. At 1 all tiers are equally strong and rarity is only for show. |
What usually goes wrong
A legendary item with common power
The power is rolled on its own, before or apart from the tier. Sometimes a legendary drop is weaker than a common one, and the player feels cheated.
Fix: Tell your AI: roll the tier first and get the power from the tier. If you want some variety inside a tier, keep it small enough that no tier overlaps the next.
Luck with no limit
Luck from gear, events and potions piles up. At a high enough total, every drop is legendary, or a negative total gives odds below zero and the game breaks.
Fix: Tell your AI: limit luck to the range from zero up to a cap, and treat anything that is not a number as zero.
A roll of exactly 1 gives no item
The tiers are walked with a plain less-than test. A roll of 1, or a running sum that falls just short of 1 from rounding, matches no tier, and the drop comes out empty or crashes.
Fix: Tell your AI: keep the roll between 0 and 1, and if no tier matched, give the top tier.
Percentages that do not add up
The odds are typed in as 60, 25, 10, 4 and 0.5 percent. They add up to 99.5, so half a percent of rolls land nowhere. When someone changes one number, the rest drift.
Fix: Tell your AI: store weights, not percentages, and divide each weight by the total to get its chance.
The tier changes when the game is loaded
The game saves only which item it is, and rolls the tier again on loading. A rare item in the backpack turns common, or the player reloads to reroll their loot.
Fix: Tell your AI: roll the tier once, when the item is created, and save the tier with the item.
How to check it works
- Rarity step 3 and no luck. you look at the chances of the five tiers: common is about 67 percent, legendary about 0.8 percent, and each tier is a third as likely as the one below.
- No luck. the roll is 0.5, 0.7, 0.9, 0.97 and 0.999: the drops are common, uncommon, rare, epic and legendary.
- A roll of 0.5, which is common without luck. the player has the most luck there is: the same roll gives an uncommon drop, and a roll of 0.9 gives an epic one.
- The luck cap is 1. the player has luck 5, or 1000, or endless luck: the odds are the same as at luck 1, and the lowest roll is still common.
- A curse gives luck of minus 3, or the luck is not a number. you look at the odds: they are the same as with no luck at all.
- An item with base power 10 and a power step of 1.4. it drops as each tier from common to legendary: its power is 10, 14, 20, 27 and 38.
- Rolls that should not happen. the roll is 1, 7, minus 0.5 or not a number: the drop is legendary for 1 and 7, and common for the other two.
- Any luck from none up to the cap. you add up the five chances: they come to one whole.
- Four drops with rolls 0.1, 0.2, 0.7 and 0.999. you read the tally: two are common, one uncommon, one legendary, and the total is four.
Works well with
- Loot Table: Keep the two rolls separate. One roll cannot serve both without the second choice leaning on the first. The loot table decides what drops, and then rarity decides how good that drop is.
- Bad Luck Protection: Reset the miss count only for the tier it protects, or the guarantee never arrives. Count the misses first. When protection guarantees a rare drop, pick the tier directly instead of rolling it.
- Item Stacking: A common and a rare version of one item must not merge into one stack. Treat the tier as part of what makes two items the same.
- Set Bonuses: Decide whether the bonus depends on tier. Matching pieces of mixed tiers should still count as one set. Tier decides an item's power, and the set decides the bonus for wearing pieces together.
Common questions
how do item rarity tiers work in games
Each drop gets a tier from common up to legendary. Higher tiers are much rarer and stronger. The tier is rolled once when the item is made, and the power follows from it.
how rare should a legendary item be
Start with about one drop in 120, which is what a rarity step of 3 gives. If your players get dozens of drops per hour, make it rarer, and if they get a few per session, make it more common.
how much stronger should rare items be
A step of 1.4 per tier makes legendary about four times as strong as common. Go higher if rarity should change how a fight plays out, and lower if rarity should be mostly about looks and collecting.
what do i tell my ai to add item rarity
Paste this: Add five rarity tiers, common to legendary. Each tier is 3 times rarer than the one below. Roll the tier first, then set the item's power from it, 1.4 times more per tier. Luck raises the odds of higher tiers but is capped.
Where it comes from
We could not find a reliable origin for this one yet.
What was checked
- 15 tests pass on the reference code.
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