Multiplayer step B: every player order is a command (dig, build, cast, hand, orders) and the simulation runs in fixed 50 ms steps, so single player and a match take the same path
This commit is contained in:
1 parent
d6bcce3a76
commit
1ec7492189
8 files changed
+635
-101
No files matched your search
+3
-3
@@ -36,7 +36,7 @@ impl Game {
|
||||
// ---- prison
|
||||
pub(crate) fn free_cell(&self, i: usize) -> bool {
|
||||
let t = &self.map.t[i];
|
||||
matches!(t.kind, Kind::Torture | Kind::Prison) && t.owner == Owner::Player && t.bed == 0
|
||||
matches!(t.kind, Kind::Torture | Kind::Prison) && t.owner == self.me && t.bed == 0
|
||||
}
|
||||
|
||||
// ---- graveyard: a fallen unit is buried in a free grave
|
||||
@@ -50,7 +50,7 @@ impl Game {
|
||||
.t
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(i, t)| t.kind == Kind::Graveyard && t.owner == Owner::Player && !taken.contains(i))
|
||||
.filter(|(i, t)| t.kind == Kind::Graveyard && t.owner == self.me && !taken.contains(i))
|
||||
.min_by_key(|(i, _)| {
|
||||
let (tx, ty) = xy(*i);
|
||||
((tx as f32 - x).powi(2) + (ty as f32 - y).powi(2)) as i32
|
||||
@@ -96,7 +96,7 @@ impl Game {
|
||||
// ---- guard post: a free post for a creature
|
||||
pub(crate) fn free_post(&self, i: usize, me: u32) -> bool {
|
||||
let t = &self.map.t[i];
|
||||
t.kind == Kind::GuardPost && t.owner == Owner::Player && (t.reserved == 0 || t.reserved == me)
|
||||
t.kind == Kind::GuardPost && t.owner == self.me && (t.reserved == 0 || t.reserved == me)
|
||||
}
|
||||
|
||||
// ---- arena: sparring with a partner nearby; fast experience, some bruises
|
||||
|
||||
Reference in new issue
Block a user