Sync compendiums
This commit is contained in:
@@ -275,8 +275,8 @@ export class PegasusActor extends Actor {
|
||||
return race[0] ?? [];
|
||||
}
|
||||
getRole() {
|
||||
let role = this.items.filter(item => item.type == 'role')
|
||||
return role[0] ?? [];
|
||||
let role = this.items.find(item => item.type == 'role')
|
||||
return role;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getRoleLevel() {
|
||||
@@ -758,10 +758,11 @@ export class PegasusActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
modifyStun(incDec) {
|
||||
let combat = duplicate(this.system.combat)
|
||||
let myself = this
|
||||
let combat = duplicate(myself.system.combat)
|
||||
combat.stunlevel += incDec
|
||||
if (combat.stunlevel >= 0) {
|
||||
this.update({ 'system.combat': combat })
|
||||
myself.update({ 'system.combat': combat } )
|
||||
let chatData = {
|
||||
user: game.user.id,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
@@ -781,9 +782,9 @@ export class PegasusActor extends Actor {
|
||||
ChatMessage.create({ content: `${this.name} Stun threshold has been exceeded.` })
|
||||
}
|
||||
if (incDec > 0 && stunAbove > 0) {
|
||||
let delirium = duplicate(this.system.secondary.delirium)
|
||||
let delirium = duplicate(myself.system.secondary.delirium)
|
||||
delirium.value -= incDec
|
||||
this.update({ 'system.secondary.delirium': delirium })
|
||||
myself.update({ 'system.secondary.delirium': delirium })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1922,15 +1923,15 @@ export class PegasusActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
addRoleBonus(rollData, statKey, subKey) {
|
||||
let role = this.getRole()
|
||||
if (role.name.toLowerCase() == "ranged" && subKey == "ranged-dmg") {
|
||||
if (role && role.name.toLowerCase() == "ranged" && subKey == "ranged-dmg") {
|
||||
rollData.effectsList.push({ label: "Ranged Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
|
||||
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0, "Ranged Role Bonus"))
|
||||
}
|
||||
if (role.name.toLowerCase() == "defender" && subKey == "defence") {
|
||||
if (role && 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"))
|
||||
}
|
||||
if (role.name.toLowerCase() == "scrapper" && statKey == "com") {
|
||||
if (role && 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"))
|
||||
}
|
||||
@@ -2019,7 +2020,8 @@ export class PegasusActor extends Actor {
|
||||
let rollData = PegasusUtility.getBasicRollData(isInit)
|
||||
rollData.alias = this.name
|
||||
rollData.actorImg = this.img
|
||||
rollData.actorId = this.id
|
||||
rollData.tokenId = this.token?.id
|
||||
rollData.actorId = (this.token) ? this.token.actor.id : this.id
|
||||
rollData.img = this.img
|
||||
rollData.traumaState = this.getTraumaState()
|
||||
rollData.levelRemaining = this.getLevelRemaining()
|
||||
|
||||
Reference in New Issue
Block a user