Enhance fip
This commit is contained in:
parent
05a2b02482
commit
b22b8022f1
@ -161,6 +161,7 @@ export class SoSActor extends Actor {
|
||||
modifierList: SoSUtility.fillRange(-10, +10),
|
||||
tnList: SoSUtility.fillRange(6, 20)
|
||||
}
|
||||
flipData.statList['nostat'] = { label: "No stat (ie defaulting skills)", value: 0, cardsuit: "none" }
|
||||
let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/dialog-flip.html', flipData);
|
||||
new SoSFlipDialog(flipData, html).render(true);
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ export class SoSCardDeck {
|
||||
/* -------------------------------------------- */
|
||||
getCardValue( cardName ) {
|
||||
console.log(cardName);
|
||||
if (cardName[0] == 'j' ) return 0; // Joker case
|
||||
let parsed = cardName.match( /\w(\d\d)/i );
|
||||
let value = Number( parsed[1] );
|
||||
if ( value > 10 ) value -= 10;
|
||||
@ -104,11 +105,24 @@ export class SoSCardDeck {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
isCardFace(cardName) {
|
||||
if (cardName[0] == 'j' ) return false; // Joker case
|
||||
let parsed = cardName.match( /\w(\d\d)/i );
|
||||
let value = Number( parsed[1] );
|
||||
return (value > 10) ? true : false;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
setJoker( flipData ) {
|
||||
console.log("THIS IS A JOKER !!!!");
|
||||
flipData.cardSlot[0].total = 0;
|
||||
flipData.cardSlot[0].card1Path = `systems/foundryvtt-shadows-over-sol/img/cards/${flipData.cardSlot[0].card1.cardName}.webp`;
|
||||
flipData.isJoker = true;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
isJoker( cardName) {
|
||||
return cardName[0] == 'j';
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async doFlipFromDeckOrEdge( flipData ) {
|
||||
flipData.cardSlot = [ { total: 0}];
|
||||
@ -125,10 +139,7 @@ export class SoSCardDeck {
|
||||
|
||||
let cardsuit = this.getCardSuit(flipData.cardSlot[0].card1.cardName);
|
||||
if ( cardsuit == 'joker' ) {
|
||||
console.log("THIS IS A JOKER !!!!");
|
||||
flipData.cardSlot[0].total = 0;
|
||||
flipData.cardSlot[0].isJoker = true;
|
||||
flipData.cardSlot[0].card1Path = `systems/foundryvtt-shadows-over-sol/img/cards/${flipData.cardSlot[0].card1.cardName}.webp`;
|
||||
this.setJoker( flipData );
|
||||
} else {
|
||||
|
||||
console.log("First card : ", flipData.cardSlot[0].card1);
|
||||
@ -139,6 +150,7 @@ export class SoSCardDeck {
|
||||
flipData.cardSlot[0].card2 = false;
|
||||
if ( flipData.cardSlot[0].isFace1 ) {
|
||||
flipData.cardSlot[0].card2 = this.drawFromDeck();
|
||||
flipData.isJoker = this.isJoker(flipData.cardSlot[0].card2.cardName);
|
||||
flipData.cardSlot[0].value2 = this.getCardValue(flipData.cardSlot[0].card2.cardName);
|
||||
flipData.cardSlot[0].isFace2 = this.isCardFace(flipData.cardSlot[0].card2.cardName);
|
||||
flipData.cardSlot[0].card2Path = `systems/foundryvtt-shadows-over-sol/img/cards/${flipData.cardSlot[0].card2.cardName}.webp`;
|
||||
@ -149,17 +161,19 @@ export class SoSCardDeck {
|
||||
|
||||
// Trump check
|
||||
flipData.cardSlot[0].cardsuit = cardsuit;
|
||||
if ( cardsuit == flipData.stat.cardsuit ) {
|
||||
if ( ! flipData.isJoker && cardsuit == flipData.stat.cardsuit ) {
|
||||
// This is a trump !
|
||||
flipData.cardSlot[1] = { total: 0 };
|
||||
flipData.isTrump = true;
|
||||
flipData.cardSlot[1].card1 = this.drawFromDeck();
|
||||
flipData.isJoker = this.isJoker(flipData.cardSlot[1].card1.cardName);
|
||||
flipData.cardSlot[1].card1Path = `systems/foundryvtt-shadows-over-sol/img/cards/${flipData.cardSlot[1].card1.cardName}.webp`;
|
||||
flipData.cardSlot[1].cardsuit = this.getCardSuit(flipData.cardSlot[1].card1.cardName);
|
||||
flipData.cardSlot[1].value1 = this.getCardValue(flipData.cardSlot[1].card1.cardName);
|
||||
flipData.cardSlot[1].isFace1 = this.isCardFace(flipData.cardSlot[1].card1.cardName);
|
||||
if ( flipData.cardSlot[1].isFace1 ) {
|
||||
if ( !flipData.isJoker && flipData.cardSlot[1].isFace1 ) {
|
||||
flipData.cardSlot[1].card2 = this.drawFromDeck();
|
||||
flipData.isJoker = this.isJoker(flipData.cardSlot[1].card2.cardName);
|
||||
flipData.cardSlot[1].value2 = this.getCardValue(flipData.cardSlot[1].card2.cardName);
|
||||
flipData.cardSlot[1].isFace2 = this.isCardFace(flipData.cardSlot[1].card2.cardName);
|
||||
flipData.cardSlot[1].card2Path = `systems/foundryvtt-shadows-over-sol/img/cards/${flipData.cardSlot[1].card2.cardName}.webp`;
|
||||
|
@ -69,8 +69,8 @@ export class SoSFlipDialog extends Dialog {
|
||||
flipData.modifier = html.find('#modifier').val();
|
||||
flipData.tn = html.find('#tn').val();
|
||||
if ( flipData.mode == 'skill') {
|
||||
console.log("SKILL STAT : ", html.find('#statSelect').val() );
|
||||
flipData.stat = duplicate( flipData.statList[ html.find('#statSelect').val() ] );
|
||||
let statKey = $('#statSelect').val();
|
||||
flipData.stat = duplicate( flipData.statList[ statKey ] );
|
||||
}
|
||||
flipData.cardOrigin = "Deck";
|
||||
flipData.tn = html.find('#tn').val();
|
||||
|
@ -73,8 +73,10 @@
|
||||
|
||||
<div class="flexrow">
|
||||
<span class="flexcol">
|
||||
<span class="edge-name">Edge cards : </span>
|
||||
<span class="edge-name"><a class="edge-draw">Draw edge cards</a></span>
|
||||
<h3 class="edge-name">Edge cards : </h3>
|
||||
<span class="edge-name"><a class="reset-deck-full">Reset full deck and edges</a></span>
|
||||
<span class="edge-name"><a class="draw-new-edge">Draw a new Edge card</a></span>
|
||||
<span class="edge-name"><a class="reset-deck">Reset deck only (ie after a Joker)</a></span>
|
||||
</span>
|
||||
<span class="edge-name">
|
||||
{{#each data.edgecard as |card key|}}
|
||||
|
@ -15,7 +15,7 @@
|
||||
</table>
|
||||
|
||||
{{#if isJoker}}
|
||||
<label>This is a Critical Failure ! You deck has been resetted !</label>
|
||||
<label><strong>This is a Critical Failure ! </strong>You can discard some cards from your deck, then draw a new one and then shuffle the discard pile with the deck !</label>
|
||||
{{else}}
|
||||
<div class="flexcol">
|
||||
<label>Card(s) total value : {{cardTotal}}</label>
|
||||
|
Loading…
Reference in New Issue
Block a user