diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 2c8c3aa..87852d8 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -83,10 +83,19 @@ export class SoSActorSheet extends ActorSheet { const skill = this.actor.getOwnedItem(li.data("item-id")); this.actor.rollSkill(skill); }); - html.find('.edge-draw').click((event) => { + html.find('.reset-deck-full').click((event) => { + this.actor.resetDeckFull(); + this.render(true); + }); + html.find('.draw-new-edge').click((event) => { + this.actor.drawNewEdge(); + this.render(true); + }); + html.find('.reset-deck').click((event) => { this.actor.resetDeck(); this.render(true); }); + html.find('.lock-unlock-sheet').click((event) => { this.options.editStatSkill = !this.options.editStatSkill; this.render(true); diff --git a/module/actor.js b/module/actor.js index 3dcb2ae..fc4a386 100644 --- a/module/actor.js +++ b/module/actor.js @@ -68,11 +68,20 @@ export class SoSActor extends Actor { return edgesCard; } /* -------------------------------------------- */ - resetDeck( ) { + resetDeckFull( ) { this.cardDeck.shuffleDeck(); this.cardDeck.drawEdge( this.data.data.scores.edge.value ); this.saveDeck(); } + /* -------------------------------------------- */ + drawNewEdge( ) { + this.cardDeck.drawEdge( 1 ); + this.saveDeck(); + } + /* -------------------------------------------- */ + resetDeck() { + + } /* -------------------------------------------- */ saveDeck( ) { diff --git a/module/sos-card-deck.js b/module/sos-card-deck.js index 1665797..8a6f591 100644 --- a/module/sos-card-deck.js +++ b/module/sos-card-deck.js @@ -56,7 +56,27 @@ export class SoSCardDeck { } /* -------------------------------------------- */ - drawEdge( edgeNumber ) { + resetDeck() { + let newdeck = duplicate(this.data.deck).concat( duplicate (this.data.discard)); + this.data.discard = []; // Reinit discard pile + this.data.deck = []; + let decklen = newdeck.len; + let cardState = []; + for (let i = 0; i