Add consequenes to actor sheet
This commit is contained in:
parent
1d2f438235
commit
147ab741de
@ -83,10 +83,19 @@ export class SoSActorSheet extends ActorSheet {
|
|||||||
const skill = this.actor.getOwnedItem(li.data("item-id"));
|
const skill = this.actor.getOwnedItem(li.data("item-id"));
|
||||||
this.actor.rollSkill(skill);
|
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.actor.resetDeck();
|
||||||
this.render(true);
|
this.render(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
html.find('.lock-unlock-sheet').click((event) => {
|
html.find('.lock-unlock-sheet').click((event) => {
|
||||||
this.options.editStatSkill = !this.options.editStatSkill;
|
this.options.editStatSkill = !this.options.editStatSkill;
|
||||||
this.render(true);
|
this.render(true);
|
||||||
|
@ -68,11 +68,20 @@ export class SoSActor extends Actor {
|
|||||||
return edgesCard;
|
return edgesCard;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
resetDeck( ) {
|
resetDeckFull( ) {
|
||||||
this.cardDeck.shuffleDeck();
|
this.cardDeck.shuffleDeck();
|
||||||
this.cardDeck.drawEdge( this.data.data.scores.edge.value );
|
this.cardDeck.drawEdge( this.data.data.scores.edge.value );
|
||||||
this.saveDeck();
|
this.saveDeck();
|
||||||
}
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
drawNewEdge( ) {
|
||||||
|
this.cardDeck.drawEdge( 1 );
|
||||||
|
this.saveDeck();
|
||||||
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
resetDeck() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
saveDeck( ) {
|
saveDeck( ) {
|
||||||
|
@ -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 <decklen; i++) {
|
||||||
|
cardState[i] = false;
|
||||||
|
}
|
||||||
|
// Randomize deck
|
||||||
|
while (this.data.deck.length != decklen) {
|
||||||
|
let idx = new Roll("1d"+decklen).roll().total;
|
||||||
|
if (!cardState[idx - 1]) {
|
||||||
|
this.data.deck.push( newdeck[idx-1] );
|
||||||
|
}
|
||||||
|
cardState[idx - 1] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
drawEdge( edgeNumber = 1 ) {
|
||||||
for (let i=0; i<edgeNumber; i++) {
|
for (let i=0; i<edgeNumber; i++) {
|
||||||
this.data.cardEdge.push( this.data.deck.pop() );
|
this.data.cardEdge.push( this.data.deck.pop() );
|
||||||
console.log("DRAW EDGE", this.data.cardEdge);
|
console.log("DRAW EDGE", this.data.cardEdge);
|
||||||
|
Loading…
Reference in New Issue
Block a user