This commit is contained in:
sladecraven 2022-01-17 15:09:52 +01:00
parent a92ed693df
commit baacbf38a9
5 changed files with 74 additions and 31 deletions

View File

@ -578,37 +578,55 @@ export class PegasusActor extends Actor {
}
/* -------------------------------------------- */
computeNRGHealth() {
let phyDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value) + this.data.data.statistics.phy.mod;
async computeNRGHealth() {
let updates = {}
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) {
this.update({ 'data.secondary.health.max': phyDiceValue, 'data.secondary.health.value': phyDiceValue })
updates['data.secondary.health.max'] = phyDiceValue
updates['data.secondary.health.value'] = phyDiceValue
}
let mndDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.mnd.value) + 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) {
this.update({ 'data.secondary.delirium.max': mndDiceValue, 'data.secondary.delirium.value': mndDiceValue })
updates['data.secondary.delirium.max'] = mndDiceValue
updates['data.secondary.delirium.value'] = mndDiceValue
}
let stlDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.stl.value) +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) {
this.update({ 'data.secondary.stealthhealth.max': stlDiceValue, 'data.secondary.stealthhealth.value': stlDiceValue })
updates['data.secondary.stealthhealth.max'] = stlDiceValue
updates['data.secondary.stealthhealth.value'] = stlDiceValue
}
let socDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.soc.value) + 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) {
this.update({ 'data.secondary.socialhealth.max': socDiceValue, 'data.secondary.socialhealth.value': socDiceValue })
updates['data.secondary.socialhealth.max'] = socDiceValue
updates['data.secondary.socialhealth.value'] = socDiceValue
}
let nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + + 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) {
this.update({ 'data.nrg.max': nrgValue, 'data.nrg.value': nrgValue })
updates['data.nrg.max'] = nrgValue
updates['data.nrg.value'] = nrgValue
}
if (nrgValue != this.data.data.combat.stunthreshold) {
this.update({ 'data.combat.stunthreshold': nrgValue })
updates['data.combat.stunthreshold'] = nrgValue
}
let mrLevel = (this.data.data.statistics.agi.value + this.data.data.statistics.str.value) - this.data.data.statistics.phy.value
mrLevel = (mrLevel < 1) ? 1 : mrLevel;
if (mrLevel != this.data.data.mr.value) {
this.update({ 'data.mr.value': mrLevel });
updates['data.mr.value'] = mrLevel
}
let race = this.getRace()
if ( race && race.name && (race.name != this.data.data.biodata.racename) ) {
updates['data.biodata.racename'] = race.name
}
let role = this.getRole()
if ( role && role.name && (role.name != this.data.data.biodata.rolename)) {
updates['data.biodata.rolename'] = role.name
}
//console.log("UPD", updates, this.data.data.biodata)
await this.update(updates)
}
/* -------------------------------------------- */
@ -652,7 +670,7 @@ export class PegasusActor extends Actor {
}
/* -------------------------------------------- */
async applyRace(race) {
let updates = { 'data.racename': race.name }
let updates = { 'data.biodata.racename': race.name }
let newItems = []
await this.deleteAllItemsByType('race')
newItems.push(race);
@ -699,7 +717,7 @@ export class PegasusActor extends Actor {
async applyRole(role) {
console.log("ROLE", role)
let updates = { 'data.rolename': role.name }
let updates = { 'data.biodata.rolename': role.name }
let newItems = []
await this.deleteAllItemsByType('role')
newItems.push(role);

View File

@ -154,15 +154,15 @@
]
}
],
"primaryTokenAttribute": "endurance.endurance",
"secondaryTokenAttribute": "fate.value",
"primaryTokenAttribute": "secondary.health",
"secondaryTokenAttribute": "secondary.delirium",
"socket": true,
"styles": [
"styles/simple.css"
],
"templateVersion": 58,
"templateVersion": 60,
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "0.1.5",
"version": "0.1.8",
"background" : "./images/ui/pegasus_welcome_page.webp"
}

View File

@ -109,6 +109,7 @@
"type": "value",
"value": 0,
"max": 0,
"mod": 0,
"activated": 0
},
"mr": {
@ -129,6 +130,7 @@
"value": 0,
"type": "value",
"ismax": true,
"bonus": 0,
"max": 0
},
"delirium": {
@ -136,6 +138,7 @@
"value": 0,
"type": "value",
"ismax": true,
"bonus": 0,
"max": 0
},
"stealthhealth": {
@ -143,6 +146,7 @@
"type": "value",
"value": 0,
"ismax": true,
"bonus": 0,
"max": 0
},
"socialhealth": {
@ -150,6 +154,7 @@
"type": "value",
"value": 0,
"ismax": true,
"bonus": 0,
"max": 0
}
},
@ -421,6 +426,7 @@
"cost": 0,
"weight": 0,
"idr": "",
"quantity": 0,
"equipped": false,
"description":""
},

View File

