Half favour for bank overflow
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
67a5db86ff
commit
a18e8e5bb7
3 changed files with 6 additions and 4 deletions
3
game.py
3
game.py
|
|
@ -18,6 +18,7 @@ BASE_SLOTS = 12
|
|||
BASE_STACK = 1000
|
||||
CLASS_SPEED = 0.8
|
||||
LUCKY_CHANCE = 0.1
|
||||
OVERFLOW_FAVOUR = 0.5 # favour for items a full bank spills to the city, vs. giving on purpose
|
||||
RECON_PER_INTEL = 8
|
||||
MAX_LOG = 200
|
||||
REGEN_PER_HOUR = 0.25 # share of max HP recovered per game hour
|
||||
|
|
@ -452,7 +453,7 @@ def bank_add(world: dict, player: dict, item: str, qty: int, now: float, overflo
|
|||
stockpile = world["city"]["stockpile"]
|
||||
stockpile[item] = stockpile.get(item, 0) + spill
|
||||
gain = spill * ITEMS[item]["value"]
|
||||
player["favour"] += gain
|
||||
player["favour"] += gain * OVERFLOW_FAVOUR
|
||||
player["donated"] += gain
|
||||
overflow[item] = overflow.get(item, 0) + spill
|
||||
return keep
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ function awayModal(sum) {
|
|||
${sum.gold ? `<p class="gold">+${fmt(sum.gold)} gold</p>` : ""}
|
||||
${xp ? `<ul>${xp}</ul>` : ""}
|
||||
${levels ? `<ul>${levels}</ul>` : ""}
|
||||
${spilled ? `<p class="muted small">Your bank was full, so this went to the city stockpile (you earned favour for it):</p><ul>${spilled}</ul>` : ""}
|
||||
${spilled ? `<p class="muted small">Your bank was full, so this went to the city stockpile (for half the favour of giving it yourself):</p><ul>${spilled}</ul>` : ""}
|
||||
${sum.stopped ? `<p class="tag bad">Stopped: ${esc(sum.stopped)}</p>` : ""}
|
||||
<p><button class="btn primary" data-close>Back to work</button></p>`);
|
||||
}
|
||||
|
|
@ -421,7 +421,7 @@ function bank() {
|
|||
<p class="small muted">When an item doesn't fit:
|
||||
<button class="btn sm ${me.overflow === "city" ? "gold" : ""}" data-overflow="city">Send it to the city</button>
|
||||
<button class="btn sm ${me.overflow === "stop" ? "gold" : ""}" data-overflow="stop">Stop working</button>
|
||||
<br>Raids never touch your bank. Overflow sent to the city still earns favour.</p>
|
||||
<br>Raids never touch your bank. Overflow sent to the city earns half the favour of giving it yourself.</p>
|
||||
</div>
|
||||
${favourPanel()}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ class ActionTest(unittest.TestCase):
|
|||
self.assertEqual(p["bank"]["stone"], game.BASE_STACK)
|
||||
self.assertEqual(summary["overflow"], {"stone": 3})
|
||||
self.assertEqual(world["city"]["stockpile"]["stone"], 3)
|
||||
self.assertEqual(p["favour"], 3)
|
||||
self.assertEqual(p["favour"], 1.5) # half favour for overflow
|
||||
self.assertEqual(p["donated"], 3)
|
||||
|
||||
def test_full_bank_can_stop_instead(self):
|
||||
world = world_with(("fred", "warrior"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue