Minor various fixes
This commit is contained in:
parent
7755d87e48
commit
9e70a12b98
@ -137,12 +137,12 @@ export class PegasusActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
getMT() {
|
||||
let modifier = 0
|
||||
for(let effect of this.items) {
|
||||
if (effect.type =="effect" && effect.system.affectstatus && effect.system.affectedstatus =="mt") {
|
||||
if ( effect.system.genre == "positive") {
|
||||
for (let effect of this.items) {
|
||||
if (effect.type == "effect" && effect.system.affectstatus && effect.system.affectedstatus == "mt") {
|
||||
if (effect.system.genre == "positive") {
|
||||
modifier += effect.system.effectlevel
|
||||
}
|
||||
if ( effect.system.genre == "negative") {
|
||||
if (effect.system.genre == "negative") {
|
||||
modifier -= effect.system.effectlevel
|
||||
}
|
||||
}
|
||||
@ -153,12 +153,12 @@ export class PegasusActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
getKBV() {
|
||||
let modifier = 0
|
||||
for(let effect of this.items) {
|
||||
if (effect.type =="effect" && effect.system.affectstatus && effect.system.affectedstatus == "kbv") {
|
||||
if ( effect.system.genre == "positive") {
|
||||
for (let effect of this.items) {
|
||||
if (effect.type == "effect" && effect.system.affectstatus && effect.system.affectedstatus == "kbv") {
|
||||
if (effect.system.genre == "positive") {
|
||||
modifier += effect.system.effectlevel
|
||||
}
|
||||
if ( effect.system.genre == "negative") {
|
||||
if (effect.system.genre == "negative") {
|
||||
modifier -= effect.system.effectlevel
|
||||
}
|
||||
}
|
||||
@ -509,28 +509,28 @@ export class PegasusActor extends Actor {
|
||||
let update = { _id: item.id, "system.activated": !item.system.activated }
|
||||
await this.updateEmbeddedDocuments('Item', [update]) // Updates one EmbeddedEntity
|
||||
}
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
setHandInformation( info) {
|
||||
this.update( {'system.biodata.preferredhand': info} )
|
||||
setHandInformation(info) {
|
||||
this.update({ 'system.biodata.preferredhand': info })
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
increaseRoleAbility() {
|
||||
let role = this.getRole()
|
||||
let level = role.system.rolelevel + 1
|
||||
this.updateEmbeddedDocuments('Item', [ {_id: role.id, 'system.rolelevel': level} ])
|
||||
this.updateEmbeddedDocuments('Item', [{ _id: role.id, 'system.rolelevel': level }])
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
setBonusInformation( info) {
|
||||
this.update( {'system.biodata.bonusselection': info})
|
||||
setBonusInformation(info) {
|
||||
this.update({ 'system.biodata.bonusselection': info })
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
addCDP( value) {
|
||||
addCDP(value) {
|
||||
let cdp = this.system.biodata.cdp
|
||||
cdp += value
|
||||
this.update( {'system.biodata.cdp': cdp})
|
||||
this.update({ 'system.biodata.cdp': cdp })
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -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,9 +1699,15 @@ export class PegasusActor extends Actor {
|
||||
ability.system = ability.data
|
||||
}
|
||||
if (ability.system.affectedstat != "notapplicable") {
|
||||
let stat = duplicate(this.system.statistics[ability.system.affectedstat])
|
||||
stat.mod += Number(ability.system.statmodifier)
|
||||
updates[`system.statistics.${ability.system.affectedstat}`] = stat
|
||||
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") {
|
||||
@ -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)
|
||||
@ -1896,11 +1913,11 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
if (role.name.toLowerCase() == "defender" && subKey == "defence") {
|
||||
rollData.effectsList.push({ label: "Defender Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
|
||||
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0,"Defender Role Bonus"))
|
||||
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0, "Defender Role Bonus"))
|
||||
}
|
||||
if (role.name.toLowerCase() == "scrapper" && statKey == "com") {
|
||||
rollData.effectsList.push({ label: "Scrapper Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
|
||||
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0,"Scrapper Role Bonus"))
|
||||
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0, "Scrapper Role Bonus"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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