Manage GM cards

This commit is contained in:
2021-03-08 22:46:33 +01:00
parent 10fbcec5fb
commit c2c837b778
10 changed files with 193 additions and 25 deletions

View File

@@ -54,8 +54,12 @@ export class SoSActor extends Actor {
super.prepareData();
if ( !this.cardDeck ) {
this.cardDeck = new SoSCardDeck();
this.cardDeck.initCardDeck( this, this.data.data.internals.deck );
if ( this.hasPlayerOwner) {
this.cardDeck = new SoSCardDeck();
this.cardDeck.initCardDeck( this, this.data.data.internals.deck );
} else {
this.cardDeck = game.system.sos.gmDeck;
}
}
this.controlScores();
}
@@ -100,10 +104,14 @@ export class SoSActor extends Actor {
/* -------------------------------------------- */
saveDeck( ) {
let deck = { deck: duplicate(this.cardDeck.data.deck),
discard: duplicate(this.cardDeck.data.discard),
cardEdge: duplicate(this.cardDeck.data.cardEdge)
}
this.update( { 'data.internals.deck': deck });
discard: duplicate(this.cardDeck.data.discard),
cardEdge: duplicate(this.cardDeck.data.cardEdge)
}
if ( this.hasPlayerOwner ) {
this.update( { 'data.internals.deck': deck });
} else {
game.settings.set("foundryvtt-shadows-over-sol", "gmDeck", deck );
}
}
/* -------------------------------------------- */