Minor various fixes
This commit is contained in:
parent
7755d87e48
commit
9e70a12b98
@ -904,11 +904,11 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
if (item.type == 'race') {
|
||||
if (item.type == "race") {
|
||||
this.applyRace(item)
|
||||
} else if (item.type == 'role') {
|
||||
} else if (item.type == "role") {
|
||||
this.applyRole(item)
|
||||
} else if (item.type == 'ability') {
|
||||
} else if (item.type == "ability") {
|
||||
this.applyAbility(item, [], true)
|
||||
if (!onDrop) {
|
||||
await this.createEmbeddedDocuments('Item', [item])
|
||||
@ -1311,7 +1311,8 @@ export class PegasusActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async deleteAllItemsByType(itemType) {
|
||||
let items = this.items.filter(item => item.type == itemType);
|
||||
let items = this.items.filter(item => item.type == itemType).map(item => item.id)
|
||||
console.log("Dele....", items)
|
||||
await this.deleteEmbeddedDocuments('Item', items);
|
||||
}
|
||||
|
||||
@ -1493,10 +1494,8 @@ export class PegasusActor extends Actor {
|
||||
updates['system.biodata.moralitythreshold'] = moralitythreshold
|
||||
}
|
||||
if (!this.isToken) {
|
||||
if (this.warnMorality != this.system.biodata.morality && this.system.biodata.morality < 0) {
|
||||
if (this.warnMorality != this.system.biodata.morality && this.system.biodata.morality <= 0) {
|
||||
ChatMessage.create({ content: "WARNING: Your character is dangerously close to becoming corrupted and defeated. Start on a path of redemption!" })
|
||||
}
|
||||
if (this.warnMorality != this.system.biodata.morality && this.system.biodata.morality == 0) {
|
||||
ChatMessage.create({ content: "This character can no longer spend CDP until their Morality has reached 1 or higher" })
|
||||
}
|
||||
if (this.warnMorality != this.system.biodata.morality) {
|
||||
@ -1533,8 +1532,8 @@ export class PegasusActor extends Actor {
|
||||
this.system.combat.hindrancedice = hindrance
|
||||
this.getTraumaState()
|
||||
this.cleanupPerksIfTrauma()
|
||||
this.parseStatEffects()
|
||||
this.parseStatusEffects()
|
||||
await this.parseStatEffects()
|
||||
await this.parseStatusEffects()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1570,11 +1569,13 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
parseStatusEffects() {
|
||||
async parseStatusEffects() {
|
||||
if (this.system.biodata.noautobonus) { // If we are in "no-bonus mode
|
||||
return
|
||||
}
|
||||
let effects = this.items.filter(effect => effect.type == "effect" && effect.system.affectstatus && (Number(effect.system.effectlevel) > 0))
|
||||
let abilities = this.items.filter(ability => ability.type == "ability" && ability.system.statusaffected != "notapplicable")
|
||||
|
||||
for (let statusKey in this.system.secondary) {
|
||||
let status = duplicate(this.system.secondary[statusKey])
|
||||
let bonus = 0
|
||||
@ -1583,12 +1584,18 @@ export class PegasusActor extends Actor {
|
||||
bonus += Number(effect.system.effectlevel)
|
||||
}
|
||||
}
|
||||
for (let ability of abilities) {
|
||||
if (ability.system.statusaffected && ability.system.statusaffected == statusKey) {
|
||||
bonus += Number(effect.system.statusmodifier)
|
||||
}
|
||||
}
|
||||
if (bonus != status.bonus) {
|
||||
status.bonus = bonus
|
||||
this.update({ [`system.secondary.${statusKey}`]: status })
|
||||
await this.update({ [`system.secondary.${statusKey}`]: status })
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Ablities", this.name, abilities)
|
||||
let nrg = duplicate(this.system.nrg)
|
||||
let bonus = 0
|
||||
for (let effect of effects) {
|
||||
@ -1596,11 +1603,15 @@ export class PegasusActor extends Actor {
|
||||
bonus += Number(effect.system.effectlevel)
|
||||
}
|
||||
}
|
||||
for (let ability of abilities) {
|
||||
if (ability.system.statusaffected && ability.system.statusaffected == "nrg") {
|
||||
bonus += Number(ability.system.statusmodifier)
|
||||
}
|
||||
}
|
||||
if (bonus != nrg.mod) {
|
||||
nrg.mod = bonus
|
||||
this.update({ [`system.nrg`]: nrg })
|
||||
await this.update({ [`system.nrg`]: nrg })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -1688,10 +1699,16 @@ export class PegasusActor extends Actor {
|
||||
ability.system = ability.data
|
||||
}
|
||||
if (ability.system.affectedstat != "notapplicable") {
|
||||
if ( ability.system.affectedstat == "mr") {
|
||||
let stat = duplicate(this.system.mr)
|
||||
stat.mod += Number(ability.system.statmodifier)
|
||||
updates[`system.mr`] = stat
|
||||
} else {
|
||||
let stat = duplicate(this.system.statistics[ability.system.affectedstat])
|
||||
stat.mod += Number(ability.system.statmodifier)
|
||||
updates[`system.statistics.${ability.system.affectedstat}`] = stat
|
||||
}
|
||||
}
|
||||
// manage status bonus
|
||||
if (ability.system.statusaffected != "notapplicable") {
|
||||
if (ability.system.statusaffected == 'nrg') {
|
||||
@ -1751,11 +1768,11 @@ export class PegasusActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async applyRace(race) {
|
||||
let updates = { 'system.biodata.racename': race.name }
|
||||
updates['system.biodata.sizenum'] = race.system.size
|
||||
let newItems = []
|
||||
await this.deleteAllItemsByType('race')
|
||||
newItems.push(race);
|
||||
await this.deleteAllItemsByType("race")
|
||||
newItems.push(race)
|
||||
|
||||
console.log("DROPPED RACE", race)
|
||||
for (let ability of race.system.abilities) {
|
||||
if (!ability.system) ability.system = ability.data
|
||||
newItems.push(ability)
|
||||
|
@ -580,7 +580,7 @@ export class PegasusActorCreate {
|
||||
/* -------------------------------------------- */
|
||||
async showGlobalSpec() {
|
||||
let formData = this.createFormData("select-global-spec")
|
||||
let excludedSpecs = this.actor.items.filter(it => it.type == "specialisation" && it.system.level >= 4)
|
||||
let excludedSpecs = this.actor.items.filter(it => it.type == "specialisation" && it.system.level >= 5)
|
||||
formData.specs = []
|
||||
for (let spec of this.specs) {
|
||||
let isOK = true
|
||||
|
@ -446,6 +446,7 @@
|
||||
"perksgained": false,
|
||||
"perksall": false,
|
||||
"perksnumber": 0,
|
||||
"size": 0,
|
||||
"perks": [],
|
||||
"perksrole": "",
|
||||
"statistics": ""
|
||||
|
@ -16,25 +16,25 @@
|
||||
<div class="tab details" data-group="primary" data-tab="details">
|
||||
<ul>
|
||||
<li class="flexrow"><label class="generic-label">Affected stat</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.affectedstat" value="{{data.affectedstat}}" data-dtype="String">
|
||||
<select class="competence-base flexrow" type="text" name="system.affectedstat" value="{{data.affectedstat}}" data-dtype="String">
|
||||
{{#select data.affectedstat}}
|
||||
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true mr=false}}
|
||||
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true mr=true}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">Stat modifier</label>
|
||||
<input type="text" class="padd-right" name="data.statmodifier" value="{{data.statmodifier}}" data-dtype="Number"/>
|
||||
<input type="text" class="padd-right" name="system.statmodifier" value="{{data.statmodifier}}" data-dtype="Number"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Affected status</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.statusaffected" value="{{data.statusaffected}}" data-dtype="String">
|
||||
<select class="competence-base flexrow" type="text" name="system.statusaffected" value="{{data.statusaffected}}" data-dtype="String">
|
||||
{{#select data.statusaffected}}
|
||||
{{{optionsStatusList}}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">Status modifier</label>
|
||||
<input type="text" class="padd-right" name="data.statusmodifier" value="{{data.statusmodifier}}" data-dtype="Number"/>
|
||||
<input type="text" class="padd-right" name="system.statusmodifier" value="{{data.statusmodifier}}" data-dtype="Number"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Effects Gained</label>
|
||||
@ -45,7 +45,7 @@
|
||||
</li>
|
||||
{{#each data.effectsgained as |effect idx|}}
|
||||
<li class="flexrow">
|
||||
<label name="data.effectsgained[{{idx}}].name"><a class="view-subitem" data-type="effectsgained" data-index="{{idx}}">{{effect.name}}</a></label>
|
||||
<label name="system.effectsgained[{{idx}}].name"><a class="view-subitem" data-type="effectsgained" data-index="{{idx}}">{{effect.name}}</a></label>
|
||||
<div class="item-controls padd-left">
|
||||
<a class="item-control delete-subitem padd-left" data-type="effectsgained" data-index="{{idx}}" title="Delete Effect"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
@ -62,7 +62,7 @@
|
||||
</li>
|
||||
{{#each data.powersgained as |power idx|}}
|
||||
<li class="flexrow">
|
||||
<label name="data.powersgained[{{idx}}].name"><a class="view-subitem" data-type="powersgained" data-index="{{idx}}">{{power.name}}</a></label>
|
||||
<label name="system.powersgained[{{idx}}].name"><a class="view-subitem" data-type="powersgained" data-index="{{idx}}">{{power.name}}</a></label>
|
||||
<div class="item-controls padd-left">
|
||||
<a class="item-control delete-subitem padd-left" data-type="powersgained" data-index="{{idx}}" title="Delete Power"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
@ -78,7 +78,7 @@
|
||||
</li>
|
||||
{{#each data.specialisations as |spec idx|}}
|
||||
<li class="flexrow">
|
||||
<label name="data.specialisations[{{idx}}].name"><a class="view-subitem" data-type="specialisations" data-index="{{idx}}">{{spec.name}}</a></label>
|
||||
<label name="system.specialisations[{{idx}}].name"><a class="view-subitem" data-type="specialisations" data-index="{{idx}}">{{spec.name}}</a></label>
|
||||
<div class="item-controls padd-left">
|
||||
<a class="item-control delete-subitem padd-left" data-type="specialisations" data-index="{{idx}}" title="Delete Specialisation"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
@ -89,7 +89,7 @@
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Threat Level Value</label>
|
||||
<input type="text" class="input-numeric-short padd-right" name="data.threatlevel" value="{{data.threatlevel}}" data-dtype="Number"/>
|
||||
<input type="text" class="input-numeric-short padd-right" name="system.threatlevel" value="{{data.threatlevel}}" data-dtype="Number"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Attacks Gained</label>
|
||||
@ -99,7 +99,7 @@
|
||||
</li>
|
||||
{{#each data.attackgained as |weapon idx|}}
|
||||
<li class="flexrow">
|
||||
<label name="data.specialisations[{{idx}}].name"><a class="view-subitem" data-type="attackgained" data-index="{{idx}}">{{weapon.name}}</a></label>
|
||||
<label name="system.specialisations[{{idx}}].name"><a class="view-subitem" data-type="attackgained" data-index="{{idx}}">{{weapon.name}}</a></label>
|
||||
<div class="item-controls padd-left">
|
||||
<a class="item-control delete-subitem padd-left" data-type="attackgained" data-index="{{idx}}" title="Delete Weapon"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
@ -116,7 +116,7 @@
|
||||
</li>
|
||||
{{#each data.armorgained as |armor idx|}}
|
||||
<li class="flexrow">
|
||||
<label name="data.specialisations[{{idx}}].name"><a class="view-subitem" data-type="armorgained" data-index="{{idx}}">{{armor.name}}</a></label>
|
||||
<label name="dasystema.specialisations[{{idx}}].name"><a class="view-subitem" data-type="armorgained" data-index="{{idx}}">{{armor.name}}</a></label>
|
||||
<div class="item-controls padd-left">
|
||||
<a class="item-control delete-subitem padd-left" data-type="armorgained" data-index="{{idx}}" title="Delete Armor"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
|
@ -14,19 +14,19 @@
|
||||
|
||||
<label class="generic-label">Description</label>
|
||||
<div class="medium-editor item-text-long-line">
|
||||
{{editor data.description target="data.description" button=true owner=owner editable=editable}}
|
||||
{{editor description target="system.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
<label class="generic-label">Environment</label>
|
||||
<div class="medium-editor item-text-long-line">
|
||||
{{editor data.environment target="data.environment" button=true owner=owner editable=editable}}
|
||||
{{editor data.environment target="system.environment" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
<label class="generic-label">Society/Culture</label>
|
||||
<div class="medium-editor item-text-long-line">
|
||||
{{editor data.society_culture target="data.society_culture" button=true owner=owner editable=editable}}
|
||||
{{editor data.society_culture target="system.society_culture" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
<label class="generic-label">Outlook</label>
|
||||
<div class="medium-editor item-text-long-line">
|
||||
{{editor data.outlook target="data.outlook" button=true owner=owner editable=editable}}
|
||||
{{editor data.outlook target="system.outlook" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -52,6 +52,10 @@
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
<li class="flexrow">
|
||||
<label class="generic-label">Size</label>
|
||||
<input type="text" class="input-numeric-short padd-right" name="system.size" value="{{data.size}}" data-dtype="Number"/>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">Selectable Stats ?</label>
|
||||
<label class="attribute-value checkbox"><input type="checkbox" name="system.selectablestats" {{checked
|
||||
system.selectablestats}} /></label>
|
||||
|
Loading…
Reference in New Issue
Block a user