Merge pull request #161 from drewg13/master

Fix cohort scale and quality calculation
This commit is contained in:
megastruktur 2021-11-02 11:10:43 +03:00 committed by GitHub
commit 1adba72f07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 18 deletions

View file

@ -28,14 +28,14 @@ export class BladesItem extends Item {
prepareData() {
super.prepareData();
const item_data = this.data;
const data = item_data.data;
if (item_data.type === "cohort") {
this._prepareCohort(data);
}
if (item_data.type === "faction") {
@ -52,7 +52,7 @@ export class BladesItem extends Item {
/**
* Prepares Cohort data
*
* @param {object} data
* @param {object} data
*/
_prepareCohort(data) {
@ -60,22 +60,22 @@ export class BladesItem extends Item {
let scale = 0;
// Adds Scale and Quality
if (this.actor) {
switch (data.cohort[0]) {
if (this.actor.data) {
switch (data.cohort) {
case "Gang":
scale = parseInt(this.actor.data.data.tier[0]);
quality = parseInt(this.actor.data.data.tier[0]);
scale = parseInt(this.actor.data.data.tier);
quality = parseInt(this.actor.data.data.tier);
break;
case "Expert":
scale = 1;
quality = parseInt(this.actor.data.data.tier[0]) + 1;
scale = 0;
quality = parseInt(this.actor.data.data.tier) + 1;
break;
}
}
data.scale = scale;
data.quality = quality;
this.data.data = data;
}
}

View file

@ -136,7 +136,7 @@
"name": "",
"reputation": [0],
"lair": "",
"tier": [0],
"tier": "",
"deity": "",
"hold": ["strong"],
"experience": [0],

View file

@ -6,7 +6,7 @@
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="{{localize 'BITD.Name'}}"/></h1>
</div>
</header>
<section class="flex-vertical">
<div class="label-stripe">{{localize "BITD.Information"}}</div>
@ -56,11 +56,13 @@
</section>
{{!-- Scale and Quality if attached to Actor --}}
{{#if data.quality}}
{{#if (eq document.parent.documentName "Actor")}}
<section id="quality-scale" class="flex-vertical">
<div class="label-stripe">{{localize "BITD.ScaleAndQuality"}}</div>
<div>{{localize "BITD.Quality"}}: {{data.quality}}</div>
<div>{{localize "BITD.Scale"}}: {{data.scale}}</div>
<div>
{{localize "BITD.Quality"}}: {{data.quality}}
{{localize "BITD.Scale"}}: {{data.scale}}
</div>
</section>
{{/if}}
@ -97,7 +99,7 @@
</section>
<section id="cohort-harm" class="flex-vertical">
<div class="label-stripe">{{localize "BITD.Harm"}}</div>
<div id="harm-list" class="flex-horizontal">
@ -110,7 +112,7 @@
</div>
</section>
<section class="flex">
<section class="flex-horizontal" style="justify-content: unset;">
<input id="cohort-armor" type="checkbox" name="data.armor" value="{{data.armor}}" {{checked data.armor}}>
<label for="cohort-armor">{{localize "BITD.Armor"}}</label>
</section>