@ -53,7 +53,7 @@
<div class="">
<ul>
<li class="item flexrow list-item"><span></span><span>Current</span><span>Max</span></li>
<li class="item flexrow list-item"><span></span><span>Current</span><span>Bonus</span><span>Max</span></li>
<li class="item flexrow list-item"></li>
<li class="item flexrow list-item"></li>
{{#each data.secondary as |stat2 key|}}
@ -62,6 +62,7 @@
<h4>{{stat2.label}}</h4>
</span>
<input type="text" class="padd-right" name="data.secondary.{{key}}.value" value="{{stat2.value}}" data-dtype="Number"/>
<input type="text" class="padd-right" name="data.secondary.{{key}}.bonus" value="{{stat2.bonus}}" data-dtype="Number"/>
<input type="text" class="padd-right" name="data.secondary.{{key}}.max" value="{{stat2.max}}" data-dtype="Number"/>
</li>
{{/each}}
@ -72,6 +73,7 @@
<span class="stat-label flexrow" name="nrg"> <h4>{{data.nrg.label}}</h4> </span>
<input type="text" class="padd-right" name="data.nrg.activated" value="{{data.nrg.activated}}" data-dtype="Number"/>
<input type="text" class="padd-right" name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/>
<input type="text" class="padd-right" name="data.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/>
<input type="text" class="padd-right" name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/>
</li>
</ul>
@ -193,6 +195,7 @@
<span class="stat-label flexrow" name="nrg"><h4>{{data.nrg.label}}</h4> </span>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.activated" value="{{data.nrg.activated}}" data-dtype="Number"/>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/>
</li>
</ul>
@ -296,6 +299,16 @@
<div class="flexcol">
<ul>
<li class="item flexrow list-item" data-key="nrg">
<span class="stat-label flexrow" name="nrg"><h4>{{data.nrg.label}}</h4> </span>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.activated" value="{{data.nrg.activated}}" data-dtype="Number"/>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/>
<input type="text" class="padd-right update-field" data-field-name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/>
</li>
</ul>
<span class="generic-label">
<h3>Powers</h3>
</span>
@ -344,7 +357,10 @@
<li class="item flexrow list-item" data-item-id="{{equip._id}}">
<img class="sheet-competence-img" src="{{equip.img}}" />
<span class="equipement-label">{{equip.name}}</span>
<span class="equipement-label">{{equip.type}}</span>
<span class="equipement-label">{{upperFirst equip.type}}</span>
{{#if (eq equip.type "equipment")}}
<span class="generic-label">Qty {{equip.data.quantity}}</span>
{{/if}}
<div class="item-controls">
<a class="item-control item-equip" title="Worn">{{#if equip.data.equipped}}<i
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
@ -401,14 +417,14 @@
</li>
<li class="flexrow item list_item" data-item-id="{{race._id}}">
<label class="generic-label">Race</label>
<input type="text" class="" name="data.racename" value="{{data.racename}}" data-dtype="String" />
<input type="text" class="" name="data.biodata.racename" value="{{data.biodata.racename}}" data-dtype="String" />
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
</div>
</li>
<li class="flexrow item list_item" data-item-id="{{role._id}}">
<label class="generic-label">Role</label>
<input type="text" class="" name="data.rolename" value="{{data.rolename}}" data-dtype="String" />
<input type="text" class="" name="data.biodata.rolename" value="{{data.biodata.rolename}}" data-dtype="String" />
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
</div>
@ -422,13 +438,13 @@
<ul>
<li class="flexrow">
<label class="short-label">Worst Fear </label>
<input type="text" class="" name="data.biodata.worstfear" value="{{datadata.biodata.worstfear}}"
data-dtype="Number" />
<input type="text" class="" name="data.biodata.worstfear" value="{{data.biodata.worstfear}}"
data-dtype="String" />
</li>
<li class="flexrow">
<label class="short-label">Desires </label>
<input type="text" class="" name="data.biodata.desires" value="{{data.biodata.desires}}"
data-dtype="Number" />
data-dtype="String" />
</li>
</ul>
@ -436,13 +452,13 @@
<ul>
<li class="flexrow">
<label class="short-label">Catchphrase </label>
<input type="text" class="" name="data.biodata.catchphrase" value="{{datadata.biodata.catchphrase}}"
data-dtype="Number" />
<input type="text" class="" name="data.biodata.catchphrase" value="{{data.biodata.catchphrase}}"
data-dtype="String" />
</li>
<li class="flexrow">
<label class="short-label">Catchphrase Trigger : </label>
<input type="text" class="" name="data.biodata.catchphrasetrigger" value="{{data.biodata.catchphrasetrigger}}"
data-dtype="Number" />
data-dtype="String" />
</li>
<li class="flexrow">
<label class="short-label">Catchphrase used </label>

View File

@ -21,6 +21,9 @@
<li class="flexrow"><label class="generic-label">Equipped ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="data.equipped" {{checked data.equipped}}/></label>
</li>
<li class="flexrow"><label class="generic-label">Quantity</label>
<input type="text" class="input-numeric-short padd-right" name="data.quantity" value="{{data.quantity}}" data-dtype="Number"/>
</li>
<li class="flexrow"><label class="generic-label">Weight</label>
<input type="text" class="input-numeric-short padd-right" name="data.weight" value="{{data.weight}}" data-dtype="Number"/>
</li>