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

+61 -1
View File
@@ -89,6 +89,8 @@ pub const T_BARK: u32 = 201; // tree trunk
pub const T_LEAVES: u32 = 202; // 2 variants: tree crown
pub const T_GRASS: u32 = 204; // 4 variants: grass above ground
pub const I_WALL: u32 = 208; // wall tool: bricks rising from the floor
pub const I_RAM: u32 = 209; // battering ram tool
pub const I_CATAPULT: u32 = 210; // catapult tool
pub struct Gfx {
pub atlas: Texture2D,
@@ -842,6 +844,36 @@ fn gen_atlas() -> Image {
None
}
});
// siege icons: a ram (a trunk with an iron cap under a roof), a catapult (arm and stone)
cv.cell(I_RAM, |x, y| {
if (3..=12).contains(&x) && y == 4 + (x - 3).min(12 - x).min(3) * 0 && false {
None
} else if y >= 3 && y <= 5 && (x - 7).abs() <= 6 - (y - 3) * 0 && (x + y) % 2 == 0 {
Some(c(92, 58, 32))
} else if (7..=9).contains(&y) && (1..=13).contains(&x) {
Some(if x <= 3 { c(170, 175, 190) } else { c(140, 92, 52) })
} else if y >= 11 && y <= 13 && ((x - 4).abs() <= 1 || (x - 11).abs() <= 1) {
Some(c(30, 24, 26))
} else if y == 10 && (3..=12).contains(&x) {
Some(c(92, 58, 32))
} else {
None
}
});
cv.cell(I_CATAPULT, |x, y| {
let arm = x + y == 14 && (3..=11).contains(&x);
if (x - 12).pow(2) + (y - 3).pow(2) <= 3 {
Some(c(150, 152, 140))
} else if arm {
Some(c(140, 92, 52))
} else if y == 11 && (2..=13).contains(&x) {
Some(c(92, 58, 32))
} else if y >= 12 && ((x - 4).abs() <= 1 || (x - 11).abs() <= 1) {
Some(c(30, 24, 26))
} else {
None
}
});
// frost spell icon: a snowflake
cv.cell(I_FREEZE, |x, y| {
let (dx, dy) = (x - 8, y - 8);
@@ -1519,6 +1551,32 @@ fn sprite_rows(k: EK) -> [&'static str; 10] {
"...y..y...",
"..........",
],
// battering ram: a roofed frame on wheels, an iron-capped trunk
EK::Ram => [
"..........",
"...BBBB...",
"..BbbbbB..",
".BbbbbbbB.",
"SsbbbbbbB.",
"SsBBBBBBB.",
"..b.b.b.b.",
".kBk..kBk.",
".kck..kck.",
"..k....k..",
],
// catapult: a throwing arm with a stone in its cup
EK::Catapult => [
"......cc..",
".....kCCk.",
".....kbk..",
"....kb....",
"...kb.....",
"..kb......",
".BBBBBBBB.",
".bkbbbbkb.",
".kck..kck.",
"..k....k..",
],
// battle mage: robes of the order, a burning staff
EK::BattleMage => [
"....kk...o",
@@ -1601,7 +1659,7 @@ fn pal(ch: char) -> Option<Color> {
})
}
pub const SPRITE_KINDS: [EK; 22] = [
pub const SPRITE_KINDS: [EK; 24] = [
EK::Worker,
EK::Kobold,
EK::Spider,
@@ -1624,6 +1682,8 @@ pub const SPRITE_KINDS: [EK; 22] = [
EK::Giant,
EK::Fairy,
EK::BattleMage,
EK::Ram,
EK::Catapult,
];
// width of the sprite texture in pixels
pub const SPRITE_TEX_W: f32 = (SPRITE_KINDS.len() * 12) as f32;