Create win/lose outcome logic. An event must resolve with consequences.
Every event needs a resolution — did you win or lose? And what happens as a result? The resolution engine takes inputs (player power, enemy power) and produces consequences (XP gained, XP lost). Without resolution, events are meaningless. Today we make them matter.
Battle Resolution:
- Player Power = 10 + (riskLevel * 2)
- Enemy Power = random between 5 and 20
- If Player Power > Enemy Power → Win (+XP based on riskLevel)
- If Enemy Power >= Player Power → Lose (lose all unbanked XP, respawn to Camp)
Build Resolution:
- Build Cost = deduct materials (karma or debt)
- Completion = add payout to karma
- If karma drops below -50 → forced bankruptcy reset
The decision: take on debt for bigger builds, or stay safe with small jobs?
Ami's battle resolution function:
Ida's build resolution function:
You can win and gain XP/karma. You can lose and feel real consequences. State updates correctly after each resolution.
No complex stats. Single variable power only. No inventory. No special abilities.
Not resetting state after loss — unbanked XP must go to zero, zone must reset to safe.
Making wins too easy — if the player always wins, there is no challenge and no tension.
Making losses too harsh — if the player loses everything every time, they quit. Balance matters.
Not testing both outcomes — you must verify both winning and losing paths work correctly.
This is applied math. The combat formula is simple but powerful. Ask them to calculate: "With riskLevel 3, what's your power? What's the chance of winning?" Player Power would be 10 + (3 * 2) = 16. Enemy range is 5-20. So the player wins against enemies with power 5-15 (11 out of 16 possibilities). Make them reason about probability.