Apply biome formatting to main module
This commit is contained in:
parent
8a7facb35e
commit
aa9412dc61
1 changed files with 22 additions and 20 deletions
42
src/main.js
42
src/main.js
|
|
@ -1,7 +1,7 @@
|
|||
import { getCard } from "./cards.js";
|
||||
import { checkCombatEnd, resolveEnemyTurn, startTurn } from "./combat.js";
|
||||
import { createCombatState, endTurn, playCard } from "./state.js";
|
||||
import { render } from "./render.js";
|
||||
import { createCombatState, endTurn, playCard } from "./state.js";
|
||||
|
||||
let state = null;
|
||||
|
||||
|
|
@ -79,28 +79,30 @@ function bindEvents() {
|
|||
render(state);
|
||||
});
|
||||
|
||||
document.getElementById("end-turn-btn").addEventListener("click", async () => {
|
||||
if (state.combat.phase !== "player_turn") return;
|
||||
document
|
||||
.getElementById("end-turn-btn")
|
||||
.addEventListener("click", async () => {
|
||||
if (state.combat.phase !== "player_turn") return;
|
||||
|
||||
state = endTurn(state);
|
||||
render(state);
|
||||
|
||||
await delay(800);
|
||||
state = resolveEnemyTurn(state);
|
||||
|
||||
const end = checkCombatEnd(state);
|
||||
if (end) {
|
||||
state = {
|
||||
...state,
|
||||
combat: { ...state.combat, phase: "ended", result: end },
|
||||
};
|
||||
state = endTurn(state);
|
||||
render(state);
|
||||
return;
|
||||
}
|
||||
|
||||
state = startTurn(state);
|
||||
render(state);
|
||||
});
|
||||
await delay(800);
|
||||
state = resolveEnemyTurn(state);
|
||||
|
||||
const end = checkCombatEnd(state);
|
||||
if (end) {
|
||||
state = {
|
||||
...state,
|
||||
combat: { ...state.combat, phase: "ended", result: end },
|
||||
};
|
||||
render(state);
|
||||
return;
|
||||
}
|
||||
|
||||
state = startTurn(state);
|
||||
render(state);
|
||||
});
|
||||
}
|
||||
|
||||
function delay(ms) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue