Wood: giant mushrooms underground, felled by imps; wooden bridges and doors cost wood

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 22:07:59 +01:00
1 parent c5adc3e902
commit 398bb95681
28 files changed
+447 -31

No files matched your search

+29 -6
View File
@@ -462,6 +462,7 @@ pub struct MasterState {
pub core: (i32, i32),
pub core_hp: f32,
pub gold: f32,
pub wood: f32,
pub mana: f32,
pub payday: f32,
pub payday_warned: bool,
@@ -586,6 +587,10 @@ pub struct Game {
#[serde(default)]
pub bridgework: crate::bridges::BridgeWork, // burning and worn bridges
#[serde(default)]
pub wood: f32, // the second resource (see wood.rs)
#[serde(default)]
pub woodwork: crate::wood::WoodWork, // felled mushrooms growing back
#[serde(default)]
pub dwarf_t: f32,
#[serde(default)]
pub rune_free: u32, // rune forge towers that can be built for free (from chests)
@@ -749,9 +754,9 @@ pub const ROOM_NAMES: [&str; N_ROOMS] = [
];
// bridge cost per tile: over water, over lava
pub const BRIDGE_COST: [i32; 2] = [30, 75];
// a drawbridge tile (over water or lava)
pub const DRAWBRIDGE_COST: i32 = 150;
pub const BRIDGE_COST: [i32; 2] = [10, 75];
// a drawbridge tile: over water (and wood, see wood.rs), over lava
pub const DRAWBRIDGE_COST: [i32; 2] = [120, 150];
// steel wall cost per tile: from earth, from a reinforced wall
pub const STEEL_COST: [i32; 2] = [80, 40];
pub const STEEL_HP: f32 = 40.0;
@@ -904,6 +909,8 @@ impl Game {
vrng: crate::particles::vrng(),
dwarf_caves: Vec::new(),
bridgework: Default::default(),
wood: crate::wood::WOOD_START,
woodwork: Default::default(),
dwarf_t: 30.0,
rune_free: 0,
rune_final: 0,
@@ -1394,6 +1401,7 @@ impl Game {
core: self.map.core,
core_hp: self.core_hp,
gold: self.gold,
wood: self.wood,
mana: self.mana,
payday: self.payday,
payday_warned: self.payday_warned,
@@ -1423,6 +1431,7 @@ impl Game {
self.map.core = m.core;
self.core_hp = m.core_hp;
self.gold = m.gold;
self.wood = m.wood;
self.mana = m.mana;
self.payday = m.payday;
self.payday_warned = m.payday_warned;
@@ -1657,6 +1666,7 @@ impl Game {
}
self.update_dwarves(dt);
self.update_bridges(dt);
self.update_wood(dt);
// fallen hearts of a match are shared state: every client marks them in the same step
self.update_fallen_masters();
// the end of the game and the fog are about the master at this computer
@@ -2896,7 +2906,7 @@ impl Game {
}
pub fn build_bridges_of(&mut self, x0: i32, y0: i32, x1: i32, y1: i32, draw: bool) {
let (mut built, mut broke, mut any_river) = (0, false, false);
let (mut built, mut broke, mut any_river, mut no_wood) = (0, false, false, false);
loop {
let mut add = Vec::new();
for y in y0.min(y1)..=y0.max(y1) {
@@ -2917,12 +2927,19 @@ impl Game {
let mut progress = false;
for i in add {
let lava = self.map.t[i].kind == Kind::Lava;
let cost = if draw { DRAWBRIDGE_COST } else { BRIDGE_COST[lava as usize] } as f32;
let cost = if draw { DRAWBRIDGE_COST[lava as usize] } else { BRIDGE_COST[lava as usize] } as f32;
// wooden bridges also cost wood
let wood = if lava { 0.0 } else if draw { crate::wood::DRAWBRIDGE_WOOD } else { crate::wood::BRIDGE_WOOD };
if self.gold < cost {
broke = true;
continue;
}
if self.wood + 1e-3 < wood {
no_wood = true;
continue;
}
self.gold -= cost;
self.wood -= wood;
let t = &mut self.map.t[i];
t.kind = if draw {
Kind::Drawbridge
@@ -2948,6 +2965,9 @@ impl Game {
if broke {
self.msg("msg.no_gold", vec![]);
self.sfx_ui(Sfx::Error);
} else if no_wood {
self.msg("msg.no_wood", vec![]);
self.sfx_ui(Sfx::Error);
} else if built == 0 {
self.hint(21, if any_river { "hint.bridge_where" } else { "hint.bridge_river" });
}
@@ -3300,6 +3320,9 @@ impl Game {
self.sfx(Sfx::Dig, fxx, fxy);
}
if done {
if self.map.t[t].plant() {
self.felled(t);
}
self.dig_out(t);
e.job = Job::None;
}
@@ -4728,7 +4751,7 @@ impl Game {
}
if t.owner == self.me && t.bridge() {
let lava = t.river() == Some(Kind::Lava);
let cost = if t.kind == Kind::Drawbridge { DRAWBRIDGE_COST } else { BRIDGE_COST[lava as usize] };
let cost = if t.kind == Kind::Drawbridge { DRAWBRIDGE_COST[lava as usize] } else { BRIDGE_COST[lava as usize] };
t.kind = if lava { Kind::Lava } else { Kind::Water };
t.owner = Owner::None;
t.reserved = 0;