Script blocks for weather and talent experience, groves as ground; the co-op campaign brings rogues and a storm

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-06 13:29:44 +01:00
1 parent 4e3158cc19
commit eb219f6b01
23 files changed
+233 -8

No files matched your search

+21 -1
View File
@@ -543,7 +543,13 @@ impl BlockEdit {
let r = lay.take(CW() * 10.0);
im.text_field(gfx, fid(path, 6), r, name, 16);
}
Block::Wave { count } | Block::Gold { amount: count } | Block::Mana { amount: count } => self.value(im, gfx, count, Ty::Num, path, 1, lay, ctx),
Block::Wave { count } | Block::Gold { amount: count } | Block::Mana { amount: count } | Block::TalentXp { amount: count } => self.value(im, gfx, count, Ty::Num, path, 1, lay, ctx),
Block::Weather { kind, secs } => {
weather_dd(im, gfx, kind, fid(path, 2), lay);
lay.word(gfx, &tr("blk.w_for"));
self.value(im, gfx, secs, Ty::Num, path, 1, lay, ctx);
lay.word(gfx, &tr("blk.w_seconds"));
}
Block::SetVar { name, value } | Block::AddVar { name, value } => {
let r = lay.take(CW() * 12.0);
im.text_field(gfx, fid(path, 0), r, name, 24);
@@ -713,10 +719,24 @@ impl BlockEdit {
lay.word(gfx, &tr("blk.v.eventkind"));
self.kind_dd(im, gfx, kind, false, path, sub(0), lay);
}
Val::WeatherIs { kind } => {
lay.word(gfx, &tr("blk.v.weatheris"));
weather_dd(im, gfx, kind, fid(path, sub(0)), lay);
}
}
}
}
// a dropdown with the kinds of weather
fn weather_dd(im: &mut Im, gfx: &Gfx, kind: &mut String, id: u64, lay: &mut Lay) {
let opts: Vec<String> = WEATHER.iter().map(|w| tr(&format!("weather.{}", w))).collect();
let cur = tr(&format!("weather.{}", kind));
let r = lay.take(CW() * 12.0);
if let Some(c) = im.dropdown(gfx, id, r, &cur, &opts) {
*kind = WEATHER[c].to_string();
}
}
// where the next field of a block goes: left to right, into a new row at the block's edge
struct Lay {
x: f32,
+34
View File
@@ -143,6 +143,40 @@ pub fn coop_campaign() -> CampaignDoc {
],
});
}
// the rogues of the Order in the later missions: thieves from mission 7, an inquisitor
// from mission 15; the last mission (above ground) brews a storm
let lv = n((1 + i / 3) as f64);
if i >= 6 {
sc.triggers.push(TriggerDoc {
name: "thieves".into(),
kind: TriggerKind::Timer { secs: 420.0, every: false },
once: true,
enabled: true,
script: vec![Block::Message { text: tr("coop.raid") }, Block::Spawn { side: 1, kind: "Thief".into(), count: n(2.0), level: lv.clone(), place: Place::Zone(ZONES[i % 3].0.into()), name: String::new() }],
});
}
if i >= 14 {
sc.triggers.push(TriggerDoc {
name: "inquisitor".into(),
kind: TriggerKind::Timer { secs: 600.0, every: false },
once: true,
enabled: true,
script: vec![
Block::Message { text: tr("coop.raid") },
Block::Spawn { side: 1, kind: "Inquisitor".into(), count: n(1.0), level: lv.clone(), place: Place::Zone(ZONES[(i + 1) % 3].0.into()), name: String::new() },
Block::Spawn { side: 1, kind: "Monk".into(), count: n(2.0), level: lv.clone(), place: Place::Zone(ZONES[(i + 1) % 3].0.into()), name: String::new() },
],
});
}
if i + 1 == specs.len() {
sc.triggers.push(TriggerDoc {
name: "storm".into(),
kind: TriggerKind::Timer { secs: 480.0, every: false },
once: true,
enabled: true,
script: vec![Block::Weather { kind: "storm".into(), secs: n(120.0) }],
});
}
if let Some((kind, level, name, zone)) = sp.boss {
sc.start.push(Block::Spawn { side: 1, kind: kind.into(), count: n(1.0), level: n(level as f64), place: Place::Zone(ZONES[zone].0.into()), name: name.into() });
// the boss falls: the mission is won once the goals (if any) are done too