Browse Source

fix bug where collected cards are not initialized as part of the deck

main
Stephanie Gredell 4 months ago
parent
commit
b07309fe8d
  1. 7
      src/engine/battle.js
  2. 518
      style.css

7
src/engine/battle.js

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
import { ENEMIES } from "../data/enemies.js";
import { RELICS } from "../data/relics.js";
import { CARDS } from "../data/cards.js";
import { draw, endTurnDiscard, clamp, cloneCard } from "./core.js";
import { draw, endTurnDiscard, clamp, cloneCard, shuffle } from "./core.js";
export function createBattle(ctx, enemyId) {
const enemyData = ENEMIES[enemyId];
@ -10,6 +10,11 @@ export function createBattle(ctx, enemyId) { @@ -10,6 +10,11 @@ export function createBattle(ctx, enemyId) {
ctx.flags = {};
ctx.lastCard = null;
// Initialize draw pile from current deck for the battle
ctx.player.draw = shuffle(ctx.player.deck.slice());
ctx.player.discard = [];
ctx.player.hand = [];
const relicCtx = {
...ctx,

518
style.css

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save