Build menu: traps, doors, steel walls and siege engines; new tools unlock by mission
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d4c2260822
commit
0eebf47530
21 files changed
+30
-22
No files matched your search
+1
-1
@@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize};
|
||||
// From which mission (0-based) on each tool is available (same order as ui::TOOLS):
|
||||
// dig, hand, treasury, lair, farm, training, library, sell, flag, lightning, heal, imp,
|
||||
// torture, temple, arrow tower, cannon tower, magic tower, bridge, aerie, steel
|
||||
pub const TOOL_UNLOCK: [usize; 47] = [0, 0, 0, 0, 0, 2, 5, 0, 0, 3, 5, 0, 8, 12, 3, 7, 12, 1, 8, 17, 0, 7, 7, 10, 12, 12, 7, 16, 16, 7, 10, 16, 9, 13, 6, 10, 14, 17, 19, 22, 9, 13, 6, 11, 18, 0, 0];
|
||||
pub const TOOL_UNLOCK: [usize; crate::ui::TOOLS.len()] = [0, 0, 0, 0, 0, 2, 5, 0, 0, 3, 5, 0, 8, 12, 3, 7, 12, 1, 8, 17, 0, 7, 7, 10, 12, 12, 7, 16, 16, 7, 10, 16, 9, 13, 6, 10, 14, 17, 19, 22, 9, 13, 6, 11, 18, 0, 0, 17, 16, 7, 13, 17];
|
||||
|
||||
pub struct FortDef {
|
||||
pub at: (f32, f32), // centre as a fraction of the map size
|
||||
|
||||
@@ -207,6 +207,14 @@ mod tests {
|
||||
assert!(!g.can_research(31), "magic doors are far away");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn siege_engines_are_not_known_in_the_first_missions() {
|
||||
let g = crate::campaign::start_mission(0, None);
|
||||
for t in [19, 47, 48, 50, 51] {
|
||||
assert!(!g.tool_allowed(t), "tool {} known in mission 1", t);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn once_everything_is_known_the_library_raises_room_levels() {
|
||||
let mut g = Game::new(9, 64, 64);
|
||||
|
||||
@@ -446,9 +446,9 @@ pub const CATS: [(&str, &[usize]); 7] = [
|
||||
("cat.hand", &[1]),
|
||||
("cat.rooms", &[2, 3, 4, 5, 6, 12, 40, 13, 18, 21, 41, 42, 43, 44, 17, 47, 49]),
|
||||
("cat.towers", &[14, 15, 16, 20]),
|
||||
("cat.traps", &[22, 23, 24, 25, 26, 27, 28, 29, 30, 31]),
|
||||
("cat.traps", &[22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 19, 50, 51]),
|
||||
("cat.spells", &[9, 10, 11, 32, 33, 34, 35, 36, 37, 38, 39, 48]),
|
||||
("cat.orders", &[8, 45, 46, 7, 19, 50, 51]),
|
||||
("cat.orders", &[8, 45, 46, 7]),
|
||||
];
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||
@@ -1156,7 +1156,7 @@ impl Ui {
|
||||
hover_tool = Some(i);
|
||||
}
|
||||
let key = if touch_ui() { "" } else { keys[i].as_str() };
|
||||
let r = tool_button(bx, by, bw, ti.icon, key, &ti.label, self.tool == TOOLS[i], hovered, !g.tool_allowed(i));
|
||||
let r = tool_button(bx, by, bw, ti.icon, key, &ti.label, self.tool == TOOLS[i], hovered, !g.tool_allowed(i) || (matches!(TOOLS[i], Tool::Siege(_)) && g.forge_tiles() == 0));
|
||||
self.touch_btns.push((r, TBtn::Tool(i)));
|
||||
}
|
||||
popup_top = py0;
|
||||
|
||||
Reference in new issue
Block a user