Compendiums and small fixes
This commit is contained in:
@ -465,7 +465,7 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
let stunAbove = combat.stunlevel - combat.stunthreshold
|
||||
if (stunAbove > 0) {
|
||||
ChatMessage.create( { content: `${this.name} Stun threshold has been exceeded.`})
|
||||
ChatMessage.create({ content: `${this.name} Stun threshold has been exceeded.` })
|
||||
}
|
||||
if (incDec > 0 && stunAbove > 0) {
|
||||
let delirium = duplicate(this.data.data.secondary.delirium)
|
||||
@ -566,21 +566,21 @@ export class PegasusActor extends Actor {
|
||||
async preprocessItem(event, item, onDrop = false) {
|
||||
|
||||
// Pre-filter effects
|
||||
if (item.data.type == 'effect' ) {
|
||||
if ( this.checkMentalDisruption() && item.data.data.type == "mental" && item.data.data.genre == "positive") {
|
||||
ChatMessage.create( { content: "Effects of this type cannot be applied while Disruption is applied, Use a Soft Action to remove Disruption"})
|
||||
if (item.data.type == 'effect') {
|
||||
if (this.checkMentalDisruption() && item.data.data.type == "mental" && item.data.data.genre == "positive") {
|
||||
ChatMessage.create({ content: "Effects of this type cannot be applied while Disruption is applied, Use a Soft Action to remove Disruption" })
|
||||
return
|
||||
}
|
||||
if ( this.checkPhysicalDisruption() && item.data.data.type == "physical" && item.data.data.genre == "positive") {
|
||||
ChatMessage.create( { content: "Effects of this type cannot be applied while Disruption is applied, Use a Soft Action to remove Disruption"})
|
||||
if (this.checkPhysicalDisruption() && item.data.data.type == "physical" && item.data.data.genre == "positive") {
|
||||
ChatMessage.create({ content: "Effects of this type cannot be applied while Disruption is applied, Use a Soft Action to remove Disruption" })
|
||||
return
|
||||
}
|
||||
if ( this.checkMentalImmunity() && item.data.data.type == "mental" && item.data.data.genre == "negative") {
|
||||
ChatMessage.create( { content: "Effects of this type cannot be applied while Immunity is applied"})
|
||||
if (this.checkMentalImmunity() && item.data.data.type == "mental" && item.data.data.genre == "negative") {
|
||||
ChatMessage.create({ content: "Effects of this type cannot be applied while Immunity is applied" })
|
||||
return
|
||||
}
|
||||
if ( this.checkPhysicalImmunity() && item.data.data.type == "physical" && item.data.data.genre == "negative") {
|
||||
ChatMessage.create( { content: "Effects of this type cannot be applied while Immunity is applied"})
|
||||
if (this.checkPhysicalImmunity() && item.data.data.type == "physical" && item.data.data.genre == "negative") {
|
||||
ChatMessage.create({ content: "Effects of this type cannot be applied while Immunity is applied" })
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -857,15 +857,15 @@ export class PegasusActor extends Actor {
|
||||
if (item) {
|
||||
|
||||
if (item.data.data.status == status) return;// Ensure we are really changing the status
|
||||
if (this.checkNoPerksAllowed() ) {
|
||||
if (this.checkNoPerksAllowed()) {
|
||||
await this.updateEmbeddedDocuments('Item', [{ _id: item.id, 'data.status': "ready" }])
|
||||
ChatMessage.create( {content: "No perks activation allowed due to effect !"})
|
||||
ChatMessage.create({ content: "No perks activation allowed due to effect !" })
|
||||
return
|
||||
}
|
||||
|
||||
// Severe Trauma management
|
||||
if (this.getTraumaState() == "severetrauma") {
|
||||
if ( !this.severeTraumaMessage) {
|
||||
if (!this.severeTraumaMessage) {
|
||||
let chatData = {
|
||||
user: game.user.id,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
@ -1006,7 +1006,7 @@ export class PegasusActor extends Actor {
|
||||
ChatMessage.create({ content: `${this.name} has used a Hero Level to reroll !` })
|
||||
return biodata.currentlevelremaining
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
checkIgnoreHealth() {
|
||||
for (let effect of this.data.items) {
|
||||
@ -1074,11 +1074,11 @@ export class PegasusActor extends Actor {
|
||||
checkIfPossible() {
|
||||
for (let effect of this.data.items) {
|
||||
if (effect.type == "effect" && effect.data.data.isthispossible.length > 0) {
|
||||
ChatMessage.create( { content: effect.data.data.isthispossible} )
|
||||
ChatMessage.create({ content: effect.data.data.isthispossible })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async computeNRGHealth() {
|
||||
if (this.isOwner || game.user.isGM) {
|
||||
@ -1122,8 +1122,8 @@ export class PegasusActor extends Actor {
|
||||
updates['data.nrg.value'] = nrgValue
|
||||
}
|
||||
|
||||
let stunth = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value) + PegasusUtility.getDiceValue(this.data.data.statistics.mnd.value) + PegasusUtility.getDiceValue(this.data.data.statistics.foc.value)
|
||||
+ this.data.data.statistics.mnd.mod + this.data.data.statistics.phy.mod + this.data.data.statistics.foc.mod
|
||||
let stunth = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value) + PegasusUtility.getDiceValue(this.data.data.statistics.mnd.value) + PegasusUtility.getDiceValue(this.data.data.statistics.foc.value)
|
||||
+ this.data.data.statistics.mnd.mod + this.data.data.statistics.phy.mod + this.data.data.statistics.foc.mod
|
||||
if (stunth != this.data.data.combat.stunthreshold) {
|
||||
updates['data.combat.stunthreshold'] = stunth
|
||||
}
|
||||
@ -1144,7 +1144,7 @@ export class PegasusActor extends Actor {
|
||||
if (moralitythreshold != this.data.data.biodata.moralitythreshold) {
|
||||
updates['data.biodata.moralitythreshold'] = moralitythreshold
|
||||
}
|
||||
if ( !this.isToken) {
|
||||
if (!this.isToken) {
|
||||
if (this.warnMorality != this.data.data.biodata.morality && this.data.data.biodata.morality < 0) {
|
||||
console.log("CHAR", this)
|
||||
ChatMessage.create({ content: "WARNING: Your character is dangerously close to becoming corrupted and defeated. Start on a path of redemption!" })
|
||||
@ -1153,7 +1153,7 @@ export class PegasusActor extends Actor {
|
||||
this.warnMorality = this.data.data.biodata.morality
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let race = this.getRace()
|
||||
if (race && race.name && (race.name != this.data.data.biodata.racename)) {
|
||||
updates['data.biodata.racename'] = race.name
|
||||
@ -1171,7 +1171,7 @@ export class PegasusActor extends Actor {
|
||||
if (this.isOwner || game.user.isGM) {
|
||||
// Update current hindrance level
|
||||
let hindrance = this.data.data.combat.hindrancedice
|
||||
if ( !this.checkIgnoreHealth() ) {
|
||||
if (!this.checkIgnoreHealth()) {
|
||||
if (this.data.data.secondary.health.value < 0) {
|
||||
if (this.data.data.secondary.health.value < -Math.floor((this.data.data.secondary.health.max + 1) / 2)) { // Severe wounded
|
||||
hindrance += 3
|
||||
@ -1377,25 +1377,38 @@ export class PegasusActor extends Actor {
|
||||
/* ROLL SECTION
|
||||
/* -------------------------------------------- */
|
||||
|
||||
pushEffect(rollData, effect) {
|
||||
if (this.getTraumaState() == "none" && !this.checkNoBonusDice()) {
|
||||
rollData.effectsList.push({ label: effect.name, type: "effect", applied: false, effect: effect, value: effect.data.effectlevel })
|
||||
} else {
|
||||
if (!effect.data.bonusdice) { // Do not push bonus dice effect when TraumaState is activated
|
||||
rollData.effectsList.push({ label: effect.name, type: "effect", applied: false, effect: effect, value: effect.data.effectlevel })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
addEffects(rollData) {
|
||||
addEffects(rollData, isInit = false, isPower = false, isPowerDmg = false) {
|
||||
let effects = this.data.items.filter(item => item.type == 'effect')
|
||||
for (let effect of effects) {
|
||||
effect = duplicate(effect)
|
||||
if (!effect.data.hindrance
|
||||
&& (effect.data.stataffected != "notapplicable" || effect.data.specaffected.length > 0)
|
||||
&& effect.data.stataffected != "special") {
|
||||
&& effect.data.stataffected != "special"
|
||||
&& effect.data.stataffected != "powerroll"
|
||||
&& effect.data.stataffected != "powerdmgroll") {
|
||||
if (effect.data.effectstatlevel) {
|
||||
effect.data.effectlevel = this.data.data.statistics[effect.data.effectstat].value
|
||||
}
|
||||
if (this.getTraumaState() == "none" && !this.checkNoBonusDice()) {
|
||||
rollData.effectsList.push({ label: effect.name, type: "effect", applied: false, effect: effect, value: effect.data.effectlevel })
|
||||
} else {
|
||||
if (!effect.data.bonusdice) { // Do not push bonus dice effect when TraumaState is activated
|
||||
rollData.effectsList.push({ label: effect.name, type: "effect", applied: false, effect: effect, value: effect.data.effectlevel })
|
||||
}
|
||||
}
|
||||
this.pushEffect(rollData, effect)
|
||||
}
|
||||
if (isPower && effect.data.stataffected == "powerroll") {
|
||||
this.pushEffect(rollData, effect)
|
||||
}
|
||||
if (isPowerDmg && effect.data.stataffected == "powerdmgroll") {
|
||||
this.pushEffect(rollData, effect)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1420,6 +1433,9 @@ export class PegasusActor extends Actor {
|
||||
if (weapon.data.equipped && weapon.data.statistic == statKey) {
|
||||
rollData.weaponsList.push({ label: `Attack ${weapon.name}`, type: "attack", applied: false, weapon: weapon, value: 0, damageDice: PegasusUtility.getDiceFromLevel(0) })
|
||||
}
|
||||
if (weapon.data.equipped && weapon.data.canbethrown && statKey == "agi" ) {
|
||||
rollData.weaponsList.push({ label: `Attack ${weapon.name}`, type: "attack", applied: false, weapon: weapon, value: 0, damageDice: PegasusUtility.getDiceFromLevel(0) })
|
||||
}
|
||||
if (weapon.data.equipped && weapon.data.enhanced && weapon.data.enhancedstat == statKey) {
|
||||
rollData.weaponsList.push({ label: `Enhanced Attack ${weapon.name}`, type: "enhanced", applied: false, weapon: weapon, value: weapon.data.enhancedlevel, damageDice: PegasusUtility.getDiceFromLevel(weapon.data.enhancedlevel) })
|
||||
}
|
||||
@ -1438,7 +1454,7 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getCommonRollData(statKey = undefined, useShield = false, isInit = false) {
|
||||
getCommonRollData(statKey = undefined, useShield = false, isInit = false, isPower = false, isPowerDmg = false) {
|
||||
let rollData = PegasusUtility.getBasicRollData(isInit)
|
||||
rollData.alias = this.name
|
||||
rollData.actorImg = this.img
|
||||
@ -1477,7 +1493,7 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
this.addEffects(rollData, isInit)
|
||||
this.addEffects(rollData, isInit, isPower, isPowerDmg)
|
||||
this.addArmorsShields(rollData, statKey, useShield)
|
||||
this.addWeapons(rollData, statKey, useShield)
|
||||
this.addEquipments(rollData, statKey)
|
||||
@ -1526,7 +1542,7 @@ export class PegasusActor extends Actor {
|
||||
rollPool(statKey, useShield = false, subKey = "none") {
|
||||
let stat = this.getStat(statKey)
|
||||
if (stat) {
|
||||
let rollData = this.getCommonRollData(statKey, useShield)
|
||||
let rollData = this.getCommonRollData(statKey, useShield, false, false, subKey == "power-dmg")
|
||||
rollData.mode = "stat"
|
||||
rollData.subKey = subKey
|
||||
let def = stat.label
|
||||
@ -1643,7 +1659,7 @@ export class PegasusActor extends Actor {
|
||||
|
||||
if (power) {
|
||||
power = duplicate(power)
|
||||
let rollData = this.getCommonRollData(power.data.statistic)
|
||||
let rollData = this.getCommonRollData(power.data.statistic, false, false, true, false)
|
||||
|
||||
rollData.mode = "power"
|
||||
rollData.power = power
|
||||
|
Reference in New Issue
Block a user