This commit is contained in:
sladecraven 2022-09-30 13:44:59 +02:00
parent 5fb0221007
commit 00761d57d3
6 changed files with 78 additions and 12 deletions

View File

@ -1344,6 +1344,7 @@ export class PegasusActor extends Actor {
this.getTraumaState()
this.cleanupPerksIfTrauma()
this.parseStatEffects()
this.parseStatusEffects()
}
}
@ -1365,6 +1366,37 @@ export class PegasusActor extends Actor {
}
}
/* -------------------------------------------- */
parseStatusEffects() {
let effects = this.items.filter(effect => effect.type == "effect" && effect.system.affectstatus && (Number(effect.system.effectlevel) > 0) )
for (let statusKey in this.system.secondary) {
let status = duplicate(this.system.secondary[statusKey])
let bonus = 0
for (let effect of effects) {
if ( effect.system.affectedstatus && effect.system.affectedstatus == statusKey) {
bonus += Number(effect.system.effectlevel)
}
}
if ( bonus != status.bonus) {
status.bonus = bonus
this.update( { [`system.secondary.${statusKey}`]: status} )
}
}
let nrg = duplicate(this.system.nrg)
let bonus = 0
for (let effect of effects) {
if ( effect.system.affectedstatus && effect.system.affectedstatus == "nrg") {
bonus += Number(effect.system.effectlevel)
}
}
if ( bonus != nrg.mod) {
nrg.mod = bonus
this.update( { [`system.nrg`]: nrg} )
}
}
/* -------------------------------------------- */
async modStat(key, inc = 1) {
let stat = duplicate(this.system.statistics[key])

View File

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

View File

@ -413,6 +413,9 @@
"physicalimmunity": false,
"nobonusdice": false,
"noperksallowed": false,
"affectstatus": false,
"affectedstatus": "",
"locked": false,
"description": ""
},
"race": {

View File

@ -302,18 +302,30 @@
</li>
{{#each effects as |effect key|}}
<li class="item stat flexrow list-item list-item-shadow" data-arme-id="{{effect.id}}"
data-item-id="{{effect._id}}">
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
src="{{effect.img}}" /></a>
<li class="item stat flexrow list-item list-item-shadow" data-arme-id="{{effect.id}}" data-item-id="{{effect._id}}">
{{#if effect.system.locked}}
{{#if @root.isGM}}
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img" src="{{effect.img}}" /></a>
{{else}}
<img class="sheet-competence-img" src="{{effect.img}}" />
{{/if}}
{{else}}
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img" src="{{effect.img}}" /></a>
{{/if}}
<span class="item-name-label-long2">{{effect.name}}</span>
<span class="item-field-label-short">{{effect.system.effectlevel}}</span>
<span class="item-field-label-short">{{upperFirst effect.system.type}}</span>
<span class="item-field-label-short">{{upperFirst effect.datsystema.genre}}</span>
<span class="item-field-label-short">{{upperFirst effect.system.genre}}</span>
<span class="item-field-label-short">{{upper effect.system.stataffected}}</span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
{{#if effect.system.locked}}
{{#if @root.isGM}}
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
{{/if}}
{{else}}
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
{{/if}}
</div>
</li>
{{/each}}

View File

@ -61,11 +61,13 @@
<li class="flexrow"><label class="generic-label">No perks allowed ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="system.noperksallowed" {{checked data.noperksallowed}}/></label>
</li>
<li class="flexrow"><label class="generic-label">Locked (Only GM can change/edit) ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="system.locked" {{checked data.locked}}/></label>
</li>
<li class="flexrow"><label class="generic-label">Effect Level is a Stat?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="system.effectstatlevel" {{checked data.effectstatlevel}}/></label>
</li>
{{#if data.effectstatlevel}}
<li class="flexrow"><label class="generic-label">Stat to use for Effect Level</label>
<select class="competence-base flexrow" type="text" name="system.effectstat" value="{{data.effectstat}}" data-dtype="String">
@ -82,7 +84,24 @@
<label class="attribute-value checkbox"><input type="checkbox" name="system.affectsize" {{checked data.affectsize}}/></label>
</li>
{{/if}}
<li class="flexrow"><label class="generic-label">Affect Status?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="system.affectstatus" {{checked data.affectstatus}}/></label>
</li>
{{#if data.affectstatus}}
<li class="flexrow"><label class="generic-label">Affected status</label>
<select class="competence-base flexrow" type="text" name="system.affectedstatus" value="{{data.affectedstatus}}" data-dtype="String">
{{#select data.affectedstatus}}
<option value="health">Health</option>
<option value="delirium">Delirium</option>
<option value="socialhealth">Social Health</option>
<option value="stealthhealth">Stealth Health</option>
<option value="nrg">NRG</option>
{{/select}}
</select>
</li>
{{/if}}
<li class="flexrow"> <label class="generic-label">Affected Specialisations </label></li>
<li class="flexrow">
<ul class="ul-level1">

View File

@ -18,7 +18,7 @@
</label>
</span>
<input type="text" class="padd-right status-small-label no-grow" name="system.secondary.{{key}}.value" value="{{stat2.value}}" data-dtype="Number"/>
<input type="text" class="padd-right status-small-label no-grow" name="system.secondary.{{key}}.bonus" value="{{stat2.bonus}}" data-dtype="Number"/>
<input type="text" class="padd-right status-small-label no-grow" name="system.secondary.{{key}}.bonus" value="{{stat2.bonus}}" data-dtype="Number" disabled/>
<input type="text" class="padd-right status-small-label no-grow" name="system.secondary.{{key}}.max" value="{{stat2.max}}" data-dtype="Number"/>
</li>
{{/each}}
@ -27,7 +27,7 @@
<label class="status-small-label"><strong>{{data.nrg.label}}</strong></label>
</span>
<input type="text" class="padd-right status-small-label no-grow" name="system.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/>
<input type="text" class="padd-right status-small-label no-grow" name="system.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number"/>
<input type="text" class="padd-right status-small-label no-grow" name="system.nrg.mod" value="{{data.nrg.mod}}" data-dtype="Number" disabled/>
<input type="text" class="padd-right status-small-label no-grow" name="system.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/>
<span class="small-label status-small-label">&nbsp;/ {{data.nrg.absolutemax}}</span>
</li>