Fix reset deck in Foundry v9 #9
This commit is contained in:
parent
ae2d926324
commit
633525a9e5
@ -378,7 +378,7 @@ export class SoSActor extends Actor {
|
||||
async addObjectToContainer( itemId, containerId ) {
|
||||
let container = this.data.items.find( item => item.id == containerId && item.type == 'container')
|
||||
let object = this.data.items.find( item => item.id == itemId )
|
||||
//console.log("Found", container, object)
|
||||
console.log("Found", container, object)
|
||||
if ( container ) {
|
||||
if ( object.type == 'container') {
|
||||
ui.notifications.warn("Only 1 level of container... sorry");
|
||||
|
@ -58,21 +58,22 @@ export class SoSCardDeck {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
resetDeck() {
|
||||
let newdeck = duplicate(this.data.deck).concat( duplicate (this.data.discard));
|
||||
this.data.discard = []; // Reinit discard pile
|
||||
this.data.deck = [];
|
||||
let decklen = newdeck.length;
|
||||
let cardState = [];
|
||||
let newdeck = duplicate(this.data.deck).concat( duplicate (this.data.discard) )
|
||||
this.data.discard = [] // Reinit discard pile
|
||||
this.data.deck = []
|
||||
let decklen = newdeck.length
|
||||
let cardState = []
|
||||
for (let i = 0; i <decklen; i++) {
|
||||
cardState[i] = false;
|
||||
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;
|
||||
let idx = new Roll("1d"+decklen).roll({async : false}).total
|
||||
//console.log("Deck stuff", this.data.deck.length, decklen, idx)
|
||||
if (!cardState[idx-1]) {
|
||||
this.data.deck.push( newdeck[idx-1] )
|
||||
}
|
||||
cardState[idx-1] = true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
"url": "https://gitlab.com/LeRatierBretonnien/foundryvtt-shadows-over-sol/",
|
||||
"license": "LICENSE.txt",
|
||||
"flags": {},
|
||||
"version": "2.0.4",
|
||||
"version": "2.0.5",
|
||||
"minimumCoreVersion": "0.8.0",
|
||||
"compatibleCoreVersion": "9",
|
||||
"scripts": [],
|
||||
|
Loading…
Reference in New Issue
Block a user