This documents the Luck calculator Finite-State Machine (FSM) the Blue Prince uses for determining the number of items to spawn in rooms.
This was made for Blue Prince version 1.0.13, Patch 1.04, April 30, 2025.
Note
The words "Guarenteed" and "dows" are misspelled in the game's code. I have preserved the misspellings here.
██████╗ ██╗ ██╗ ██╗███████╗
██╔══██╗██║ ██║ ██║██╔════╝
██████╔╝██║ ██║ ██║█████╗
██╔══██╗██║ ██║ ██║██╔══╝
██████╔╝███████╗╚██████╔╝███████╗
╚═════╝ ╚══════╝ ╚═════╝ ╚══════╝
██████╗ ██████╗ ██╗███╗ ██╗ ██████╗███████╗
██╔══██╗██╔══██╗██║████╗ ██║██╔════╝██╔════╝
██████╔╝██████╔╝██║██╔██╗ ██║██║ █████╗
██╔═══╝ ██╔══██╗██║██║╚██╗██║██║ ██╔══╝
██║ ██║ ██║██║██║ ╚████║╚██████╗███████╗
╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝ ╚═════╝╚══════╝
███████╗██████╗ ██████╗ ██╗██╗ ███████╗██████╗ ███████╗
██╔════╝██╔══██╗██╔═══██╗██║██║ ██╔════╝██╔══██╗██╔════╝
███████╗██████╔╝██║ ██║██║██║ █████╗ ██████╔╝███████╗
╚════██║██╔═══╝ ██║ ██║██║██║ ██╔══╝ ██╔══██╗╚════██║
███████║██║ ╚██████╔╝██║███████╗███████╗██║ ██║███████║
╚══════╝╚═╝ ╚═════╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝╚══════╝
█████╗ ██╗ ██╗███████╗ █████╗ ██████╗ ██╗
██╔══██╗██║ ██║██╔════╝██╔══██╗██╔══██╗██║
███████║███████║█████╗ ███████║██║ ██║██║
██╔══██║██╔══██║██╔══╝ ██╔══██║██║ ██║╚═╝
██║ ██║██║ ██║███████╗██║ ██║██████╔╝██╗
╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝
- Blue Prince Luck Calculator FSM [SPOILERS]
- Table of Contents
- Where to Begin
- Luck Defaults
- Luck Mechanics
- States
- 0: Luck Check
- 1: Item Spawn
- 2: Loop Back
- 3: VERANDA Check
- 4: Set Bad Luck 2
- 5: Set Avg Luck 2
- 6: Set Kinda Lucky 2
- 7: Set Lucky 2
- 8: 3 Items Guarenteed!
- 9: 4 out of 4
- 10: 1 Item Guarenteed!
- 11: 2 Items Guarenteed!
- 12: 0 Items
- 13: Send Drop Target
- 14: Rabbit's Foot
- 15: +3
- 16: SET INT LUCK
- 17: Set Dowsed Luck
- 18: Dowse Correction
- 19: Luck Balance Modifiers
- 20: Dowsing Check
- 21: Dowsing Rod
- 22: Check Dowsing Array
- 23: Dows +1
- 24: Dows +2
- 25: Dows Check
- 26: State 1
- 27: State 2
The FSM remains in the Item Spawn state until it receives the "Luck Calculator" event and the it transitions to the Dowsing Check state.
Variable | Default Value |
---|---|
LUCK | 10 |
BalanceSubtraction | -3 |
TempLuck | 0 |
DowsLuck | 0 |
Dowse | False |
Veranda Luck Bonus | 0 |
This is a collection of Luck mechanics that have been investigated.
Veranda luck bonus is an additional luck bonus granted to Green Rooms by drafting Verandas and Spare Verandas (a tier-2 upgrade to the Spare Room). This bonus is added to LUCK when drafting a Green Room to form the base luck for that Green Room.
- The first Veranda drafted +12
- Each additional Veranda is +6
- Each Spare Veranda (including the first) is +6
If you draft a Veranda, a Spare Veranda, Chamber of Mirrors, a 2nd Veranda, a 2nd Spare Veranda, a Secret Passage, and a 3rd Veranda or Spare Veranda, the total Veranda Luck Bonus will be +36. If you have the base luck of 10 and draft a Green Room, the base luck for the Green Room will be 46. If you draft a Blue Room (or any thing other than a Green Room) your luck will only be the base 10.
Cloister of Rynna increases LUCK for the day by +6 for each Green Room you draft from the Cloister. This means each Cloister of Rynna can increase luck by up to +18. This will not carry over into future days.
Drafting a Maid's Chamber decreases Luck by 7 each. If you draft a Maid's Chamber, a Chamber of Mirrors, and a 2nd Maid's Chamber, your LUCK will be decreased by -14. With a base luck of 10, your LUCK will be -4.
When the player has the Lucky Rabbit's Foot in their inventory, +3 is added to the room's luck.
Further testing is needed to better understand how this works.
Each room has it's own logic as to how many and which items will be spawned. They all use the luck calculator to determine the room's luck and target items at drafting time. They then use that luck and items in their own logic. For example, even though te luck calculator might set 4 drop items for the room, the room may still have logic to limit to 3 items or decrease the chances of 4 items.
It is quite a task to try and decipher the logic for each room, so that has not yet been done.
It appears luck may be used in determining whether or not a room has Metal Detector items in it. Metal detecting is done at the same time as item spawning when the room is drafted. This means metal detecting will not proc for rooms that have already been drafted before obtaining the Metal Detector.
Luck determines whether trunks spawn or not. Trunks are treated like any spawn item. In a room which can spawn a Trunk, and Apple, a Key, a Gem, 5 Coins, or a Metal detector, if the drop target is 2, then there is chance to spawn the Trunk and another item or just 2 other items.
Further investigation needs to be done on the influence of Luck on Trunk items.
Luck influences the number of dirt piles spawned in a room. The higher your luck, the higher the chance of spawning max dirt piles. Dirt piles are tracked separately from spawn items, so you can potentially spawn max items for a room and max dirt piles.
Luck plays no role on dirt pile items. Items looted from dirt piles are determined by what digging related items you have in your inventory and hard coded percentage chances.
So far, I have only found luck used in room item spawning. However, I have looked into several systems to explicitly determine that luck is not used or influenced.
Luck has been confirmed to have no influence on the following:
- Rarity of drafted rooms
- Casino slot machines
- Trading Post Items
- Commissary Items
- Dirt Pile Items
Luck has been confirmed to be unaffected by the following:
- Coins in the fountain
- Being Cursed
- If this room's luck is less than 5 go to the "Set Bad Luck 2" state.
- If this room's luck is less than 11 go to the "Set Avg Luck 2" state.
- If this room's luck is less than 16 go to the "Set Kinda Lucky 2" state.
- If this room's luck is less than 19 go to the "Set Lucky 2" state.
- If this room's luck is less than 23 go to the "2 Items Guarenteed!" state.
- If this room's luck is less than 29 go to the "3 Items Guarenteed!" state.
- Got to state "4 out of 4"??
When receiving the "Luck Calculator" event, go to the "Dowsing Check" state.
Wait 0.02 seconds then go to "Item Spawn" state.
- If veranda luck bonus is 0 go to the "Luck Balance Modifiers" state.
- If this is not a green room go to the "Luck Balance Modifiers" state.
- Add veranda luck bonus to this room's luck
- Go to the "Luck Balance Modifiers" state.
Set DropTarget to 1.
ID | Weight | Target State |
---|---|---|
Bad Luck | 93% | 0 Items |
Avg Luck | 7% | Dowse Correction |
ID | Weight | Target State |
---|---|---|
Bad Luck | 85% | 0 Items |
Lucky | 15% | 1 Item Guarenteed! |
ID | Weight | Target State |
---|---|---|
Bad Luck | 60% | 0 Items |
Lucky | 40% | 1 Item Guarenteed! |
ID | Weight | Target State |
---|---|---|
Bad Luck | 20% | 0 Items |
Lucky | 80% | 1 Item Guarenteed! |
- Set DropTarget to 2.
- If this room's luck is less than 17, go to the "Send Drop Target" state.
- Set DropTarget to 3.
- Subtract 2 from BalanceSubtraction.
- Go to the "Send Drop Target" state.
- Set DropTarget to 4
- Subtract 3 from BalanceSubtraction.
- Go to the "Send Drop Target" state.
Set DropTarget to 1
ID | Weight | Target State |
---|---|---|
Avg Luck | 96% | Dowse Correction |
Very Lucky | 4% | 2 Items Guarenteed! |
- Set DropTarget to 1.
- If this room's luck is less than 11 go to the "Send Drop Target" state.
- Set DropTarget to 2.
- Subtract 1 from BalanceSubtraction.
ID | Weight | Target State |
---|---|---|
Avg Luck | 95% | Send Drop Target |
Very Lucky | 5% | 3 Items Guarenteed! |
- Set DropTarget to 0.
- Go to the "Dowse Correction" state.
- Set Dowse to False.
- Set DropTarget in this room's Item management FSM to this FSM's DropTarget.
- Send "Items Go" event to this room's Item management FSM.
- Go to the "Loop Back" state.
- If player inventory contains Lucky Rabbit's Foot go to the "+3" state.
- If player inventory contains Lucky Purse go to the "+3" state. If not go to the "VERANDA Check" state.
- Add 3 to this room's luck.
- Go to the "VERANDA Check" state.
- Set this room's luck to the luck calculator's LUCK.
- go to the "Rabbit's Foot" state.
- Set dowse to True.
- Add 32 to LUCK and set the result in TempLuck.
- Go to the "Rabbit's Foot" state.
- If dowse is False go to the "Send Drop Target" state.
- Set DropTarget to 1
- go to the "Send Drop Target" state.
- If dowse is True go to "Dows Check" state.
- Subtract SubtractionBalance from this room's luck.
- Go to the "Luck Check" state.
- If dowse is True go to the "Set Dowsed Luck" state.
- If dowse is False go to the "SET INT LUCK" state.
- If this room's luck is less than 19 then go to the "Luck Check" state.
- Set DropTarget to 1
ID | Weight | Target State |
---|---|---|
Avg Luck | 85% | 1 Item Guarenteed! |
Very Lucky | 10% | Dows +1 |
Extremely Lucky | 5% | Dows +2 |
- If the current room is in the Drafting manager's DopTarget 1 rooms list go to the "2 Items Guarenteed!" state.
- If the current room is not in the Drafting manager's DopTarget 1 rooms list go to the "Dowsing Rod" state.
- add 1 to dows luck.
- Go to the "3 Items Guarenteed!" state
- add 2 to dows luck.
- Go to the "4 out of 4" state
- If dows luck is greater than 5 go to the "State 2" state.
- If dows luck is greater than 2 go to the "State 1" state.
- Go to the "Check Dowsing Array" state.
ID | Weight | Target State |
---|---|---|
Avg Luck | 60% | State 2 |
Very Lucky | 20% | Check Dowsing Array |
Bad Luck | 20% | 1 Item Guarenteed! |
ID | Weight | Target State |
---|---|---|
Avg Luck | 50% | 2 Items Guarenteed! |
Bad Luck | 50% | 1 Item Guarenteed! |