Orders: attack (fighting creatures nearby go for an enemy or enemy tower) and guard (up to three creatures hold a room for two minutes); right click with an order tool cancels

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-04 07:52:03 +01:00
1 parent b3583f5e7e
commit 0606c1f994
9 files changed
+230 -6

No files matched your search

+7 -2
View File
@@ -159,10 +159,11 @@ pub enum Tool {
Steel,
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; 45] = [
pub const TOOLS: [Tool; 47] = [
Tool::Dig,
Tool::Hand,
Tool::Room(0),
@@ -208,6 +209,8 @@ pub const TOOLS: [Tool; 45] = [
Tool::Room(11),
Tool::Room(12),
Tool::Room(13),
Tool::Order(0),
Tool::Order(1),
];
@@ -237,6 +240,8 @@ pub fn tool_info(t: Tool) -> ToolInfo {
Tool::Room(12) => ("arena", T_ARENA, Some(12)),
Tool::Room(_) => ("altar", T_ALTAR, Some(13)),
Tool::Trap(k) => (k.id(), I_TRAPS + crate::traps::TRAP_KINDS.iter().position(|&t| t == k).unwrap_or(0) as u32, None),
Tool::Order(0) => ("order_attack", I_ORDERS, None),
Tool::Order(_) => ("order_guard", I_ORDERS + 1, None),
Tool::Spell(sp) => (sp.id(), I_SPELLS + crate::spells::SPELLS.iter().position(|&t| t == sp).unwrap_or(0) as u32, None),
Tool::Tower(TowerKind::Arrow) => ("arrow", I_ARROW, None),
Tool::Tower(TowerKind::Cannon) => ("cannon", I_CANNON, None),
@@ -313,7 +318,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]),
("cat.orders", &[8, 7, 19]),
("cat.orders", &[8, 45, 46, 7, 19]),
];
#[derive(Clone, Copy, PartialEq, Debug)]