Minor various fixes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user