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.system.encCapacity = this.getEncumbranceCapacity()
this.buildContainerTree() this.buildContainerTree()
this.updatePPP() this.updatePPP()
this.updateSize()
} }
if (this.type == 'vehicle') { if (this.type == 'vehicle') {
this.computeVehicleStats(); this.computeVehicleStats();
@ -375,6 +376,18 @@ export class PegasusActor extends Actor {
this.update({ 'system.ppp.spentPPP': ppp }) 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) { async activatePower(itemId) {

View File

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

View File

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

View File

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

View File

@ -77,7 +77,10 @@
{{else}} {{else}}
<li class="flexrow"><label class="generic-label">Effect Level</label> <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"/> <input type="text" class="input-numeric-short padd-right" name="system.effectlevel" value="{{data.effectlevel}}" data-dtype="Number"/>
</li> </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}} {{/if}}
<li class="flexrow"> <label class="generic-label">Affected Specialisations </label></li> <li class="flexrow"> <label class="generic-label">Affected Specialisations </label></li>