Private
Public Access
1
0

feat(gameplay): Adding a military power section to exploit population numbers and steal ennemy tiles

This commit is contained in:
gauvainboiche
2026-03-31 18:27:08 +02:00
parent e04560c7f9
commit 570d83c3c0
10 changed files with 587 additions and 9 deletions

View File

@@ -111,3 +111,28 @@ export async function apiFetchActivePlayers() {
if (!res.ok) throw new Error("active_players_fetch_failed");
return res.json();
}
export async function apiFetchMilitaryDeductions() {
const res = await fetch("/api/military-deductions");
if (!res.ok) throw new Error("military_deductions_fetch_failed");
return res.json();
}
export async function apiMilitaryAttack(seed, x, y) {
const token = localStorage.getItem("authToken");
const res = await fetch("/api/military/attack", {
method: "POST",
headers: {
"Content-Type": "application/json",
...(token ? { Authorization: `Bearer ${token}` } : {}),
},
body: JSON.stringify({ seed, x, y }),
});
return res; // caller inspects status
}
export async function apiFetchCellAttackCount(x, y) {
const res = await fetch(`/api/cell/attacks?x=${x}&y=${y}`);
if (!res.ok) throw new Error("cell_attacks_fetch_failed");
return res.json();
}