Sync
This commit is contained in:
parent
0c86b7f694
commit
fb3bde9bc7
@ -979,8 +979,6 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async computeNRGHealth() {
|
async computeNRGHealth() {
|
||||||
if (this.isToken) return
|
|
||||||
|
|
||||||
if (this.isOwner || game.user.isGM) {
|
if (this.isOwner || game.user.isGM) {
|
||||||
let updates = {}
|
let updates = {}
|
||||||
let phyDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value) + this.data.data.secondary.health.bonus + this.data.data.statistics.phy.mod;
|
let phyDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value) + this.data.data.secondary.health.bonus + this.data.data.statistics.phy.mod;
|
||||||
@ -1044,7 +1042,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (moralitythreshold != this.data.data.biodata.moralitythreshold) {
|
if (moralitythreshold != this.data.data.biodata.moralitythreshold) {
|
||||||
updates['data.biodata.moralitythreshold'] = moralitythreshold
|
updates['data.biodata.moralitythreshold'] = moralitythreshold
|
||||||
}
|
}
|
||||||
if (!this.warnMorality && this.data.data.biodata.morality >= moralitythreshold-2) {
|
if (!this.warnMorality && this.data.data.biodata.morality <= moralitythreshold-2) {
|
||||||
ChatMessage.create( {content: "WARNING: Your character is dangerously close to becoming corrupted and defeated. Start on a path of redemption!"} )
|
ChatMessage.create( {content: "WARNING: Your character is dangerously close to becoming corrupted and defeated. Start on a path of redemption!"} )
|
||||||
this.warnMorality = true
|
this.warnMorality = true
|
||||||
}
|
}
|
||||||
@ -1059,8 +1057,7 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
//console.log("UPD", updates, this.data.data.biodata)
|
//console.log("UPD", updates, this.data.data.biodata)
|
||||||
await this.update(updates)
|
await this.update(updates)
|
||||||
|
this.computeThreatLevel()
|
||||||
this.computeThreatLevel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isOwner || game.user.isGM) {
|
if (this.isOwner || game.user.isGM) {
|
||||||
|
@ -502,7 +502,7 @@ export class PegasusUtility {
|
|||||||
static getTarget() {
|
static getTarget() {
|
||||||
if (game.user.targets && game.user.targets.size == 1) {
|
if (game.user.targets && game.user.targets.size == 1) {
|
||||||
for (let target of game.user.targets) {
|
for (let target of game.user.targets) {
|
||||||
return target;
|
return target
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
@ -514,17 +514,17 @@ export class PegasusUtility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async updateDefenseState(defenderId, rollId) {
|
static async updateDefenseState(defenderTokenId, rollId) {
|
||||||
this.defenderStore[defenderId] = rollId
|
this.defenderStore[defenderTokenId] = rollId
|
||||||
if (game.user.character && game.user.character.id == defenderId) {
|
let defender = game.canvas.tokens.get(defenderTokenId).actor
|
||||||
let defender = game.actors.get(defenderId);
|
if (game.user.character && game.user.character.id == defender.id) {
|
||||||
let chatData = {
|
let chatData = {
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
alias: defender.name,
|
alias: defender.name,
|
||||||
rollMode: game.settings.get("core", "rollMode"),
|
rollMode: game.settings.get("core", "rollMode"),
|
||||||
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||||
content: `<div>${defender.name} is under attack. He must roll a skill/weapon/technique to defend himself or suffer damages (button below).
|
content: `<div>${defender.name} is under attack. He must roll a skill/weapon/technique to defend himself or suffer damages (button below).
|
||||||
<button class="chat-card-button apply-nodefense" data-actor-id="${defenderId}" data-roll-id="${rollId}" >No defense</button></div`
|
<button class="chat-card-button apply-nodefense" data-actor-id="${defender.id}" data-roll-id="${rollId}" >No defense</button></div`
|
||||||
};
|
};
|
||||||
//console.log("Apply damage chat", chatData );
|
//console.log("Apply damage chat", chatData );
|
||||||
await ChatMessage.create(chatData);
|
await ChatMessage.create(chatData);
|
||||||
@ -556,7 +556,7 @@ export class PegasusUtility {
|
|||||||
static async onSocketMesssage(msg) {
|
static async onSocketMesssage(msg) {
|
||||||
console.log("SOCKET MESSAGE", msg.name)
|
console.log("SOCKET MESSAGE", msg.name)
|
||||||
if (msg.name == "msg_update_defense_state") {
|
if (msg.name == "msg_update_defense_state") {
|
||||||
this.updateDefenseState(msg.data.defenderId, msg.data.rollId)
|
this.updateDefenseState(msg.data.defenderTokenId, msg.data.rollId)
|
||||||
}
|
}
|
||||||
if (msg.name == "msg_update_roll") {
|
if (msg.name == "msg_update_roll") {
|
||||||
this.updateRollData(msg.data)
|
this.updateRollData(msg.data)
|
||||||
@ -583,11 +583,11 @@ export class PegasusUtility {
|
|||||||
static removeForeignEffect( effectData) {
|
static removeForeignEffect( effectData) {
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
console.log("Remote removal of effects", effectData)
|
console.log("Remote removal of effects", effectData)
|
||||||
let actor = game.actors.get(effectData.actorId)
|
let actor = game.canvas.tokens.get(effectData.defenderTokenId).actor
|
||||||
actor.deleteEmbeddedDocuments('Item', [effectData.effect._id])
|
actor.deleteEmbeddedDocuments('Item', [effectData.effect._id])
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static chatDataSetup(content, modeOverride, isRoll = false, forceWhisper) {
|
static chatDataSetup(content, modeOverride, isRoll = false, forceWhisper) {
|
||||||
let chatData = {
|
let chatData = {
|
||||||
@ -667,6 +667,7 @@ export class PegasusUtility {
|
|||||||
let toRem = []
|
let toRem = []
|
||||||
for (let effect of rollData.effectsList) {
|
for (let effect of rollData.effectsList) {
|
||||||
if (effect.effect && effect.effect.data.isUsed && effect.effect.data.oneuse) {
|
if (effect.effect && effect.effect.data.isUsed && effect.effect.data.oneuse) {
|
||||||
|
effect.defenderTokenId = rollData.defenderTokenId
|
||||||
if (effect.foreign) {
|
if (effect.foreign) {
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
this.removeForeignEffect(effect)
|
this.removeForeignEffect(effect)
|
||||||
@ -935,15 +936,13 @@ export class PegasusUtility {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static updateWithTarget(rollData) {
|
static updateWithTarget(rollData) {
|
||||||
let objectDefender
|
let target = PegasusUtility.getTarget()
|
||||||
let target = PegasusUtility.getTarget();
|
|
||||||
if (target) {
|
if (target) {
|
||||||
let defenderActor = game.actors.get(target.data.actorId)
|
console.log("TARGET ", target)
|
||||||
objectDefender = PegasusUtility.data(defenderActor)
|
let defenderActor = target.actor
|
||||||
objectDefender = mergeObject(objectDefender, target.data.actorData)
|
rollData.defenderTokenId = target.id
|
||||||
rollData.defender = objectDefender
|
|
||||||
rollData.attackerId = this.id
|
rollData.attackerId = this.id
|
||||||
rollData.defenderId = objectDefender._id
|
console.log("DEFENDER", defenderActor)
|
||||||
defenderActor.addHindrancesList(rollData.effectsList)
|
defenderActor.addHindrancesList(rollData.effectsList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,6 +183,6 @@
|
|||||||
"templateVersion": 96,
|
"templateVersion": 96,
|
||||||
"title": "Pegasus RPG",
|
"title": "Pegasus RPG",
|
||||||
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
||||||
"version": "0.6.4",
|
"version": "0.6.5",
|
||||||
"background" : "./images/ui/pegasus_welcome_page.webp"
|
"background" : "./images/ui/pegasus_welcome_page.webp"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user