Fix #69 : Size management

This commit is contained in:
sladecraven 2022-09-28 16:43:28 +02:00
parent 7977233d93
commit e1d6b1aaff
5 changed files with 23 additions and 3 deletions

View File

@ -121,6 +121,7 @@ export class PegasusActor extends Actor {
this.system.encCapacity = this.getEncumbranceCapacity()
this.buildContainerTree()
this.updatePPP()
this.updateSize()
}
if (this.type == 'vehicle') {
this.computeVehicleStats();
@ -375,6 +376,18 @@ export class PegasusActor extends Actor {
this.update({ 'system.ppp.spentPPP': ppp })
}
}
/* -------------------------------------------- */
updateSize() {
let sizeBonus = 0
for(let effect of this.items) {
if (effect.type == "effect" && effect.system.effectlevel > 0 && effect.system.affectsize) {
sizeBonus += effect.system.effectlevel
}
}
if (sizeBonus != this.system.biodata.sizebonus) {
setTimeout(500, this.update( {'system.biodata.sizebonus': sizeBonus}) )
}
}
/* -------------------------------------------- */
async activatePower(itemId) {

View File

@ -253,7 +253,7 @@
],
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "10.0.21",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.21.zip",
"version": "10.0.22",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.22.zip",
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
}

View File

@ -11,6 +11,7 @@
"age": 0,
"size": "",
"sizenum": 0,
"sizebonus": 0,
"weight": "",
"hair": "",
"sex": "",
@ -401,6 +402,7 @@
"recoveryrollspec": [],
"effectstatlevel": false,
"effectstat": "",
"affectsize": false,
"oneuse": false,
"ignorehealthpenalty": false,
"isthispossible": "",

View File

@ -865,6 +865,8 @@
<label class="generic-label">Size</label>
<input type="text" class="" name="system.biodata.sizenum" value="{{data.biodata.sizenum}}"
data-dtype="Number" />
<input type="text" class="" value="{{add data.biodata.sizenum data.biodata.sizebonus}}"
data-dtype="Number" disabled />
</li>
<li class="flexrow item">
<label class="generic-label">Origin</label>

View File

@ -78,6 +78,9 @@
<li class="flexrow"><label class="generic-label">Effect Level</label>
<input type="text" class="input-numeric-short padd-right" name="system.effectlevel" value="{{data.effectlevel}}" data-dtype="Number"/>
</li>
<li class="flexrow"><label class="generic-label">Affect size ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="system.affectsize" {{checked data.affectsize}}/></label>
</li>
{{/if}}
<li class="flexrow"> <label class="generic-label">Affected Specialisations </label></li>