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.activated += item.data.data.costspent
|
||||||
nrg.value -= item.data.data.costspent
|
nrg.value -= item.data.data.costspent
|
||||||
nrg.max -= item.data.data.costspent
|
nrg.max -= item.data.data.costspent
|
||||||
this.update({ 'data.nrg': nrg })
|
await this.update({ 'data.nrg': nrg })
|
||||||
|
|
||||||
let effects = []
|
let effects = []
|
||||||
for (let effect of item.data.data.effectsgained) {
|
for (let effect of item.data.data.effectsgained) {
|
||||||
@ -250,7 +250,7 @@ export class PegasusActor extends Actor {
|
|||||||
} else {
|
} else {
|
||||||
nrg.activated -= item.data.data.costspent
|
nrg.activated -= item.data.data.costspent
|
||||||
nrg.max += item.data.data.costspent
|
nrg.max += item.data.data.costspent
|
||||||
this.update({ 'data.nrg': nrg })
|
await this.update({ 'data.nrg': nrg })
|
||||||
|
|
||||||
let toRem = []
|
let toRem = []
|
||||||
for (let item of this.data.items) {
|
for (let item of this.data.items) {
|
||||||
@ -520,24 +520,26 @@ export class PegasusActor extends Actor {
|
|||||||
let updateOK = true
|
let updateOK = true
|
||||||
if (status == "ready") {
|
if (status == "ready") {
|
||||||
this.cleanPerkEffects(itemId)
|
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) {
|
if (item.data.data.features.nrgcost.flag) {
|
||||||
let nrg = duplicate(this.data.data.nrg)
|
let nrg = duplicate(this.data.data.nrg)
|
||||||
nrg.activated -= item.data.data.features.nrgcost.value
|
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) {
|
if (item.data.data.features.bonushealth.flag) {
|
||||||
let health = duplicate(this.data.data.secondary.health)
|
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 })
|
this.update({ 'data.secondary.health': health })
|
||||||
}
|
}
|
||||||
if (item.data.data.features.bonusdelirium.flag) {
|
if (item.data.data.features.bonusdelirium.flag) {
|
||||||
let delirium = duplicate(this.data.data.delirium.delirium)
|
let delirium = duplicate(this.data.data.secondary.delirium)
|
||||||
delirium.bonus -= item.data.data.features.bonusdelirium.value
|
delirium.bonus -= Number(item.data.data.features.bonusdelirium.value) || 0
|
||||||
this.update({ 'data.secondary.delirium': delirium })
|
this.update({ 'data.secondary.delirium': delirium })
|
||||||
}
|
}
|
||||||
if (item.data.data.features.bonusnrg.flag) {
|
if (item.data.data.features.bonusnrg.flag) {
|
||||||
let nrg = duplicate(this.data.data.nrg)
|
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.update({ 'data.nrg': nrg })
|
||||||
}
|
}
|
||||||
this.disableWeaverPerk(item)
|
this.disableWeaverPerk(item)
|
||||||
@ -555,10 +557,11 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
// Manage additional flags
|
// Manage additional flags
|
||||||
if (item.data.data.features.nrgcost.flag) {
|
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)
|
let nrg = duplicate(this.data.data.nrg)
|
||||||
nrg.activated += item.data.data.features.nrgcost.value
|
nrg.activated += item.data.data.features.nrgcost.value
|
||||||
nrg.value -= 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 })
|
this.update({ 'data.nrg': nrg })
|
||||||
} else {
|
} else {
|
||||||
updateOK = false
|
updateOK = false
|
||||||
@ -567,17 +570,17 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
if (item.data.data.features.bonushealth.flag) {
|
if (item.data.data.features.bonushealth.flag) {
|
||||||
let health = duplicate(this.data.data.secondary.health)
|
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 })
|
this.update({ 'data.secondary.health': health })
|
||||||
}
|
}
|
||||||
if (item.data.data.features.bonusdelirium.flag) {
|
if (item.data.data.features.bonusdelirium.flag) {
|
||||||
let delirium = duplicate(this.data.data.delirium.delirium)
|
let delirium = duplicate(this.data.data.secondary.delirium)
|
||||||
delirium.bonus += item.data.data.features.bonusdelirium.value
|
delirium.bonus += Number(item.data.data.features.bonusdelirium.value) || 0
|
||||||
this.update({ 'data.secondary.delirium': delirium })
|
this.update({ 'data.secondary.delirium': delirium })
|
||||||
}
|
}
|
||||||
if (item.data.data.features.bonusnrg.flag) {
|
if (item.data.data.features.bonusnrg.flag) {
|
||||||
let nrg = duplicate(this.data.data.nrg)
|
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.update({ 'data.nrg': nrg })
|
||||||
}
|
}
|
||||||
this.enableWeaverPerk(item)
|
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;
|
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) {
|
if (phyDiceValue != this.data.data.secondary.health.max) {
|
||||||
updates['data.secondary.health.max'] = phyDiceValue
|
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;
|
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) {
|
if (mndDiceValue != this.data.data.secondary.delirium.max) {
|
||||||
updates['data.secondary.delirium.max'] = mndDiceValue
|
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;
|
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) {
|
if (stlDiceValue != this.data.data.secondary.stealthhealth.max) {
|
||||||
updates['data.secondary.stealthhealth.max'] = stlDiceValue
|
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;
|
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) {
|
if (socDiceValue != this.data.data.secondary.socialhealth.max) {
|
||||||
updates['data.secondary.socialhealth.max'] = socDiceValue
|
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;
|
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) {
|
if (nrgValue != this.data.data.nrg.absolutemax) {
|
||||||
updates['data.nrg.max'] = nrgValue
|
updates['data.nrg.absolutemax'] = nrgValue
|
||||||
updates['data.nrg.value'] = nrgValue
|
|
||||||
}
|
}
|
||||||
nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.statistics.foc.mod;
|
nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.statistics.foc.mod;
|
||||||
if (nrgValue != this.data.data.combat.stunthreshold) {
|
if (nrgValue != this.data.data.combat.stunthreshold) {
|
||||||
|
@ -180,9 +180,9 @@
|
|||||||
"styles": [
|
"styles": [
|
||||||
"styles/simple.css"
|
"styles/simple.css"
|
||||||
],
|
],
|
||||||
"templateVersion": 75,
|
"templateVersion": 77,
|
||||||
"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": "0.4.10",
|
"version": "0.4.12",
|
||||||
"background" : "./images/ui/pegasus_welcome_page.webp"
|
"background" : "./images/ui/pegasus_welcome_page.webp"
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,7 @@
|
|||||||
"nrg": {
|
"nrg": {
|
||||||
"label": "NRG",
|
"label": "NRG",
|
||||||
"type": "value",
|
"type": "value",
|
||||||
|
"absolutemax": 0,
|
||||||
"value": 0,
|
"value": 0,
|
||||||
"max": 0,
|
"max": 0,
|
||||||
"mod": 0,
|
"mod": 0,
|
||||||
@ -268,36 +269,42 @@
|
|||||||
"label": "NRG cost to use",
|
"label": "NRG cost to use",
|
||||||
"flag": false,
|
"flag": false,
|
||||||
"type": "number",
|
"type": "number",
|
||||||
|
"isvalid": true,
|
||||||
"value": 0
|
"value": 0
|
||||||
},
|
},
|
||||||
"range": {
|
"range": {
|
||||||
"label": "Range",
|
"label": "Range",
|
||||||
"flag": false,
|
"flag": false,
|
||||||
"type": "range",
|
"type": "range",
|
||||||
|
"isvalid": true,
|
||||||
"value": ""
|
"value": ""
|
||||||
},
|
},
|
||||||
"nbtargets": {
|
"nbtargets": {
|
||||||
"label": "# Targets",
|
"label": "# Targets",
|
||||||
"flag": false,
|
"flag": false,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"isvalid": true,
|
||||||
"value": ""
|
"value": ""
|
||||||
},
|
},
|
||||||
"bonushealth": {
|
"bonushealth": {
|
||||||
"label": "Bonus to Health",
|
"label": "Bonus to Health",
|
||||||
"flag": false,
|
"flag": false,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"isvalid": true,
|
||||||
"value": ""
|
"value": ""
|
||||||
},
|
},
|
||||||
"bonusnrg": {
|
"bonusnrg": {
|
||||||
"label": "Bonus to NRG",
|
"label": "Bonus to NRG",
|
||||||
"flag": false,
|
"flag": false,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"isvalid": true,
|
||||||
"value": ""
|
"value": ""
|
||||||
},
|
},
|
||||||
"bonusdelirium": {
|
"bonusdelirium": {
|
||||||
"label": "Bonus to Delirium",
|
"label": "Bonus to Delirium",
|
||||||
"flag": false,
|
"flag": false,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"isvalid": true,
|
||||||
"value": ""
|
"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"> 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"> 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"> 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>
|
</li>
|
||||||
</ul>
|
</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"> 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"> 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"> 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>
|
||||||
<li class="item flexrow list-item" data-attr-key="{{key}}">
|
<li class="item flexrow list-item" data-attr-key="{{key}}">
|
||||||
{{#each data.secondary as |stat2 key|}}
|
{{#each data.secondary as |stat2 key|}}
|
||||||
@ -250,6 +252,16 @@
|
|||||||
<img class="sheet-competence-img" src="{{perk.img}}" />
|
<img class="sheet-competence-img" src="{{perk.img}}" />
|
||||||
<span class="stat-label">{{perk.name}}</span>
|
<span class="stat-label">{{perk.name}}</span>
|
||||||
<span class="stat-label">Lvl:{{perk.data.level}}</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:
|
<span class="stat-label">Perk Status:
|
||||||
<select class="competence-base flexrow perk-status" type="text" value="{{perk.data.status}}" data-dtype="String">
|
<select class="competence-base flexrow perk-status" type="text" value="{{perk.data.status}}" data-dtype="String">
|
||||||
{{#select perk.data.status}}
|
{{#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"> 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"> 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"> 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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
{{#each data.features as |feature key|}}
|
{{#each data.features as |feature key|}}
|
||||||
|
{{#if feature.isvalid}}
|
||||||
<li class="flexrow">
|
<li class="flexrow">
|
||||||
<label class="generic-label">{{feature.label}} ? </label>
|
<label class="generic-label">{{feature.label}} ? </label>
|
||||||
<label class="attribute-value checkbox"><input type="checkbox" name="data.features.{{key}}.flag" {{checked feature.flag}}/></label>
|
<label class="attribute-value checkbox"><input type="checkbox" name="data.features.{{key}}.flag" {{checked feature.flag}}/></label>
|
||||||
@ -99,8 +100,8 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<label class="generic-label">Description</label>
|
<label class="generic-label">Description</label>
|
||||||
|
@ -15,6 +15,11 @@
|
|||||||
<label class="generic-label">Description</label>
|
<label class="generic-label">Description</label>
|
||||||
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
|
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
|
||||||
</div>
|
</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>
|
<ul>
|
||||||
<li class="flexrow"><label class="generic-label">Roll Needed ?</label>
|
<li class="flexrow"><label class="generic-label">Roll Needed ?</label>
|
||||||
@ -89,11 +94,6 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</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>
|
<li class="flexrow"><label class="generic-label">Purchased Effects</label>
|
||||||
<div class="small-editor item-text-long-line">
|
<div class="small-editor item-text-long-line">
|
||||||
{{editor content=data.purchasedeffects target="data.purchasedeffects" button=true owner=owner editable=editable}}
|
{{editor content=data.purchasedeffects target="data.purchasedeffects" button=true owner=owner editable=editable}}
|
||||||
|
Loading…
Reference in New Issue
Block a user