Traders come through the portal and sell rune plans, rare creatures, wood and mana
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
74837f1c34
commit
4c9fbe47e4
24 files changed
+406
-3
No files matched your search
+12
-1
@@ -130,6 +130,7 @@ pub enum EK {
|
||||
// wild beasts of the caverns (beasts.rs): neutral until tamed
|
||||
CaveBear, // strong and shaggy, likes the mushroom garden
|
||||
Beetle, // a giant armoured beetle, likes the lair
|
||||
Trader, // a merchant visiting through the portal (traders.rs)
|
||||
}
|
||||
|
||||
pub struct St {
|
||||
@@ -176,6 +177,7 @@ pub fn st(k: EK) -> St {
|
||||
EK::Catapult => s("unit.catapult", 320.0, 40.0, 7.5, 0.9, 3.5, 0, 200),
|
||||
EK::CaveBear => s("unit.cavebear", 420.0, 24.0, 1.0, 1.9, 1.4, 110, 0),
|
||||
EK::Beetle => s("unit.beetle", 300.0, 13.0, 1.0, 1.7, 1.1, 70, 0),
|
||||
EK::Trader => s("unit.trader", 200.0, 1.0, 1.0, 1.5, 2.0, 0, 0),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +393,7 @@ impl Ent {
|
||||
}
|
||||
// the player's creatures (not imps, heroes or the rivals' units)
|
||||
pub fn creature(&self) -> bool {
|
||||
!self.hero && self.side == me_side() && self.kind != EK::Worker && !self.chained
|
||||
!self.hero && self.side == me_side() && self.kind != EK::Worker && self.kind != EK::Trader && !self.chained
|
||||
}
|
||||
// 0 player, 1 humans, 2 and 3 rival masters
|
||||
pub fn side(&self) -> u8 {
|
||||
@@ -609,6 +611,8 @@ pub struct Game {
|
||||
#[serde(default)]
|
||||
pub bridgework: crate::bridges::BridgeWork, // burning and worn bridges
|
||||
#[serde(default)]
|
||||
pub trading: crate::traders::Trading, // the visiting trader (traders.rs)
|
||||
#[serde(default)]
|
||||
pub happenings: Option<crate::events::Events>, // random events (free games and versus), see events.rs
|
||||
#[serde(default)]
|
||||
pub stats: crate::stats::GameStats, // statistics of the master at this computer (see stats.rs)
|
||||
@@ -950,6 +954,7 @@ impl Game {
|
||||
vrng: crate::particles::vrng(),
|
||||
dwarf_caves: Vec::new(),
|
||||
bridgework: Default::default(),
|
||||
trading: Default::default(),
|
||||
happenings: None,
|
||||
stats: Default::default(),
|
||||
wall_plans: Vec::new(),
|
||||
@@ -1724,6 +1729,7 @@ impl Game {
|
||||
self.update_bridges(dt);
|
||||
self.update_wood(dt);
|
||||
self.update_events(dt);
|
||||
self.update_traders(dt);
|
||||
// fallen hearts of a match are shared state: every client marks them in the same step
|
||||
self.update_fallen_masters();
|
||||
// the end of the game and the fog are about the master at this computer
|
||||
@@ -2400,6 +2406,8 @@ impl Game {
|
||||
self.captive_update(e, dt);
|
||||
} else if self.is_rival_side(e.side) || (e.rival() && !self.is_master(e.side)) {
|
||||
self.rival_ai(e, dt);
|
||||
} else if e.kind == EK::Trader {
|
||||
self.trader_ai(e, dt);
|
||||
} else if e.dwarf() {
|
||||
self.dwarf_ai(e, dt);
|
||||
} else if e.hero {
|
||||
@@ -5412,6 +5420,9 @@ impl Game {
|
||||
return false;
|
||||
}
|
||||
let Some(j) = target.filter(|&j| j < self.ents.len() && self.ents[j].alive && !self.ents[j].held) else { return false };
|
||||
if self.buy_from_trader(j) {
|
||||
return false;
|
||||
}
|
||||
let e = &self.ents[j];
|
||||
if e.rival() || e.dwarf() {
|
||||
return false; // the rivals' creatures and the dwarves cannot be picked up
|
||||
|
||||
Reference in new issue
Block a user