Minor fixes

This commit is contained in:
sladecraven 2022-01-08 23:28:16 +01:00
parent 0f20a66cd2
commit 8a8f2450d4
6 changed files with 56 additions and 14 deletions

View File

@ -115,7 +115,7 @@ export class BoLActorSheet extends ActorSheet {
formData.details = this.actor.details;
formData.attributes = this.actor.attributes;
formData.aptitudes = this.actor.aptitudes;
formData.resources = this.actor.resources;
formData.resources = this.actor.getResourcesFromType();
formData.equipment = this.actor.equipment;
formData.weapons = this.actor.weapons;
formData.protections = this.actor.protections;

View File

@ -12,7 +12,12 @@ export class BoLActor extends Actor {
// const flags = actorData.flags;
// Make separate methods for each Actor type (character, npc, etc.) to keep things organized.
if (actorData.type === 'character') {
//this._prepareCharacterData(actorData);
actorData.type = 'player';
actorData.villainy = false;
}
if (actorData.type === 'encounter') {
actorData.type = 'tough';
actorData.villainy = true;
}
super.prepareData();
}
@ -24,6 +29,7 @@ export class BoLActor extends Actor {
/* -------------------------------------------- */
updateResourcesData( ) {
if ( this.type == 'character') {
let newVitality = 10 + this.data.data.attributes.vigor.value + this.data.data.resources.hp.bonus
if ( this.data.data.resources.hp.max != newVitality) {
this.update( {'data.resources.hp.max': newVitality} );
@ -33,6 +39,7 @@ export class BoLActor extends Actor {
this.update( {'data.resources.power.max': newPower} );
}
}
}
/* -------------------------------------------- */
prepareDerivedData() {
@ -127,6 +134,24 @@ export class BoLActor extends Actor {
return this.itemData.filter(i => i.type === "item" && i.data.category === "equipment" && (i.data.subtype === "other" ||i.data.subtype === "container" ||i.data.subtype === "scroll" || i.data.subtype === "jewel"));
}
getResourcesFromType() {
let resources = {};
if (this.type == 'encounter') {
resources['hp'] = this.data.data.resources.hp;
if (this.data.data.type != 'base') {
resources['faith'] = this.data.data.resources.faith
resources['power'] = this.data.data.resources.power
}
if (this.data.data.type == 'adversary') {
resources['hero'] = duplicate(this.data.data.resources.hero)
resources['hero'].label = "BOL.resources.villainy"
}
} else {
resources = this.data.data.resources;
}
return resources
}
buildFeatures(){
return {
"careers": {

View File

@ -7,8 +7,8 @@
"url": "https://github.com/ZigmundKreud/bol",
"license": "LICENSE.txt",
"flags": {},
"version": "0.8.9.4",
"templateVersion": 13,
"version": "0.8.9.5",
"templateVersion": 14,
"minimumCoreVersion": "0.8.6",
"compatibleCoreVersion": "9",
"scripts": [],

View File

@ -117,7 +117,7 @@
},
"character": {
"templates": [ "base" ],
"type": "npc",
"type": "player",
"villainy": false,
"xp": {
"key": "xp",
@ -135,6 +135,7 @@
"encounter": {
"templates": [ "base" ],
"type": "tough",
"villainy": false,
"size": "",
"environment": ""
}

View File

@ -5,6 +5,8 @@
<label class="header-field-label flex2">Nom</label><br/>
<input class="charname flex6" name="name" type="text" value="{{actor.name}}" placeholder="Name"/>
</div>
{{#if (eq data.type "player")}}
<div class="header-field-group flexrow">
<label class="header-field-label flex2">Experience</label><br/>
<div class="header-field-group flex3">
@ -15,7 +17,19 @@
<label class="header-field-label flex1" style="font-size: 1.5em; color:#606060;">&nbsp;Totale</label><br/>
<input class="header-field-value flex1" type="text" name="data.xp.total" value="{{numberFormat data.xp.total decimals=0 sign=false}}" data-dtype="Number"/><br/>
</div>
</div>
{{else}}
<div class="header-field-group flexrow">
<label class="header-field-label flex2">Type : </label><br/>
<select class="field-value" name="data.type" data-dtype="String">
{{#select data.type}}
<option value="base">Piétaille</option>
<option value="tough">Coriace</option>
<option value="adversary">Adversaire</option>
{{/select}}
</select>
</div>
{{/if}}
</div>
</div>
</header>

View File

@ -23,13 +23,15 @@
</div>
<hr/>
<div class="resources flexrow">
{{#each data.resources as |resource id|}}
{{#each resources as |resource id|}}
<div class="resource stat flex1 flex-group-center">
<label class="stat-label">{{localize label}}</label><br/>
<input class="stat-value" type="text" name="data.resources.{{key}}.value" value="{{numberFormat value decimals=0 sign=false}}" data-dtype="Number"/>
{{#if (eq @root.data.type 'player')}}
{{#if (exists bonus)}}
<span class="flexrow"><label class="stat-max">Bonus:</label><input class="stat-max" type="text" name="data.resources.{{key}}.bonus" value="{{numberFormat bonus decimals=0 sign=false}}" data-dtype="Number"/></span>
{{/if}}
{{/if}}
<input class="stat-max" type="text" name="data.resources.{{key}}.max" value="{{numberFormat max decimals=0 sign=false}}" data-dtype="Number"/>
</div>
{{/each}}