aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-04 19:32:05 -0400
committerhistoria <[not public]>2026-07-04 19:32:05 -0400
commit7b009e904524f30cbff6346730e8d8fe4b046a6b (patch)
tree2e1b364f9efc4f82ebf67c492642951dfcc13b4b
parenta5d4ead1795882d25da7eda53680d2a84590693d (diff)
downloadthehouseoficarus-7b009e904524f30cbff6346730e8d8fe4b046a6b.tar.gz
feat: add casino chips, change drops to chips
-rw-r--r--data/items/misc/chips.yaml5
-rw-r--r--data/mobs/examples/ancient_construct.yaml2
-rw-r--r--data/mobs/examples/bandit.yaml4
-rw-r--r--data/mobs/examples/corrupted_scientist.yaml2
-rw-r--r--data/mobs/examples/crawler.yaml4
-rw-r--r--data/mobs/examples/drone.yaml4
-rw-r--r--data/mobs/examples/elite_synth.yaml2
-rw-r--r--data/mobs/examples/enforcer_bot.yaml4
-rw-r--r--data/mobs/examples/feral_cyborg.yaml2
-rw-r--r--data/mobs/examples/ghoul.yaml2
-rw-r--r--data/mobs/examples/goblin.yaml4
-rw-r--r--data/mobs/examples/greater_drone.yaml2
-rw-r--r--data/mobs/examples/heavy_mech.yaml2
-rw-r--r--data/mobs/examples/iron_sentinel.yaml2
-rw-r--r--data/mobs/examples/lesser_drone.yaml2
-rw-r--r--data/mobs/examples/man.yaml4
-rw-r--r--data/mobs/examples/molten_elemental.yaml2
-rw-r--r--data/mobs/examples/moss_giant.yaml4
-rw-r--r--data/mobs/examples/mutant_rat.yaml4
-rw-r--r--data/mobs/examples/phantom.yaml4
-rw-r--r--data/mobs/examples/plasma_wraith.yaml2
-rw-r--r--data/mobs/examples/psionic_entity.yaml2
-rw-r--r--data/mobs/examples/scrap_bot.yaml4
-rw-r--r--data/mobs/examples/security_turret.yaml4
-rw-r--r--data/mobs/examples/skeleton.yaml4
-rw-r--r--data/mobs/examples/slug.yaml2
-rw-r--r--data/mobs/examples/solar_panel_frame.yaml4
-rw-r--r--data/mobs/examples/titan_sentinel.yaml2
-rw-r--r--data/mobs/examples/veteran_merc.yaml2
-rw-r--r--data/mobs/examples/void_reaper.yaml2
-rw-r--r--data/mobs/examples/war_drone.yaml4
-rw-r--r--data/mobs/examples/zombie.yaml4
-rw-r--r--internal/config/config.go1
-rw-r--r--internal/game/cmd_bank.go57
-rw-r--r--internal/game/cmd_color.go1
-rw-r--r--internal/game/cmd_score.go3
-rw-r--r--internal/game/core_utils.go10
-rw-r--r--internal/game/render_prompt.go1
-rw-r--r--internal/player/player.go1
39 files changed, 122 insertions, 49 deletions
diff --git a/data/items/misc/chips.yaml b/data/items/misc/chips.yaml
new file mode 100644
index 0000000..5d14e33
--- /dev/null
+++ b/data/items/misc/chips.yaml
@@ -0,0 +1,5 @@
+name: chips
+color: "FE"
+description: "A colorful casino chip."
+value: 0
+stackable: true
diff --git a/data/mobs/examples/ancient_construct.yaml b/data/mobs/examples/ancient_construct.yaml
index 139e6ae..d198ebb 100644
--- a/data/mobs/examples/ancient_construct.yaml
+++ b/data/mobs/examples/ancient_construct.yaml
@@ -34,7 +34,7 @@ combat:
description: An impossibly old machine from before the regression, still operational. Its design is alien even by modern standards, covered in glowing runes that predate recorded history.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 10000
weight: 40
- item_id: bloodjunk
diff --git a/data/mobs/examples/bandit.yaml b/data/mobs/examples/bandit.yaml
index 8e4c4b0..2e328d9 100644
--- a/data/mobs/examples/bandit.yaml
+++ b/data/mobs/examples/bandit.yaml
@@ -32,10 +32,10 @@ combat:
description: A scrappy outlaw with a cybernetic arm and patched armor. He eyes you with predatory intent.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 30
weight: 70
- - item_id: credits
+ - item_id: chips
quantity: 80
weight: 20
- table: herb_table_low
diff --git a/data/mobs/examples/corrupted_scientist.yaml b/data/mobs/examples/corrupted_scientist.yaml
index 3757932..8db7af7 100644
--- a/data/mobs/examples/corrupted_scientist.yaml
+++ b/data/mobs/examples/corrupted_scientist.yaml
@@ -37,7 +37,7 @@ combat:
description: A researcher whose mind was consumed by their own experiments. Energy crackles around their fingertips and their lab coat is singed and tattered.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 150
weight: 50
- item_id: solarjunk
diff --git a/data/mobs/examples/crawler.yaml b/data/mobs/examples/crawler.yaml
index 53a149a..5a5b776 100644
--- a/data/mobs/examples/crawler.yaml
+++ b/data/mobs/examples/crawler.yaml
@@ -34,12 +34,12 @@ combat:
description: A heavily armored bio-mechanical creature with a chitinous exoskeleton. Its regenerative biology prevents death unless dissolved with acid.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 250
weight: 70
- item_id: acid_vial
weight: 10
- - item_id: credits
+ - item_id: chips
quantity: 500
weight: 20
remains: chitin_plate
diff --git a/data/mobs/examples/drone.yaml b/data/mobs/examples/drone.yaml
index 30b1bcd..3ecbc69 100644
--- a/data/mobs/examples/drone.yaml
+++ b/data/mobs/examples/drone.yaml
@@ -34,12 +34,12 @@ combat:
description: A malfunctioning security drone crackling with electrical discharge. Its attacks are especially dangerous to anyone not wearing insulated gloves.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 75
weight: 80
- item_id: insulated_gloves
weight: 5
- - item_id: credits
+ - item_id: chips
quantity: 200
weight: 15
remains: circuit_board
diff --git a/data/mobs/examples/elite_synth.yaml b/data/mobs/examples/elite_synth.yaml
index 4bf7638..67d06d8 100644
--- a/data/mobs/examples/elite_synth.yaml
+++ b/data/mobs/examples/elite_synth.yaml
@@ -37,7 +37,7 @@ combat:
description: A sleek combat android with glowing blue optics and a compact energy weapon. Its chassis is polished alloy and its movements are disturbingly fluid.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 1500
weight: 50
- item_id: biojunk
diff --git a/data/mobs/examples/enforcer_bot.yaml b/data/mobs/examples/enforcer_bot.yaml
index 7ba5ac0..e44bc5d 100644
--- a/data/mobs/examples/enforcer_bot.yaml
+++ b/data/mobs/examples/enforcer_bot.yaml
@@ -34,13 +34,13 @@ combat:
description: A heavy riot control automaton with impact shields and a shock baton. It moves with deliberate, crushing steps.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 350
weight: 60
- item_id: scrap
quantity: 5
weight: 20
- - item_id: credits
+ - item_id: chips
quantity: 800
weight: 15
- table: gem_table
diff --git a/data/mobs/examples/feral_cyborg.yaml b/data/mobs/examples/feral_cyborg.yaml
index 8aa0969..68d394a 100644
--- a/data/mobs/examples/feral_cyborg.yaml
+++ b/data/mobs/examples/feral_cyborg.yaml
@@ -32,7 +32,7 @@ combat:
description: A heavily augmented human whose implants have driven them to madness. Razor-sharp blades extend from their forearms and their optical implant glows red.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 300
weight: 60
- item_id: scrap
diff --git a/data/mobs/examples/ghoul.yaml b/data/mobs/examples/ghoul.yaml
index 49be88f..f9d34ea 100644
--- a/data/mobs/examples/ghoul.yaml
+++ b/data/mobs/examples/ghoul.yaml
@@ -34,7 +34,7 @@ combat:
description: A radiation-scarred crew member, barely recognizable as human. Its flesh glows faintly and its eyes are hollow sockets.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 80
weight: 60
- item_id: scrap
diff --git a/data/mobs/examples/goblin.yaml b/data/mobs/examples/goblin.yaml
index 649c896..e40bb0f 100644
--- a/data/mobs/examples/goblin.yaml
+++ b/data/mobs/examples/goblin.yaml
@@ -28,10 +28,10 @@ combat:
description: A small green-skinned goblin with a rusty blade.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 5
weight: 80
- - item_id: credits
+ - item_id: chips
quantity: 25
weight: 20
remains: bones
diff --git a/data/mobs/examples/greater_drone.yaml b/data/mobs/examples/greater_drone.yaml
index 08ecd33..c6ac317 100644
--- a/data/mobs/examples/greater_drone.yaml
+++ b/data/mobs/examples/greater_drone.yaml
@@ -34,7 +34,7 @@ drops:
- item_id: scrap
quantity: 3
weight: 40
- - item_id: credits
+ - item_id: chips
quantity: 1500
weight: 60
idle_descriptions:
diff --git a/data/mobs/examples/heavy_mech.yaml b/data/mobs/examples/heavy_mech.yaml
index afb5c2e..7fea08f 100644
--- a/data/mobs/examples/heavy_mech.yaml
+++ b/data/mobs/examples/heavy_mech.yaml
@@ -34,7 +34,7 @@ combat:
description: A lumbering assault mech with layered armor plating and a rotary cannon arm. Steam vents from its exhaust ports with each step.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 1000
weight: 55
- item_id: scrap
diff --git a/data/mobs/examples/iron_sentinel.yaml b/data/mobs/examples/iron_sentinel.yaml
index 9628db1..2ce6311 100644
--- a/data/mobs/examples/iron_sentinel.yaml
+++ b/data/mobs/examples/iron_sentinel.yaml
@@ -31,7 +31,7 @@ drops:
- item_id: scrap
quantity: 5
weight: 30
- - item_id: credits
+ - item_id: chips
quantity: 5000
weight: 60
idle_descriptions:
diff --git a/data/mobs/examples/lesser_drone.yaml b/data/mobs/examples/lesser_drone.yaml
index dd84ba3..f748207 100644
--- a/data/mobs/examples/lesser_drone.yaml
+++ b/data/mobs/examples/lesser_drone.yaml
@@ -33,7 +33,7 @@ drops:
loot:
- item_id: scrap
weight: 60
- - item_id: credits
+ - item_id: chips
quantity: 300
weight: 40
idle_descriptions:
diff --git a/data/mobs/examples/man.yaml b/data/mobs/examples/man.yaml
index 1ffa746..acd3239 100644
--- a/data/mobs/examples/man.yaml
+++ b/data/mobs/examples/man.yaml
@@ -34,10 +34,10 @@ combat:
description: A shabby-looking man loitering in the town square.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 10
weight: 98
- - item_id: credits
+ - item_id: chips
quantity: 150
weight: 2
- item_id: grimy_guam
diff --git a/data/mobs/examples/molten_elemental.yaml b/data/mobs/examples/molten_elemental.yaml
index 9c16f54..0d56abd 100644
--- a/data/mobs/examples/molten_elemental.yaml
+++ b/data/mobs/examples/molten_elemental.yaml
@@ -34,7 +34,7 @@ combat:
description: A flowing mass of liquid metal and superheated slag, roughly humanoid. The air around it shimmers with heat and droplets of molten alloy drip to the floor.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 2000
weight: 50
- item_id: biojunk
diff --git a/data/mobs/examples/moss_giant.yaml b/data/mobs/examples/moss_giant.yaml
index cff159a..574be8e 100644
--- a/data/mobs/examples/moss_giant.yaml
+++ b/data/mobs/examples/moss_giant.yaml
@@ -28,10 +28,10 @@ combat:
description: A towering creature covered in moss and vines, its rocky skin dripping with moisture.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 120
weight: 50
- - item_id: credits
+ - item_id: chips
quantity: 500
weight: 50
remains: bones
diff --git a/data/mobs/examples/mutant_rat.yaml b/data/mobs/examples/mutant_rat.yaml
index 233bd50..b3e42e7 100644
--- a/data/mobs/examples/mutant_rat.yaml
+++ b/data/mobs/examples/mutant_rat.yaml
@@ -34,12 +34,12 @@ combat:
description: A bloated rodent with glowing green eyes and exposed muscle tissue. Bio-engineering runoff has made it unnaturally aggressive.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 20
weight: 60
- item_id: scrap
weight: 30
- - item_id: credits
+ - item_id: chips
quantity: 60
weight: 10
remains: bones
diff --git a/data/mobs/examples/phantom.yaml b/data/mobs/examples/phantom.yaml
index 34ddcdd..74784b5 100644
--- a/data/mobs/examples/phantom.yaml
+++ b/data/mobs/examples/phantom.yaml
@@ -34,12 +34,12 @@ combat:
description: A semi-transparent entity that phases in and out of visible light. Its psychic attacks are devastating to anyone without a spectral visor.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 500
weight: 60
- item_id: spectral_visor
weight: 3
- - item_id: credits
+ - item_id: chips
quantity: 1000
weight: 37
remains: ectoplasm
diff --git a/data/mobs/examples/plasma_wraith.yaml b/data/mobs/examples/plasma_wraith.yaml
index 8fd8c2e..31b4862 100644
--- a/data/mobs/examples/plasma_wraith.yaml
+++ b/data/mobs/examples/plasma_wraith.yaml
@@ -37,7 +37,7 @@ combat:
description: A shimmering entity of contained plasma, vaguely humanoid in shape. It radiates intense heat and hums with barely contained energy.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 400
weight: 50
- item_id: chaosjunk
diff --git a/data/mobs/examples/psionic_entity.yaml b/data/mobs/examples/psionic_entity.yaml
index 9d8351c..7a9a7ef 100644
--- a/data/mobs/examples/psionic_entity.yaml
+++ b/data/mobs/examples/psionic_entity.yaml
@@ -35,7 +35,7 @@ combat:
description: A barely visible distortion in the air, only detectable by the pressure it exerts on your mind. When it focuses, you see a shimmering outline of something vast and ancient.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 5000
weight: 40
- item_id: lawjunk
diff --git a/data/mobs/examples/scrap_bot.yaml b/data/mobs/examples/scrap_bot.yaml
index 227033b..7c63178 100644
--- a/data/mobs/examples/scrap_bot.yaml
+++ b/data/mobs/examples/scrap_bot.yaml
@@ -32,13 +32,13 @@ combat:
description: A malfunctioning maintenance robot that has gone rogue. Its chassis is covered in dents and rust, and one optical sensor flickers erratically.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 40
weight: 60
- item_id: scrap
quantity: 2
weight: 30
- - item_id: credits
+ - item_id: chips
quantity: 100
weight: 10
remains: scrap
diff --git a/data/mobs/examples/security_turret.yaml b/data/mobs/examples/security_turret.yaml
index 0403474..182025a 100644
--- a/data/mobs/examples/security_turret.yaml
+++ b/data/mobs/examples/security_turret.yaml
@@ -37,13 +37,13 @@ combat:
description: A ceiling-mounted auto-turret with twin barrels and a red targeting laser. It tracks you with mechanical precision.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 100
weight: 70
- item_id: scrap
quantity: 3
weight: 20
- - item_id: credits
+ - item_id: chips
quantity: 250
weight: 10
remains: scrap
diff --git a/data/mobs/examples/skeleton.yaml b/data/mobs/examples/skeleton.yaml
index f1d9ed5..489f5fd 100644
--- a/data/mobs/examples/skeleton.yaml
+++ b/data/mobs/examples/skeleton.yaml
@@ -28,10 +28,10 @@ combat:
description: An animated pile of bones, held together by dark energy.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 30
weight: 70
- - item_id: credits
+ - item_id: chips
quantity: 100
weight: 30
remains: bones
diff --git a/data/mobs/examples/slug.yaml b/data/mobs/examples/slug.yaml
index 41aa849..36862cd 100644
--- a/data/mobs/examples/slug.yaml
+++ b/data/mobs/examples/slug.yaml
@@ -34,7 +34,7 @@ combat:
description: A bloated, translucent slug the size of a dog. Its skin glistens with toxic mucus. It cannot be killed by conventional means — only salt can destroy it.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 15
weight: 100
remains: slug_mucus
diff --git a/data/mobs/examples/solar_panel_frame.yaml b/data/mobs/examples/solar_panel_frame.yaml
index a24e79c..c18a294 100644
--- a/data/mobs/examples/solar_panel_frame.yaml
+++ b/data/mobs/examples/solar_panel_frame.yaml
@@ -26,10 +26,10 @@ combat:
description: A half-assembled photovoltaic array on a steel frame. Panels, brackets and cabling are laid out, waiting to be fitted. This is work, not a fight — fix the panels into place to complete the array.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 40
weight: 70
- - item_id: credits
+ - item_id: chips
quantity: 90
weight: 25
- item_id: coal
diff --git a/data/mobs/examples/titan_sentinel.yaml b/data/mobs/examples/titan_sentinel.yaml
index 2192527..02fdcf2 100644
--- a/data/mobs/examples/titan_sentinel.yaml
+++ b/data/mobs/examples/titan_sentinel.yaml
@@ -37,7 +37,7 @@ drops:
- item_id: scrap
quantity: 10
weight: 30
- - item_id: credits
+ - item_id: chips
quantity: 8000
weight: 50
- table: gem_table
diff --git a/data/mobs/examples/veteran_merc.yaml b/data/mobs/examples/veteran_merc.yaml
index 0e187c1..5171302 100644
--- a/data/mobs/examples/veteran_merc.yaml
+++ b/data/mobs/examples/veteran_merc.yaml
@@ -35,7 +35,7 @@ combat:
description: A battle-hardened soldier with a high-powered rifle and tactical armor covered in campaign patches. Their cybernetic eye locks onto you instantly.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 1200
weight: 55
- item_id: chaosjunk
diff --git a/data/mobs/examples/void_reaper.yaml b/data/mobs/examples/void_reaper.yaml
index 4223f69..45967a6 100644
--- a/data/mobs/examples/void_reaper.yaml
+++ b/data/mobs/examples/void_reaper.yaml
@@ -36,7 +36,7 @@ combat:
description: A shadowy figure that seems to absorb light itself. Its form shifts between a hooded specter and an armored construct. A scythe of dark energy flickers in its grasp.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 20000
weight: 30
- item_id: law_identifier
diff --git a/data/mobs/examples/war_drone.yaml b/data/mobs/examples/war_drone.yaml
index e0136a9..db84f57 100644
--- a/data/mobs/examples/war_drone.yaml
+++ b/data/mobs/examples/war_drone.yaml
@@ -34,13 +34,13 @@ combat:
description: An upgraded combat drone with reinforced plating and a heavier weapons array. Its targeting systems whir as it locks onto you.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 200
weight: 60
- item_id: scrap
quantity: 4
weight: 20
- - item_id: credits
+ - item_id: chips
quantity: 500
weight: 10
- table: gem_table
diff --git a/data/mobs/examples/zombie.yaml b/data/mobs/examples/zombie.yaml
index e104989..4acab62 100644
--- a/data/mobs/examples/zombie.yaml
+++ b/data/mobs/examples/zombie.yaml
@@ -30,10 +30,10 @@ combat:
description: A shambling corpse reanimated by residual asteroid radiation.
drops:
loot:
- - item_id: credits
+ - item_id: chips
quantity: 50
weight: 60
- - item_id: credits
+ - item_id: chips
quantity: 200
weight: 40
remains: bones
diff --git a/internal/config/config.go b/internal/config/config.go
index fd0638d..728c8a3 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -63,6 +63,7 @@ func DefaultColors() ColorsConfig {
"eat_food": "9C",
"drop_message": "BA",
"credits_pickup": "DC",
+ "chips_pickup": "FE",
"visual_tick": "21 dim",
"visual_first_tick": "C4 bold",
"battery": "2D",
diff --git a/internal/game/cmd_bank.go b/internal/game/cmd_bank.go
index bbf600f..06ae828 100644
--- a/internal/game/cmd_bank.go
+++ b/internal/game/cmd_bank.go
@@ -3,6 +3,7 @@ package game
import (
"fmt"
"sort"
+ "strconv"
"strings"
"thehouseoficarus/internal/behavior"
@@ -35,6 +36,8 @@ func (g *Game) handleBankInput(sess *net.Session, input string) {
case "deposit":
if len(parts) < 2 {
sess.WriteLine("Deposit what?")
+ } else if parts[1] == "credits" {
+ g.doBankDepositCredits(sess, parts)
} else if parts[1] == "all" {
g.doBankDepositAll(sess)
} else {
@@ -43,6 +46,8 @@ func (g *Game) handleBankInput(sess *net.Session, input string) {
case "withdraw":
if len(parts) < 2 {
sess.WriteLine("Withdraw what?")
+ } else if parts[1] == "credits" {
+ g.doBankWithdrawCredits(sess, parts)
} else {
g.doBankWithdraw(sess, strings.Join(parts[1:], " "))
}
@@ -52,7 +57,7 @@ func (g *Game) handleBankInput(sess *net.Session, input string) {
g.leaveBank(sess)
return
default:
- sess.WriteLine("Commands: deposit <item>, deposit all, withdraw <item>, browse, leave")
+ sess.WriteLine("Commands: deposit <item>, deposit credits <n>, deposit all, withdraw <item>, withdraw credits <n>, browse, leave")
}
g.writeBankPrompt(sess)
}
@@ -92,7 +97,7 @@ func (g *Game) showBankBrowse(sess *net.Session) {
entries = append(entries, bankEntry{slot: i, name: itemName, id: slot.ItemID, qty: slot.Quantity})
}
- if len(entries) == 0 {
+ if len(entries) == 0 && p.BankedCredits <= 0 {
sess.WriteLine("Your bank is empty.")
return
}
@@ -113,6 +118,10 @@ func (g *Game) showBankBrowse(sess *net.Session) {
for _, line := range t.Render(unicode, p.OptionInt("wrap_width")) {
sess.WriteLine(line)
}
+
+ if p.BankedCredits > 0 {
+ sess.WriteLine(g.colorize(sess, "credits_pickup", fmt.Sprintf("Banked credits: %s", formatInt(p.BankedCredits))))
+ }
}
func (g *Game) doBankDeposit(sess *net.Session, input string) {
@@ -326,6 +335,50 @@ func (g *Game) withdrawBankItem(sess *net.Session, p *player.Player, bankSlotIdx
}
}
+func (g *Game) doBankDepositCredits(sess *net.Session, parts []string) {
+ p := sess.Player
+ if len(parts) < 3 {
+ sess.WriteLine("Usage: deposit credits <amount>")
+ return
+ }
+ amount, err := strconv.Atoi(parts[2])
+ if err != nil || amount <= 0 {
+ sess.WriteLine("Invalid amount.")
+ return
+ }
+ if p.Credits < amount {
+ sess.WriteLine("You don't have that many credits.")
+ return
+ }
+ p.Credits -= amount
+ p.BankedCredits += amount
+ g.AccountStore.SaveCharacter(p)
+ sess.WriteLine(g.colorize(sess, "credits_pickup", fmt.Sprintf("You deposit %s credits. (Banked: %s)", formatInt(amount), formatInt(p.BankedCredits))))
+ g.showBankBrowse(sess)
+}
+
+func (g *Game) doBankWithdrawCredits(sess *net.Session, parts []string) {
+ p := sess.Player
+ if len(parts) < 3 {
+ sess.WriteLine("Usage: withdraw credits <amount>")
+ return
+ }
+ amount, err := strconv.Atoi(parts[2])
+ if err != nil || amount <= 0 {
+ sess.WriteLine("Invalid amount.")
+ return
+ }
+ if p.BankedCredits < amount {
+ sess.WriteLine("You don't have that many banked credits.")
+ return
+ }
+ p.BankedCredits -= amount
+ p.Credits += amount
+ g.AccountStore.SaveCharacter(p)
+ sess.WriteLine(g.colorize(sess, "credits_pickup", fmt.Sprintf("You withdraw %s credits.", formatInt(amount))))
+ g.showBankBrowse(sess)
+}
+
func (g *Game) canUseBank(p *player.Player) bool {
instances := g.World.FindObjInstances(p.RoomID, "bank booth")
return len(instances) > 0
diff --git a/internal/game/cmd_color.go b/internal/game/cmd_color.go
index f7041df..a2ec2c4 100644
--- a/internal/game/cmd_color.go
+++ b/internal/game/cmd_color.go
@@ -163,6 +163,7 @@ var colorCategoryOrder = []string{
"eat_food",
"drop_message",
"credits_pickup",
+ "chips_pickup",
"map_at",
"map_blocked",
diff --git a/internal/game/cmd_score.go b/internal/game/cmd_score.go
index 0554f32..b493e80 100644
--- a/internal/game/cmd_score.go
+++ b/internal/game/cmd_score.go
@@ -98,9 +98,10 @@ func (g *Game) doScore(sess *net.Session) {
content(row1)
creditsStr := g.colorize(sess, "credits_pickup", formatInt(p.Credits))
+ chipsStr := g.colorize(sess, "chips_pickup", formatInt(countChips(p)))
styleStr := color.Render(mode, color.Parse("4B"), fmt.Sprintf("Style: %s", p.AttackStyle))
invStr := fmt.Sprintf("Inv: %d/28", 28-p.FreeSlots())
- row2 := padded("Credits: "+creditsStr, 20) + padded(styleStr, 24) + invStr
+ row2 := padded("Credits: "+creditsStr, 19) + padded("Chips: "+chipsStr, 16) + padded(styleStr, 22) + invStr
content(row2)
gap()
diff --git a/internal/game/core_utils.go b/internal/game/core_utils.go
index 2855bcf..71d0acb 100644
--- a/internal/game/core_utils.go
+++ b/internal/game/core_utils.go
@@ -149,3 +149,13 @@ func (g *Game) newInventorySlot(itemID string, qty int) *player.InventorySlot {
}
return slot
}
+
+func countChips(p *player.Player) int {
+ total := 0
+ for _, slot := range p.Inventory {
+ if slot != nil && slot.ItemID == "chips" {
+ total += slot.Quantity
+ }
+ }
+ return total
+}
diff --git a/internal/game/render_prompt.go b/internal/game/render_prompt.go
index 68f1a9a..ad1ba9c 100644
--- a/internal/game/render_prompt.go
+++ b/internal/game/render_prompt.go
@@ -37,6 +37,7 @@ func (g *Game) expandPromptVars(sess *net.Session, text string) string {
text = strings.ReplaceAll(text, "%b", fmt.Sprintf("%.1f", p.Battery))
text = strings.ReplaceAll(text, "%B", fmt.Sprintf("%.0f", p.MaxBattery()))
text = strings.ReplaceAll(text, "%c", fmt.Sprint(p.Credits))
+ text = strings.ReplaceAll(text, "%k", fmt.Sprint(countChips(p)))
text = strings.ReplaceAll(text, "%i", fmt.Sprint(p.FreeSlots()))
text = strings.ReplaceAll(text, "%s", attackStyleShort(p.AttackStyle))
text = strings.ReplaceAll(text, "%S", attackStyleLong(p.AttackStyle))
diff --git a/internal/player/player.go b/internal/player/player.go
index 2f83c21..72eb455 100644
--- a/internal/player/player.go
+++ b/internal/player/player.go
@@ -166,6 +166,7 @@ type Player struct {
RoomID int `yaml:"room_id"`
HP int `yaml:"hp"`
Credits int `yaml:"credits"`
+ BankedCredits int `yaml:"banked_credits"`
Description string `yaml:"description"`
AttackStyle AttackStyle `yaml:"attack_style"`
Prompt string `yaml:"prompt"`