Research in the library: rooms, spells, towers, traps and doors are discovered in a fixed order

- studying creatures collect research points (mages and owls best, higher levels faster); studying gives less mana than before
- free play starts with the basics; campaign missions know what their story allows and can research what the next four missions would bring
- research shown in the top bar; the library's info lists the current item and what comes next; locked tools say whether they can be researched

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:00:33 +01:00
1 parent 4f20223c93
commit a54316c86e
8 files changed
+210 -3

No files matched your search

+22 -1
View File
@@ -462,6 +462,12 @@ pub struct Game {
pub rollers: Vec<crate::traps::Roller>,
#[serde(default)]
pub clouds: Vec<crate::traps::Cloud>,
#[serde(default)]
pub known: Vec<bool>, // tools known (ui::TOOLS order; empty = old savegame: everything)
#[serde(default)]
pub researchable: Vec<bool>, // tools that can be researched in the library
#[serde(default)]
pub research: f32, // research points towards the current item
#[serde(skip)]
pub forge_work: f32, // work done in the forge this frame
#[serde(skip)]
@@ -555,6 +561,7 @@ impl Game {
g.wave_timer = FIRST_WAVE + ((dist - 45.0) * 1.5).clamp(0.0, 300.0);
g.guard_treasures();
g.place_dwarf_caves(seed);
g.init_research(None);
g.msg("msg.welcome1", vec![]);
g.msg("msg.welcome2", vec![]);
g.msg("msg.welcome3", vec![]);
@@ -631,6 +638,9 @@ impl Game {
rollers: Vec::new(),
clouds: Vec::new(),
forge_work: 0.0,
known: Vec::new(),
researchable: Vec::new(),
research: 0.0,
parts: Vec::new(),
stuck: Vec::new(),
vrng: crate::particles::vrng(),
@@ -678,6 +688,9 @@ impl Game {
}
pub fn tool_allowed(&self, tool: usize) -> bool {
if !self.known.is_empty() {
return self.known(tool);
}
self.mission.as_ref().map_or(true, |m| m.tools.get(tool).copied().unwrap_or(true))
}
@@ -1069,6 +1082,7 @@ impl Game {
self.update_units(dt);
self.update_towers(dt);
self.update_forge(dt);
self.update_research();
if !self.rivals.is_empty() {
self.update_rivals(dt);
}
@@ -3063,7 +3077,14 @@ impl Game {
}
e.working = true;
let rate = if e.kind == EK::Mage { 1.2 } else { 0.5 };
self.mana = (self.mana + rate * dt).min(self.mana_max());
self.mana = (self.mana + rate * 0.5 * dt).min(self.mana_max());
// research: mages and owls are the scholars
let points = match e.kind {
EK::Mage => 1.6,
EK::Owl => 1.3,
_ => 0.5,
} * (1.0 + 0.12 * (e.level - 1) as f32);
self.add_research(points * dt);
e.xp += 3.0 * dt;
e.timer -= dt;
if e.timer <= 0.0 {