Siege engines: knights bring rams and catapults, masters build their own in the forge

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:46:06 +01:00
1 parent 5a8ebb984e
commit 1ae41228ab
28 files changed
+530 -15

No files matched your search

+15 -2
View File
@@ -176,13 +176,14 @@ pub enum Tool {
Steel,
Drawbridge,
Wall,
Siege(u8), // 0 battering ram, 1 catapult
Trap(crate::traps::TrapKind),
Spell(crate::spells::Spell),
Order(u8), // 0 attack, 1 guard
}
// New tools are appended so that existing key bindings ("tool<i>") keep their meaning
pub const TOOLS: [Tool; 50] = [
pub const TOOLS: [Tool; 52] = [
Tool::Dig,
Tool::Hand,
Tool::Room(0),
@@ -233,6 +234,8 @@ pub const TOOLS: [Tool; 50] = [
Tool::Drawbridge,
Tool::Spell(crate::spells::Spell::Freeze),
Tool::Wall,
Tool::Siege(0),
Tool::Siege(1),
];
@@ -277,6 +280,8 @@ pub fn tool_info(t: Tool) -> ToolInfo {
Tool::Bridge => ("bridge", I_BRIDGE, None),
Tool::Drawbridge => ("drawbridge", I_DRAWBRIDGE, None),
Tool::Wall => ("wall", I_WALL, None),
Tool::Siege(0) => ("ram", I_RAM, None),
Tool::Siege(_) => ("catapult", I_CATAPULT, None),
Tool::Steel => ("steel", I_STEEL, None),
};
let name = match room {
@@ -293,6 +298,10 @@ pub fn tool_cost_static(t: Tool) -> String {
Tool::Trap(k) => trf("cost.work", &[(k.work() as i32).to_string()]),
Tool::Bridge => trf("cost.bridge", &[BRIDGE_COST[0].to_string(), (crate::wood::BRIDGE_WOOD as i32).to_string(), BRIDGE_COST[1].to_string()]),
Tool::Wall => trf("cost.gold_tile", &[(crate::walls::WALL_COST as i32).to_string()]),
Tool::Siege(w) => {
let (g, wd) = if w == 0 { crate::siege::RAM_COST } else { crate::siege::CATAPULT_COST };
trf("cost.gold_wood", &[(g as i32).to_string(), (wd as i32).to_string()])
}
Tool::Drawbridge => trf("cost.drawbridge", &[DRAWBRIDGE_COST[0].to_string(), (crate::wood::DRAWBRIDGE_WOOD as i32).to_string(), DRAWBRIDGE_COST[1].to_string()]),
Tool::Steel => trf("cost.steel", &[STEEL_COST[0].to_string(), STEEL_COST[1].to_string()]),
Tool::Tower(TowerKind::Rune) => {
@@ -320,6 +329,10 @@ pub fn tool_cost(t: Tool, g: &Game) -> String {
Tool::Summon => trf("cost.mana", &[(g.summon_cost() as i32).to_string()]),
Tool::Bridge => trf("cost.bridge", &[BRIDGE_COST[0].to_string(), (crate::wood::BRIDGE_WOOD as i32).to_string(), BRIDGE_COST[1].to_string()]),
Tool::Wall => trf("cost.gold_tile", &[(crate::walls::WALL_COST as i32).to_string()]),
Tool::Siege(w) => {
let (g, wd) = if w == 0 { crate::siege::RAM_COST } else { crate::siege::CATAPULT_COST };
trf("cost.gold_wood", &[(g as i32).to_string(), (wd as i32).to_string()])
}
Tool::Drawbridge => trf("cost.drawbridge", &[DRAWBRIDGE_COST[0].to_string(), (crate::wood::DRAWBRIDGE_WOOD as i32).to_string(), DRAWBRIDGE_COST[1].to_string()]),
Tool::Steel => trf("cost.steel", &[STEEL_COST[0].to_string(), STEEL_COST[1].to_string()]),
Tool::Tower(TowerKind::Rune) => {
@@ -346,7 +359,7 @@ pub const CATS: [(&str, &[usize]); 7] = [
("cat.towers", &[14, 15, 16, 20]),
("cat.traps", &[22, 23, 24, 25, 26, 27, 28, 29, 30, 31]),
("cat.spells", &[9, 10, 11, 32, 33, 34, 35, 36, 37, 38, 39, 48]),
("cat.orders", &[8, 45, 46, 7, 19]),
("cat.orders", &[8, 45, 46, 7, 19, 50, 51]),
];
#[derive(Clone, Copy, PartialEq, Debug)]