Fix various glitches
This commit is contained in:
parent
5e44a97686
commit
6e8e1ec5a3
@ -237,7 +237,7 @@ export class PegasusActor extends Actor {
|
||||
nrg.activated += item.data.data.costspent
|
||||
nrg.value -= item.data.data.costspent
|
||||
nrg.max -= item.data.data.costspent
|
||||
this.update({ 'data.nrg': nrg })
|
||||
await this.update({ 'data.nrg': nrg })
|
||||
|
||||
let effects = []
|
||||
for (let effect of item.data.data.effectsgained) {
|
||||
@ -250,7 +250,7 @@ export class PegasusActor extends Actor {
|
||||
} else {
|
||||
nrg.activated -= item.data.data.costspent
|
||||
nrg.max += item.data.data.costspent
|
||||
this.update({ 'data.nrg': nrg })
|
||||
await this.update({ 'data.nrg': nrg })
|
||||
|
||||
let toRem = []
|
||||
for (let item of this.data.items) {
|
||||
@ -520,24 +520,26 @@ export class PegasusActor extends Actor {
|
||||
let updateOK = true
|
||||
if (status == "ready") {
|
||||
this.cleanPerkEffects(itemId)
|
||||
await this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'data.used1': false, 'data.used3': false, 'data.used3': false }] ) // Reset on Ready
|
||||
if (item.data.data.features.nrgcost.flag) {
|
||||
let nrg = duplicate(this.data.data.nrg)
|
||||
nrg.activated -= item.data.data.features.nrgcost.value
|
||||
this.update({ 'data.nrg': nrg })
|
||||
nrg.max += item.data.data.features.nrgcost.value
|
||||
await this.update({ 'data.nrg': nrg })
|
||||
}
|
||||
if (item.data.data.features.bonushealth.flag) {
|
||||
let health = duplicate(this.data.data.secondary.health)
|
||||
health.bonus -= item.data.data.features.bonushealth.value
|
||||
health.bonus -= Number(item.data.data.features.bonushealth.value) || 0
|
||||
this.update({ 'data.secondary.health': health })
|
||||
}
|
||||
if (item.data.data.features.bonusdelirium.flag) {
|
||||
let delirium = duplicate(this.data.data.delirium.delirium)
|
||||
delirium.bonus -= item.data.data.features.bonusdelirium.value
|
||||
let delirium = duplicate(this.data.data.secondary.delirium)
|
||||
delirium.bonus -= Number(item.data.data.features.bonusdelirium.value) || 0
|
||||
this.update({ 'data.secondary.delirium': delirium })
|
||||
}
|
||||
if (item.data.data.features.bonusnrg.flag) {
|
||||
let nrg = duplicate(this.data.data.nrg)
|
||||
nrg.mod -= item.data.data.features.bonusnrg.value
|
||||
nrg.mod -= Number(item.data.data.features.bonusnrg.value) || 0
|
||||
this.update({ 'data.nrg': nrg })
|
||||
}
|
||||
this.disableWeaverPerk(item)
|
||||
@ -555,10 +557,11 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
// Manage additional flags
|
||||
if (item.data.data.features.nrgcost.flag) {
|
||||
if (this.data.data.nrg.value >= item.data.data.features.nrgcost.value) {
|
||||
if ( (this.data.data.nrg.value >= item.data.data.features.nrgcost.value) && (this.data.data.nrg.max >= item.data.data.features.nrgcost.value)) {
|
||||
let nrg = duplicate(this.data.data.nrg)
|
||||
nrg.activated += item.data.data.features.nrgcost.value
|
||||
nrg.value -= item.data.data.features.nrgcost.value
|
||||
nrg.max -= item.data.data.features.nrgcost.value
|
||||
this.update({ 'data.nrg': nrg })
|
||||
} else {
|
||||
updateOK = false
|
||||
@ -567,17 +570,17 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
if (item.data.data.features.bonushealth.flag) {
|
||||
let health = duplicate(this.data.data.secondary.health)
|
||||
health.bonus += item.data.data.features.bonushealth.value
|
||||
health.bonus += Number(item.data.data.features.bonushealth.value) || 0
|
||||
this.update({ 'data.secondary.health': health })
|
||||
}
|
||||
if (item.data.data.features.bonusdelirium.flag) {
|
||||
let delirium = duplicate(this.data.data.delirium.delirium)
|
||||
delirium.bonus += item.data.data.features.bonusdelirium.value
|
||||
let delirium = duplicate(this.data.data.secondary.delirium)
|
||||
delirium.bonus += Number(item.data.data.features.bonusdelirium.value) || 0
|
||||
this.update({ 'data.secondary.delirium': delirium })
|
||||
}
|
||||
if (item.data.data.features.bonusnrg.flag) {
|
||||
let nrg = duplicate(this.data.data.nrg)
|
||||
nrg.mod += item.data.data.features.bonusnrg.value
|
||||
nrg.mod += Number(item.data.data.features.bonusnrg.value) || 0
|
||||
this.update({ 'data.nrg': nrg })
|
||||
}
|
||||
this.enableWeaverPerk(item)
|
||||
@ -610,29 +613,28 @@ export class PegasusActor extends Actor {
|
||||
let phyDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value) + this.data.data.secondary.health.bonus + this.data.data.statistics.phy.mod;
|
||||
if (phyDiceValue != this.data.data.secondary.health.max) {
|
||||
updates['data.secondary.health.max'] = phyDiceValue
|
||||
updates['data.secondary.health.value'] = phyDiceValue
|
||||
//updates['data.secondary.health.value'] = phyDiceValue
|
||||
}
|
||||
let mndDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.mnd.value) + this.data.data.secondary.delirium.bonus + this.data.data.statistics.mnd.mod;
|
||||
if (mndDiceValue != this.data.data.secondary.delirium.max) {
|
||||
updates['data.secondary.delirium.max'] = mndDiceValue
|
||||
updates['data.secondary.delirium.value'] = mndDiceValue
|
||||
//updates['data.secondary.delirium.value'] = mndDiceValue
|
||||
}
|
||||
let stlDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.stl.value) + this.data.data.secondary.stealthhealth.bonus + this.data.data.statistics.stl.mod;
|
||||
if (stlDiceValue != this.data.data.secondary.stealthhealth.max) {
|
||||
updates['data.secondary.stealthhealth.max'] = stlDiceValue
|
||||
updates['data.secondary.stealthhealth.value'] = stlDiceValue
|
||||
//updates['data.secondary.stealthhealth.value'] = stlDiceValue
|
||||
}
|
||||
|
||||
let socDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.soc.value) + this.data.data.secondary.socialhealth.bonus + this.data.data.statistics.soc.mod;
|
||||
if (socDiceValue != this.data.data.secondary.socialhealth.max) {
|
||||
updates['data.secondary.socialhealth.max'] = socDiceValue
|
||||
updates['data.secondary.socialhealth.value'] = socDiceValue
|
||||
//updates['data.secondary.socialhealth.value'] = socDiceValue
|
||||
}
|
||||
|
||||
let nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.nrg.mod + this.data.data.statistics.foc.mod;
|
||||
if (nrgValue != this.data.data.nrg.max) {
|
||||
updates['data.nrg.max'] = nrgValue
|
||||
updates['data.nrg.value'] = nrgValue
|
||||
if (nrgValue != this.data.data.nrg.absolutemax) {
|
||||
updates['data.nrg.absolutemax'] = nrgValue
|
||||
}
|
||||
nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.statistics.foc.mod;
|
||||
if (nrgValue != this.data.data.combat.stunthreshold) {
|
||||
|
@ -180,9 +180,9 @@
|
||||
"styles": [
|
||||
"styles/simple.css"
|
||||
],
|
||||
"templateVersion": 75,
|
||||
"templateVersion": 77,
|
||||
"title": "Pegasus RPG",
|
||||
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
||||
"version": "0.4.10",
|
||||
"version": "0.4.12",
|
||||
"background" : "./images/ui/pegasus_welcome_page.webp"
|
||||
}
|
||||
|
@ -109,6 +109,7 @@
|
||||
"nrg": {
|
||||
"label": "NRG",
|
||||
"type": "value",
|
||||
"absolutemax": 0,
|
||||
"value": 0,
|
||||
"max": 0,
|
||||
"mod": 0,
|
||||
@ -268,36 +269,42 @@
|
||||
"label": "NRG cost to use",
|
||||
"flag": false,
|
||||
"type": "number",
|
||||
"isvalid": true,
|
||||
"value": 0
|
||||
},
|
||||
"range": {
|
||||
"label": "Range",
|
||||
"flag": false,
|
||||
"type": "range",
|
||||
"isvalid": true,
|
||||
"value": ""
|
||||
},
|
||||
"nbtargets": {
|
||||
"label": "# Targets",
|
||||
"flag": false,
|
||||
"type": "string",
|
||||
"isvalid": true,
|
||||
"value": ""
|
||||
},
|
||||
"bonushealth": {
|
||||
"label": "Bonus to Health",
|
||||
"flag": false,
|
||||
"type": "string",
|
||||
"isvalid": true,
|
||||
"value": ""
|
||||
},
|
||||
"bonusnrg": {
|
||||
"label": "Bonus to NRG",
|
||||
"flag": false,
|
||||
"type": "string",
|
||||
"isvalid": true,
|
||||
"value": ""
|
||||
},
|
||||
"bonusdelirium": {
|
||||
"label": "Bonus to Delirium",
|
||||
"flag": false,
|
||||
"type": "string",
|
||||
"isvalid": true,
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
|
@ -88,6 +88,7 @@
|
||||
<span class="small-label padd-right packed-left"> Cur</span><input type="text" class="padd-right" name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/>
|
||||
<span class="small-label padd-right packed-left"> Mod</span><input type="text" class="padd-right" name="data.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/>
|
||||
<span class="small-label padd-right packed-left"> Max</span><input type="text" class="padd-right" name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/>
|
||||
<span class="small-label padd-right packed-left"> / {{data.nrg.absolutemax}}</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -169,6 +170,7 @@
|
||||
<span class="small-label padd-right packed-left"> Cur</span><input type="text" class="padd-right update-field input-numeric-short" data-field-name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/>
|
||||
<span class="small-label padd-right packed-left"> Mod</span><input type="text" class="padd-right update-field input-numeric-short" data-field-name="data.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/>
|
||||
<span class="small-label padd-right packed-left"> Max</span><input type="text" class="padd-right update-field input-numeric-short" data-field-name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/>
|
||||
<span class="small-label padd-right packed-left"> / {{data.nrg.absolutemax}}</span>
|
||||
</li>
|
||||
<li class="item flexrow list-item" data-attr-key="{{key}}">
|
||||
{{#each data.secondary as |stat2 key|}}
|
||||
@ -250,6 +252,16 @@
|
||||
<img class="sheet-competence-img" src="{{perk.img}}" />
|
||||
<span class="stat-label">{{perk.name}}</span>
|
||||
<span class="stat-label">Lvl:{{perk.data.level}}</span>
|
||||
{{#if perk.data.features.range.flag}}
|
||||
<span class="stat-label">Range:{{perk.data.features.range.value}}</span>
|
||||
{{else}}
|
||||
<span class="stat-label"> </span>
|
||||
{{/if}}
|
||||
{{#if perk.data.features.nbtargets.flag}}
|
||||
<span class="stat-label">#T:{{perk.data.features.nbtargets.value}}</span>
|
||||
{{else}}
|
||||
<span class="stat-label"> </span>
|
||||
{{/if}}
|
||||
<span class="stat-label">Perk Status:
|
||||
<select class="competence-base flexrow perk-status" type="text" value="{{perk.data.status}}" data-dtype="String">
|
||||
{{#select perk.data.status}}
|
||||
@ -307,6 +319,7 @@
|
||||
<span class="small-label padd-right packed-left"> Cur</span><input type="text" class="padd-right update-field" data-field-name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/>
|
||||
<span class="small-label padd-right packed-left"> Mod</span><input type="text" class="padd-right update-field" data-field-name="data.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/>
|
||||
<span class="small-label padd-right packed-left"> Max</span><input type="text" class="padd-right update-field" data-field-name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/>
|
||||
<span class="small-label padd-right packed-left"> / {{data.nrg.absolutemax}}</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -57,50 +57,51 @@
|
||||
</li>
|
||||
|
||||
{{#each data.features as |feature key|}}
|
||||
<li class="flexrow">
|
||||
<label class="generic-label">{{feature.label}} ? </label>
|
||||
<label class="attribute-value checkbox"><input type="checkbox" name="data.features.{{key}}.flag" {{checked feature.flag}}/></label>
|
||||
</li>
|
||||
{{#if feature.flag}}
|
||||
<ul class="ul-level1">
|
||||
<li class="flexrow"><label class="generic-label">{{feature.label}}</label>
|
||||
{{#if (eq feature.type "statdice")}}
|
||||
<select class="competence-base flexrow" type="text" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="String">
|
||||
{{#select feature.value}}
|
||||
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true}}
|
||||
{{/select}}
|
||||
</select>
|
||||
{{/if}}
|
||||
{{#if (eq feature.type "range")}}
|
||||
<select class="competence-base flexrow" type="text" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="String">
|
||||
{{#select feature.value}}
|
||||
{{> systems/fvtt-pegasus-rpg/templates/partial-options-range.html notapplicable=true}}
|
||||
{{/select}}
|
||||
{{#if feature.isvalid}}
|
||||
<li class="flexrow">
|
||||
<label class="generic-label">{{feature.label}} ? </label>
|
||||
<label class="attribute-value checkbox"><input type="checkbox" name="data.features.{{key}}.flag" {{checked feature.flag}}/></label>
|
||||
</li>
|
||||
{{#if feature.flag}}
|
||||
<ul class="ul-level1">
|
||||
<li class="flexrow"><label class="generic-label">{{feature.label}}</label>
|
||||
{{#if (eq feature.type "statdice")}}
|
||||
<select class="competence-base flexrow" type="text" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="String">
|
||||
{{#select feature.value}}
|
||||
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true}}
|
||||
{{/select}}
|
||||
</select>
|
||||
{{/if}}
|
||||
{{#if (eq feature.type "number")}}
|
||||
<input type="text" class="padd-right" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="Number"/>
|
||||
{{/if}}
|
||||
{{#if (eq feature.type "string")}}
|
||||
<input type="text" class="padd-right" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="String"/>
|
||||
{{/if}}
|
||||
{{#if (eq feature.type "dropspec")}}
|
||||
<ul class="ul-level1">
|
||||
<li class="flexrow"><div class="drop-spec-perk" data-key={{key}}><label>Drop Specialisation here !</label></div>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if (eq feature.type "range")}}
|
||||
<select class="competence-base flexrow" type="text" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="String">
|
||||
{{#select feature.value}}
|
||||
{{> systems/fvtt-pegasus-rpg/templates/partial-options-range.html notapplicable=true}}
|
||||
{{/select}}
|
||||
</select>
|
||||
{{/if}}
|
||||
{{#if (eq feature.type "number")}}
|
||||
<input type="text" class="padd-right" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="Number"/>
|
||||
{{/if}}
|
||||
{{#if (eq feature.type "string")}}
|
||||
<input type="text" class="padd-right" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="String"/>
|
||||
</ul>
|
||||
{{/if}}
|
||||
{{#if (eq feature.type "text")}}
|
||||
<div class="small-editor item-text-long-line">
|
||||
{{editor content=features.value target="data.features.{{key}}.value" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
{{#if (eq feature.type "dropspec")}}
|
||||
<ul class="ul-level1">
|
||||
<li class="flexrow"><div class="drop-spec-perk" data-key={{key}}><label>Drop Specialisation here !</label></div>
|
||||
</li>
|
||||
<input type="text" class="padd-right" name="data.features.{{key}}.value" value="{{feature.value}}" data-dtype="String"/>
|
||||
</ul>
|
||||
{{/if}}
|
||||
{{#if (eq feature.type "text")}}
|
||||
<div class="small-editor item-text-long-line">
|
||||
{{editor content=features.value target="data.features.{{key}}.value" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
|
||||
</ul>
|
||||
|
||||
<label class="generic-label">Description</label>
|
||||
|
@ -15,6 +15,11 @@
|
||||
<label class="generic-label">Description</label>
|
||||
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
<li class="flexrow"><label class="generic-label">Available Effects</label>
|
||||
<div class="small-editor item-text-long-line">
|
||||
{{editor content=data.effects target="data.effects" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<ul>
|
||||
<li class="flexrow"><label class="generic-label">Roll Needed ?</label>
|
||||
@ -89,11 +94,6 @@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Available Effects</label>
|
||||
<div class="small-editor item-text-long-line">
|
||||
{{editor content=data.effects target="data.effects" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">Purchased Effects</label>
|
||||
<div class="small-editor item-text-long-line">
|
||||
{{editor content=data.purchasedeffects target="data.purchasedeffects" button=true owner=owner editable=editable}}
|
||||
|
Loading…
Reference in New Issue
Block a user