Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
568476ed1f | ||
|
|
6880324e33 | ||
|
|
7b927b0df7 |
No files matched your search
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Otevřené zápasy
|
||||
net.no_rooms = Žádné otevřené zápasy.
|
||||
net.create = Vytvořit zápas
|
||||
net.map_size = Mapa {0}x{1} · {2} hráči
|
||||
net.coop_mission = Kooperativní kampaň: mise {0} ({1})
|
||||
net.coop_create = Kooperace
|
||||
net.coop_editor = Kampaň z editoru
|
||||
|
||||
@@ -723,6 +723,7 @@ net.error = {0}
|
||||
net.rooms = Åbne kampe
|
||||
net.no_rooms = Ingen åbne kampe.
|
||||
net.create = Opret kamp
|
||||
net.map_size = Kort {0}x{1} · {2} spillere
|
||||
net.coop_mission = Co-op-kampagne: mission {0} ({1})
|
||||
net.coop_create = Co-op-kampagne
|
||||
net.coop_editor = Editor-kampagne
|
||||
|
||||
@@ -723,6 +723,7 @@ net.error = {0}
|
||||
net.rooms = Offene Partien
|
||||
net.no_rooms = Keine offenen Partien.
|
||||
net.create = Partie erstellen
|
||||
net.map_size = Karte {0}x{1} · {2} Spieler
|
||||
net.coop_mission = Koop-Kampagne: Mission {0} ({1})
|
||||
net.coop_create = Koop-Kampagne
|
||||
net.coop_editor = Editor-Kampagne
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Ανοιχτές αναμετρήσεις
|
||||
net.no_rooms = Καμία ανοιχτή αναμέτρηση.
|
||||
net.create = Νέα αναμέτρηση
|
||||
net.map_size = Χάρτης {0}x{1} · {2} παίκτες
|
||||
net.coop_mission = Συνεργατική εκστρατεία: αποστολή {0} ({1})
|
||||
net.coop_create = Συνεργατική εκστρ.
|
||||
net.coop_editor = Εκστρατεία επεξεργαστή
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Open matches
|
||||
net.no_rooms = No open matches.
|
||||
net.create = Create match
|
||||
net.map_size = Map {0}x{1} · {2} players
|
||||
net.coop_mission = Co-op campaign: mission {0} ({1})
|
||||
net.coop_create = Co-op campaign
|
||||
net.coop_editor = Editor campaign
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Partidas abiertas
|
||||
net.no_rooms = No hay partidas abiertas.
|
||||
net.create = Crear partida
|
||||
net.map_size = Mapa {0}x{1} · {2} jugadores
|
||||
net.coop_mission = Campaña cooperativa: misión {0} ({1})
|
||||
net.coop_create = Campaña coop.
|
||||
net.join = Unirse
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Avoimet ottelut
|
||||
net.no_rooms = Ei avoimia otteluita.
|
||||
net.create = Luo ottelu
|
||||
net.map_size = Kartta {0}x{1} · {2} pelaajaa
|
||||
net.coop_mission = Yhteiskampanja: tehtävä {0} ({1})
|
||||
net.coop_create = Yhteiskampanja
|
||||
net.coop_editor = Editorikampanja
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Otvorene partije
|
||||
net.no_rooms = Nema otvorenih partija.
|
||||
net.create = Nova partija
|
||||
net.map_size = Karta {0}x{1} · {2} igrača
|
||||
net.coop_mission = Co-op kampanja: misija {0} ({1})
|
||||
net.coop_create = Co-op kampanja
|
||||
net.coop_editor = Kampanja uređivača
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Nyitott meccsek
|
||||
net.no_rooms = Nincsenek nyitott meccsek.
|
||||
net.create = Új meccs
|
||||
net.map_size = Térkép {0}x{1} · {2} játékos
|
||||
net.coop_mission = Kooperatív hadjárat: {0}. küldetés ({1})
|
||||
net.coop_create = Koop hadjárat
|
||||
net.coop_editor = Saját hadjárat
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Partite aperte
|
||||
net.no_rooms = Nessuna partita aperta.
|
||||
net.create = Crea partita
|
||||
net.map_size = Mappa {0}x{1} · {2} giocatori
|
||||
net.coop_mission = Campagna co-op: missione {0} ({1})
|
||||
net.coop_create = Campagna co-op
|
||||
net.join = Entra
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Open partijen
|
||||
net.no_rooms = Geen open partijen.
|
||||
net.create = Partij maken
|
||||
net.map_size = Kaart {0}x{1} · {2} spelers
|
||||
net.coop_mission = Co-op-veldtocht: missie {0} ({1})
|
||||
net.coop_create = Co-op-veldtocht
|
||||
net.coop_editor = Editorveldtocht
|
||||
|
||||
@@ -723,6 +723,7 @@ net.error = {0}
|
||||
net.rooms = Åpne kamper
|
||||
net.no_rooms = Ingen åpne kamper.
|
||||
net.create = Opprett kamp
|
||||
net.map_size = Kart {0}x{1} · {2} spillere
|
||||
net.coop_mission = Co-op-kampanje: oppdrag {0} ({1})
|
||||
net.coop_create = Co-op-kampanje
|
||||
net.coop_editor = Editorkampanje
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Partidas abertas
|
||||
net.no_rooms = Não há partidas abertas.
|
||||
net.create = Criar partida
|
||||
net.map_size = Mapa {0}x{1} · {2} jogadores
|
||||
net.coop_mission = Campanha cooperativa: missão {0} ({1})
|
||||
net.coop_create = Campanha coop.
|
||||
net.coop_editor = Campanha do editor
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Meciuri deschise
|
||||
net.no_rooms = Niciun meci deschis.
|
||||
net.create = Creează meci
|
||||
net.map_size = Hartă {0}x{1} · {2} jucători
|
||||
net.coop_mission = Campanie co-op: misiunea {0} ({1})
|
||||
net.coop_create = Campanie co-op
|
||||
net.coop_editor = Campanie din editor
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Открытые матчи
|
||||
net.no_rooms = Нет открытых матчей.
|
||||
net.create = Создать матч
|
||||
net.map_size = Карта {0}x{1} · {2} игроков
|
||||
net.coop_mission = Кооп-кампания: миссия {0} ({1})
|
||||
net.coop_create = Кооп-кампания
|
||||
net.join = Войти
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Otvorené zápasy
|
||||
net.no_rooms = Žiadne otvorené zápasy.
|
||||
net.create = Vytvoriť zápas
|
||||
net.map_size = Mapa {0}x{1} · {2} hráči
|
||||
net.coop_mission = Kooperatívna kampaň: misia {0} ({1})
|
||||
net.coop_create = Kooperácia
|
||||
net.coop_editor = Kampaň z editora
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Отворене партије
|
||||
net.no_rooms = Нема отворених партија.
|
||||
net.create = Нова партија
|
||||
net.map_size = Мапа {0}x{1} · {2} играча
|
||||
net.coop_mission = Ко-оп кампања: мисија {0} ({1})
|
||||
net.coop_create = Ко-оп кампања
|
||||
net.coop_editor = Кампања уређивача
|
||||
|
||||
@@ -724,6 +724,7 @@ net.error = {0}
|
||||
net.rooms = Öppna matcher
|
||||
net.no_rooms = Inga öppna matcher.
|
||||
net.create = Skapa match
|
||||
net.map_size = Karta {0}x{1} · {2} spelare
|
||||
net.coop_mission = Co-op-kampanj: uppdrag {0} ({1})
|
||||
net.coop_create = Co-op-kampanj
|
||||
net.coop_editor = Egen kampanj
|
||||
|
||||
+47
@@ -1597,6 +1597,8 @@ impl Game {
|
||||
continue;
|
||||
}
|
||||
self.carve_master_area(*side, cores[k]);
|
||||
// every master gets a portal of his own (side 0 has the map's portal)
|
||||
self.add_master_portal(*side, cores[k]);
|
||||
self.add_master(*side, cores[k]);
|
||||
self.switch_to(*side);
|
||||
let (cx, cy) = cores[k];
|
||||
@@ -1610,6 +1612,30 @@ impl Game {
|
||||
true
|
||||
}
|
||||
|
||||
// a master's own portal right beside his starting area (if there is room)
|
||||
pub(crate) fn add_master_portal(&mut self, side: u8, core: (i32, i32)) {
|
||||
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 {
|
||||
return;
|
||||
}
|
||||
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.marked = false;
|
||||
t.reinforced = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if !self.map.portals.contains(&(px, py)) {
|
||||
self.map.portals.push((px, py));
|
||||
}
|
||||
}
|
||||
|
||||
// the starting area of a master: a 9x9 room of his own floor and his 3x3 soul core
|
||||
pub(crate) fn carve_master_area(&mut self, side: u8, core: (i32, i32)) {
|
||||
let owner = Owner::of_side(side);
|
||||
@@ -6831,6 +6857,27 @@ mod tests {
|
||||
assert!(g.ents.iter().filter(|e| e.kind == EK::Chainbreaker).count() <= 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_master_of_a_coop_mission_has_an_own_portal() {
|
||||
let m = crate::campaign::coop_mission_indexes()[2];
|
||||
let mut g = crate::campaign::start_mission(m, None);
|
||||
g.coop = true;
|
||||
assert!(g.start_masters(&[0, 2, 3], 0));
|
||||
for side in [2u8, 3] {
|
||||
let owner = Owner::of_side(side);
|
||||
let core = g.masters.iter().find(|m| m.side == side).unwrap().core;
|
||||
let k = (0..g.map.portals.len()).find(|&k| g.map.portal_owner(k) == owner && g.map.portals[k] == (core.0 + 6, core.1)).expect("a portal of his own");
|
||||
let (px, py) = g.map.portals[k];
|
||||
let from = idx(core.0 + 1, core.1 + 4);
|
||||
assert!(g.map.creature_path(false, from, idx(px, py + 1)).is_some(), "reachable from his dungeon");
|
||||
}
|
||||
for n in crate::lobby::MATCH_SIZES {
|
||||
let seats = crate::lobby::seats_for(n);
|
||||
let mut m = Game::new(3, n, n);
|
||||
assert!(m.start_masters(seats, 0), "a {}x{} match with {} seats", n, n, seats.len());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_coop_ai_seat_fights_beside_the_host_not_against_him() {
|
||||
let mut g = Game::new(11, 96, 128);
|
||||
|
||||
@@ -673,6 +673,17 @@ fn teams_from(sides: &[u8], v: Option<&Value>) -> Vec<(u8, u8)> {
|
||||
sides.iter().copied().zip(teams).collect()
|
||||
}
|
||||
|
||||
// versus map sizes and how many master seats each one has
|
||||
pub const MATCH_SIZES: [usize; 7] = [80, 96, 128, 160, 192, 224, 256];
|
||||
|
||||
pub fn seats_for(size: usize) -> &'static [u8] {
|
||||
match size {
|
||||
0..=80 => &[0, 2],
|
||||
81..=96 => &[0, 2, 3],
|
||||
_ => &[0, 2, 3, 4],
|
||||
}
|
||||
}
|
||||
|
||||
fn seats_from(v: Option<&Value>) -> Vec<SeatInfo> {
|
||||
v.and_then(|x| x.as_array())
|
||||
.map(|arr| {
|
||||
|
||||
+5
-1
@@ -358,7 +358,11 @@ fn account_action(a: MenuAction, cloud: &mut Cloud, menu: &mut Menu, app: &mut A
|
||||
}
|
||||
}
|
||||
MenuAction::MatchJoin(code) => app.client.join(&code),
|
||||
MenuAction::MatchCreate => app.client.create_land(&[0, 2, 3, 4], app.settings.map_w, app.settings.map_h, app.settings.difficulty, app.settings.surface, app.settings.events),
|
||||
MenuAction::MatchCreate => {
|
||||
// the map size decides the number of master seats
|
||||
let n = app.settings.match_size;
|
||||
app.client.create_land(lobby::seats_for(n), n, n, app.settings.difficulty, app.settings.surface, app.settings.events)
|
||||
}
|
||||
MenuAction::MatchCoopCreate(mission) => {
|
||||
let all = campaign::missions();
|
||||
if let Some(d) = all.get(mission) {
|
||||
|
||||
+23
@@ -238,6 +238,7 @@ enum Btn {
|
||||
Tab(usize),
|
||||
Change(usize, i32),
|
||||
MapW(i32),
|
||||
MatchSize(i32),
|
||||
Land,
|
||||
MapH(i32),
|
||||
Difficulty(i32),
|
||||
@@ -437,6 +438,7 @@ pub struct Menu {
|
||||
pub error: Option<String>, // message on the login and account pages
|
||||
pub match_ui: MatchUi, // copied state of the multiplayer relay, shown on the Match page
|
||||
pub coop_mission: usize, // co-op campaign mission selected on the Match page
|
||||
match_size: usize, // the versus map size (from the settings, for drawing)
|
||||
pub coop_editor: bool, // the Match page offers a campaign document instead of the built-in missions
|
||||
pub coop_league: bool, // ... and that document is the co-op campaign "League against the Lightwatch"
|
||||
league_doc: Option<CampaignDoc>, // the co-op campaign, built the first time it is chosen
|
||||
@@ -497,6 +499,7 @@ impl Menu {
|
||||
error: None,
|
||||
match_ui: MatchUi::default(),
|
||||
coop_mission: crate::campaign::coop_mission_indexes().first().copied().unwrap_or(0),
|
||||
match_size: 128,
|
||||
coop_editor: false,
|
||||
coop_league: false,
|
||||
league_doc: None,
|
||||
@@ -682,6 +685,12 @@ impl Menu {
|
||||
MenuAction::Consumed
|
||||
}
|
||||
Some(Btn::Start) => MenuAction::NewGame,
|
||||
Some(Btn::MatchSize(d)) => {
|
||||
let sizes = crate::lobby::MATCH_SIZES;
|
||||
let k = sizes.iter().position(|&s| s >= settings.match_size).unwrap_or(2) as i32;
|
||||
settings.match_size = sizes[(k + d).clamp(0, sizes.len() as i32 - 1) as usize];
|
||||
MenuAction::SettingsChanged
|
||||
}
|
||||
Some(Btn::MapW(d)) => {
|
||||
settings.map_w = (settings.map_w as i32 + d * 32).clamp(MIN_SIZE as i32, MAX_SIZE as i32) as usize;
|
||||
MenuAction::SettingsChanged
|
||||
@@ -953,6 +962,7 @@ impl Menu {
|
||||
self.buttons.clear();
|
||||
self.lang_opts.clear();
|
||||
self.cur_lang = settings.language.clone();
|
||||
self.match_size = settings.match_size;
|
||||
let Some(page) = self.page else {
|
||||
self.lang_open = None;
|
||||
return;
|
||||
@@ -2053,6 +2063,19 @@ impl Menu {
|
||||
}
|
||||
}
|
||||
}
|
||||
// a new versus match: the map size and with it the number of seats
|
||||
if !ui.started && !ui.room_open() {
|
||||
let n = self.match_size;
|
||||
let seats = crate::lobby::seats_for(n).len();
|
||||
let r = Rect::new(ix, yy, 4.0 * CW(), CH() * 2.0);
|
||||
button(gfx, r, "<", r.contains(vec2(mx, my)), FRAME);
|
||||
self.buttons.push((r, Btn::MatchSize(-1)));
|
||||
gfx.text(&trf("net.map_size", &[n.to_string(), n.to_string(), seats.to_string()]), ix + 5.0 * CW(), yy + CH() * 0.5, S(), TXT);
|
||||
let r = Rect::new(ix + 30.0 * CW(), yy, 4.0 * CW(), CH() * 2.0);
|
||||
button(gfx, r, ">", r.contains(vec2(mx, my)), FRAME);
|
||||
self.buttons.push((r, Btn::MatchSize(1)));
|
||||
yy += CH() * 2.4;
|
||||
}
|
||||
self.field(gfx, ix, yy, w, &tr("net.join_hint"), 0, false);
|
||||
self.field(gfx, ix, yy + CH() * 2.4, w, &tr("net.chat"), 1, false);
|
||||
yy += CH() * 4.8;
|
||||
|
||||
+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);
|
||||
}
|
||||
|
||||
@@ -163,6 +163,7 @@ pub struct Settings {
|
||||
pub hints: bool,
|
||||
pub difficulty: u8, // rival masters in free games: 0 easy, 1 medium, 2 hard
|
||||
pub map_w: usize, // size of new maps (64..256)
|
||||
pub match_size: usize, // versus matches: the map is match_size x match_size (see lobby::seats_for)
|
||||
pub map_h: usize,
|
||||
pub surface: bool, // new free games: the eastern half lies above ground (forest)
|
||||
pub events: bool, // random events in free games and versus matches
|
||||
@@ -201,6 +202,7 @@ impl Default for Settings {
|
||||
hints: true,
|
||||
difficulty: 1,
|
||||
map_w: 64,
|
||||
match_size: 128,
|
||||
map_h: 64,
|
||||
surface: false,
|
||||
events: true,
|
||||
|
||||
Reference in new issue
Block a user