Add items

This commit is contained in:
sladecraven 2021-02-17 20:45:52 +01:00
parent 5790525c82
commit f57e5030c5
5 changed files with 61 additions and 18 deletions

View File

@ -227,6 +227,7 @@ export class SoSActor extends Actor {
modifierList: SoSUtility.fillRange(-10, +10),
tnList: SoSUtility.fillRange(6, 20),
consequencesList: duplicate( this.getApplicableConsequences() ),
wounds: duplicate( this.data.data.wounds),
malusConsequence: 0,
bonusConsequence: 0
}
@ -241,6 +242,7 @@ export class SoSActor extends Actor {
statList: duplicate(this.data.data.stats),
selectedStat: 'strength',
consequencesList: duplicate( this.getApplicableConsequences() ),
wounds: duplicate( this.data.data.wounds),
skill: duplicate(skill),
actor: this,
modifierList: SoSUtility.fillRange(-10, +10),
@ -275,6 +277,7 @@ export class SoSActor extends Actor {
target: target,
selectedStat: selectedStatName,
consequencesList: duplicate( this.getApplicableConsequences() ),
wounds: duplicate( this.data.data.wounds),
skill: duplicate(skill),
actor: this,
modifierList: SoSUtility.fillRange(-10, +10),

View File

@ -244,9 +244,9 @@ export class SoSCardDeck {
// Compute final result and compare
if ( flipData.mode == 'stat' || flipData.mode == 'weapon' ) {
flipData.baseScore = flipData.stat.value + flipData.malusConsequence;
flipData.baseScore = flipData.stat.value + flipData.malusConsequence + flipData.bonusConsequence + flipData.woundMalus;
} else if (flipData.mode == 'skill') {
flipData.baseScore = Math.floor(flipData.stat.value/2) + flipData.skill.data.value + flipData.malusConsequence
flipData.baseScore = Math.floor(flipData.stat.value/2) + flipData.skill.data.value + flipData.malusConsequence + flipData.bonusConsequence + flipData.woundMalus;
}
flipData.finalScore = flipData.baseScore + flipData.cardTotal + Number(flipData.modifier);
flipData.magnitude = flipData.finalScore - flipData.tn;

View File

@ -33,10 +33,17 @@ export class SoSFlipDialog extends Dialog {
scoreBase = Math.floor(this.flipData.statList[ statKey ].value / 2) + this.flipData.skill.data.value;
} else { //Stat mode
let statKey = $('#statSelect').val();
scoreBase = this.flipData.stat.value;
scoreBase = this.flipData.stat.value;
}
this.flipData.woundMalus = 0;
this.flipData.woundMalus += ($('#wound-light-checkbox').is(":checked")) ? (-1) : 0;
this.flipData.woundMalus += ($('#wound-moderate-checkbox').is(":checked")) ? (-2) : 0;
this.flipData.woundMalus += ($('#wound-severe-checkbox').is(":checked")) ? (-3) : 0;
this.flipData.woundMalus += ($('#wound-critical-checkbox').is(":checked")) ? (-4) : 0;
scoreBase += this.flipData.malusConsequence;
scoreBase += this.flipData.bonusConsequence;
scoreBase += this.flipData.woundMalus;
$('#wound-malus').text(this.flipData.woundMalus);
$('#score-base').text( scoreBase);
}
@ -122,6 +129,18 @@ export class SoSFlipDialog extends Dialog {
html.find('#consequenceSelectBonus').change((event) => {
this.updateConsequenceBonus( event );
} );
html.find('#wound-light-checkbox').change((event) => {
this.updateScoreBase( event );
} );
html.find('#wound-moderate-checkbox').change((event) => {
this.updateScoreBase( event );
} );
html.find('#wound-severe-checkbox').change((event) => {
this.updateScoreBase( event );
} );
html.find('#wound-critical-checkbox').change((event) => {
this.updateScoreBase( event );
} );
html.find('.class-view-deck').click((event) => {
let flipData = this.flipData;

View File

@ -638,6 +638,11 @@ ul, li {
font-weight: bold;
flex-grow: 2;
}
.dialog-label {
flex-grow: 2;
font-size: 0.8rem;
font-weight: bold;
}
.attribut-value,
.stat-value {
flex-grow: 0;

View File

@ -5,14 +5,15 @@
<div class="flexrow">
<div class="flexcol">
{{#if (eq mode 'stat')}}
<h3 class="skill-label" id="flipSubTitle">
Stat Only Flip : {{localize stat.label}} : {{stat.value}} - <img class="cardsuit-img" src="systems/foundryvtt-shadows-over-sol/img/cards/{{stat.cardsuit}}.webp"/>
</h3>
<label class="dialog-label" id="flipSubTitle">Stat Only Flip :</label>
<label class="dialog-label">
{{localize stat.label}} : {{stat.value}} - <img class="cardsuit-img" src="systems/foundryvtt-shadows-over-sol/img/cards/{{stat.cardsuit}}.webp"/>
</label>
<span>
<h3 class="skill-label" id="flipSubTitle">Final Score : <span id='score-base'>0</span> </h3>
<label class="dialog-label" id="flipSubTitle">Final Score : <span id='score-base'>0</span> </h3>
</span>
{{else}}
<h3 class="skill-label" id="flipSubTitle">Select Stat</h3>
<label class="dialog-label" id="flipSubTitle">Select Stat</h3>
<select name="stat" id="statSelect" data-dtype="String">
{{#select statList}}
{{#each statList as |stat key|}}
@ -21,8 +22,8 @@
{{/select}}
</select>
<span>
<h3 class="skill-label" id="flipSubTitle">Skill Flip : {{skill.name}} ({{skill.data.value}}) </h3>
<h3 class="skill-label" id="flipSubTitle">Final Score : <span id='score-base'>0</span> </h3>
<h3 class="dialog-label" id="flipSubTitle">Skill Flip : {{skill.name}} ({{skill.data.value}}) </h3>
<h3 class="dialog-label" id="flipSubTitle">Final Score : <span id='score-base'>0</span> </h3>
</span>
{{/if}}
</div>
@ -35,7 +36,7 @@
{{/each}}
{{/select}}
</select>
<h3 class="skill-label" id="flipConsequenceMalus">Consequences Malus : <span id='consequence-malus'>0</span> </h3>
<h3 class="dialog-label" id="flipConsequenceMalus">Consequences Malus : <span id='consequence-malus'>0</span> </h3>
</div>
</div>
<div class="flexcol">
@ -47,9 +48,24 @@
{{/each}}
{{/select}}
</select>
<h3 class="skill-label" id="flipConsequenceMalus">Consequences Bonus : <span id='consequence-bonus'>0</span> </h3>
<h3 class="dialog-label" id="flipConsequenceBonus">Consequences Bonus : <span id='consequence-bonus'>0</span> </h3>
</div>
</div>
<div class="flexcol">
{{#if (gt wounds.light 0)}}
<span><label class="dialog-label">Apply Light Wound Malus:</label><input type="checkbox" name="wound-light-checkbox" id="wound-light-checkbox"></span>
{{/if}}
{{#if (gt wounds.moderate 0)}}
<span><label class="dialog-label">Apply Moderate Wound Malus:</label><input type="checkbox" name="wound-moderate-checkbox" id="wound-moderate-checkbox"></span>
{{/if}}
{{#if (gt wounds.severe 0)}}
<span><label class="dialog-label">Apply Severe Wound Malus:</label><input type="checkbox" name="wound-severe-checkbox" id="wound-severe-checkbox"></span>
{{/if}}
{{#if (gt wounds.critical 0)}}
<span><label class="dialog-label">Apply Critical Wound Malus:</label><input type="checkbox" name="wound-critical-checkbox" id="wound-critical-checkbox"></span>
{{/if}}
<h3 class="dialog-label" id="flipWoundMalus">Wounds Malus : <span id='wound-malus'>0</span> </h3>
</div>
</div>
</div>
<hr>
@ -62,9 +78,9 @@
<section class="sheet-body">
<div class="tab" data-group="primary">
<div class="flexrow">
<label for="categorie" class="generic-label">Target Number (TN) : </label>
<label for="categorie" class="dialog-label">Target Number (TN) : </label>
{{#if target}}
<label for="categorie" class="generic-label"> {{target.actor.data.data.scores.defense.value}} </label>
<label for="categorie" class="dialog-label"> {{target.actor.data.data.scores.defense.value}} </label>
{{else}}
<select name="tn" id="tn" data-dtype="number">
{{#select tn}}
@ -74,7 +90,7 @@
{{/select}}
</select>
{{/if}}
<label for="categorie" class="generic-label"> Flip Modifier (GM bonus/malus)</label>
<label for="categorie" class="dialog-label"> Flip Modifier (GM bonus/malus)</label>
<select name="modifier" id="modifier" data-dtype="number">
{{#select modifier}}
{{#each modifierList as |key|}}
@ -86,9 +102,9 @@
</div>
<hr>
<div class="flexcol">
<label class="generic-label">Click on deck to flip from deck, or click on the relevant Edge card to flip from it!</label>
<label class="dialog-label">Click on deck to flip from deck, or click on the relevant Edge card to flip from it!</label>
<label class="generic-label flexrow">Discard Edge for Luck (ie force Trump) when clicking :
<label class="dialog-label flexrow">Discard Edge for Luck (ie force Trump) when clicking :
<span class="attribute-value checkbox"><input type="checkbox" name="edge-luck" id="edge-luck"/></span>
</label>
</div>
@ -97,7 +113,7 @@
<span class="class-view-edge" id="view-edge"></span>
</div>
<div class="flexrow">
<label class="generic-label"></label>
<label class="dialog-label"></label>
</div>
</section>