Every master of a match gets an own portal beside the dungeon
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aeaa1eba36
commit
7b927b0df7
2 files changed
+48
-19
No files matched your search
+1
-19
@@ -97,25 +97,7 @@ impl Game {
|
||||
pub fn add_rival(&mut self, side: u8, cx: i32, cy: i32, difficulty: u8) {
|
||||
let core = (cx - 1, cy - 1);
|
||||
self.carve_master_area(side, core);
|
||||
// his own portal beside the dungeon (if there is room)
|
||||
let owner = Owner::of_side(side);
|
||||
let (px, py) = (core.0 + 6, core.1);
|
||||
if px + 3 < mw() as i32 - 2 && py >= 2 && py + 3 < mh() as i32 - 2 {
|
||||
for y in py..py + 3 {
|
||||
for x in px..px + 3 {
|
||||
let t = &mut self.map.t[idx(x, y)];
|
||||
if !matches!(t.kind, Kind::Core | Kind::Gate) {
|
||||
t.kind = Kind::Portal;
|
||||
t.owner = owner;
|
||||
t.gold = 0;
|
||||
t.reinforced = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if !self.map.portals.contains(&(px, py)) {
|
||||
self.map.portals.push((px, py));
|
||||
}
|
||||
}
|
||||
self.add_master_portal(side, core);
|
||||
self.rivals.push(Rival { side, core, hp: RIVAL_CORE_HP, alive: true, radius: 5, grow_t: 20.0, spawn_t: 5.0, attack_t: 0.0, difficulty, power: 0.0, gift_t: PARTNER_GIFT_EVERY, think_t: 2.0, attacking: false, army0: 0.0 });
|
||||
self.adopt_master(side, core, difficulty, true);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user