Mushroom groves: unclaimable moss where giant mushrooms grow slowly and glow when ready to fell
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
368a338ccf
commit
f8eda88bb3
26 files changed
+321
-43
No files matched your search
+17
-3
@@ -70,10 +70,14 @@ pub enum Kind {
|
||||
Altar, // room: sacrifices
|
||||
Drawbridge, // bridge that can be raised (res: see DB_RAISED, DB_AUTO, DB_LAVA)
|
||||
Obsidian, // lava cooled by frost: walkable until it melts again
|
||||
Mushroom, // giant mushroom on open ground: imps fell it for wood (grows back)
|
||||
Mushroom, // giant mushroom: imps fell it for wood once it is grown (food: growth left, 0 = grown; res: MUSH_GROVE)
|
||||
Tree, // tree above ground: imps fell it for wood
|
||||
Grove, // mushroom grove: mossy ground nobody can claim, giant mushrooms grow (back) here
|
||||
}
|
||||
|
||||
// a giant mushroom of a grove: when felled, the ground turns back into grove (Tile::res)
|
||||
pub const MUSH_GROVE: u8 = 1;
|
||||
|
||||
// drawbridge state in Tile::res
|
||||
pub const DB_RAISED: u8 = 1; // raised: nobody can cross
|
||||
pub const DB_AUTO: u8 = 2; // rises by itself when enemies come near
|
||||
@@ -105,7 +109,7 @@ pub struct River {
|
||||
}
|
||||
|
||||
// order matters for the packed savegame codec: only append new kinds
|
||||
const KINDS: [Kind; 38] = [
|
||||
const KINDS: [Kind; 39] = [
|
||||
Kind::Rock,
|
||||
Kind::Earth,
|
||||
Kind::Gold,
|
||||
@@ -144,6 +148,7 @@ const KINDS: [Kind; 38] = [
|
||||
Kind::Obsidian,
|
||||
Kind::Mushroom,
|
||||
Kind::Tree,
|
||||
Kind::Grove,
|
||||
];
|
||||
|
||||
// treasures (veins, treasury content, imp loads): 0 gold, 1 silver, 2 ruby, 3 diamond
|
||||
@@ -229,7 +234,15 @@ impl Tile {
|
||||
matches!(self.kind, Kind::Rock | Kind::Earth | Kind::Gold | Kind::Silver | Kind::Ruby | Kind::Diamond | Kind::Steel)
|
||||
}
|
||||
pub fn diggable(&self) -> bool {
|
||||
matches!(self.kind, Kind::Earth | Kind::Gold | Kind::Silver | Kind::Ruby | Kind::Diamond | Kind::Steel | Kind::Mushroom | Kind::Tree)
|
||||
matches!(self.kind, Kind::Earth | Kind::Gold | Kind::Silver | Kind::Ruby | Kind::Diamond | Kind::Steel | Kind::Tree) || (self.kind == Kind::Mushroom && self.grown())
|
||||
}
|
||||
// a giant mushroom is felled only when it is fully grown (everything else counts as grown)
|
||||
pub fn grown(&self) -> bool {
|
||||
self.kind != Kind::Mushroom || self.food <= 0.0
|
||||
}
|
||||
// how far a giant mushroom has grown: 0 a sprout .. 1 fully grown
|
||||
pub fn growth(&self) -> f32 {
|
||||
if self.kind == Kind::Mushroom { (1.0 - self.food).clamp(0.0, 1.0) } else { 1.0 }
|
||||
}
|
||||
// a giant mushroom or a tree: felled like a wall is dug, gives wood
|
||||
pub fn plant(&self) -> bool {
|
||||
@@ -272,6 +285,7 @@ impl Tile {
|
||||
| Kind::Arena
|
||||
| Kind::Altar
|
||||
| Kind::Obsidian
|
||||
| Kind::Grove
|
||||
) || (self.kind == Kind::Drawbridge && self.res & DB_RAISED == 0)
|
||||
}
|
||||
// river tiles (open, but nobody can walk there)
|
||||
|
||||
Reference in new issue
Block a user