Managedeletion

This commit is contained in:
2022-07-30 22:44:44 +02:00
parent a4abedd4b3
commit 74a2b434c7
3 changed files with 20 additions and 12 deletions

View File

@ -836,13 +836,16 @@ export class PegasusActor extends Actor {
// Severe Trauma management
if (this.getTraumaState() == "severetrauma") {
let chatData = {
user: game.user.id,
rollMode: game.settings.get("core", "rollMode"),
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM'))
if ( !this.severeTraumaMessage) {
let chatData = {
user: game.user.id,
rollMode: game.settings.get("core", "rollMode"),
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM'))
}
chatData.content = `<div>${this.name} is suffering from Severe Trauma and cannot use Perks at this time.</div`
ChatMessage.create(chatData)
this.severeTraumaMessage = true
}
chatData.content = `<div>${this.name} is suffering from Severe Trauma and cannot use Perks at this time.</div`
ChatMessage.create(chatData)
this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'data.status': "ready", 'data.used1': false, 'data.used2': false, 'data.used3': false }])
return
}
@ -1040,11 +1043,16 @@ export class PegasusActor extends Actor {
if (moralitythreshold != this.data.data.biodata.moralitythreshold) {
updates['data.biodata.moralitythreshold'] = moralitythreshold
}
if (!this.warnMorality && this.data.data.biodata.morality < 0) {
ChatMessage.create({ content: "WARNING: Your character is dangerously close to becoming corrupted and defeated. Start on a path of redemption!" })
this.warnMorality = true
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!" })
}
if (this.warnMorality != this.data.data.biodata.morality) {
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