Master talents: experience, points and four branches (Builder, Warlord, Warlock, Merchant) with a toolbar window

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-06 11:35:11 +01:00
1 parent b93bcd89c4
commit bd956a4f57
28 files changed
+720 -22

No files matched your search

+6 -2
View File
@@ -84,6 +84,8 @@ pub struct Carry {
pub rune_free: u32, // unbuilt rune forge towers from chests
#[serde(default)]
pub rune_final: u32, // unbuilt or sold rune forge towers that were already given back once
#[serde(default)]
pub talents: crate::talents::Talents, // the master's talents go along from mission to mission
}
pub const CARRY_CREATURES: usize = 5;
@@ -580,6 +582,7 @@ fn start_mission_def(d: &MissionDef, i: usize, carry: Option<&Carry>, coop: bool
g.gold += c.gold;
g.rune_free += c.rune_free;
g.rune_final += c.rune_final;
g.talents = c.talents.clone();
}
for (k, &(kind, level, xp)) in joiners.iter().enumerate() {
let a = k as f32 * 0.9;
@@ -796,7 +799,7 @@ pub fn carry_from(g: &Game) -> Carry {
let mut c: Vec<&Ent> = g.ents.iter().filter(|e| e.alive && e.creature()).collect();
let power = |e: &Ent| e.max_hp * e.atk() / st(e.kind).interval;
c.sort_by(|a, b| power(b).partial_cmp(&power(a)).unwrap_or(std::cmp::Ordering::Equal));
Carry { creatures: c.iter().take(CARRY_CREATURES).map(|e| (e.kind, e.level, e.xp)).collect(), gold: (g.gold * CARRY_GOLD).floor(), rune_free: g.rune_free, rune_final: g.rune_final + g.rune_next }
Carry { creatures: c.iter().take(CARRY_CREATURES).map(|e| (e.kind, e.level, e.xp)).collect(), gold: (g.gold * CARRY_GOLD).floor(), rune_free: g.rune_free, rune_final: g.rune_final + g.rune_next, talents: g.talents.clone() }
}
// a co-op match of an editor campaign: what every master takes into the next mission - his
@@ -810,7 +813,7 @@ pub fn coop_carry_from(g: &Game) -> Vec<(u8, Carry)> {
let mut c: Vec<&Ent> = g.ents.iter().filter(|e| e.alive && !e.hero && e.side == side && e.kind != EK::Worker && !e.chained && e.captive == 0).collect();
c.sort_by(|a, b| power(b).partial_cmp(&power(a)).unwrap_or(std::cmp::Ordering::Equal).then(a.id.cmp(&b.id)));
let creatures = c.iter().take(CARRY_CREATURES).map(|e| (e.kind, e.level, e.xp)).collect();
(side, Carry { creatures, gold: (g.gold_of(side).max(0.0) * CARRY_GOLD).floor(), rune_free: 0, rune_final: 0 })
(side, Carry { creatures, gold: (g.gold_of(side).max(0.0) * CARRY_GOLD).floor(), rune_free: 0, rune_final: 0, talents: g.talents_of(side) })
})
.collect()
}
@@ -824,6 +827,7 @@ pub fn apply_coop_carry(g: &mut Game, carry: &[(u8, Carry)]) {
}
g.switch_to(*side);
g.gold += c.gold.max(0.0);
g.talents = c.talents.clone();
let (cx, cy) = g.map.core;
for (k, &(kind, level, xp)) in c.creatures.iter().take(CARRY_CREATURES).enumerate() {
let a = k as f32 * 1.1;