Sync
This commit is contained in:
parent
0c86b7f694
commit
fb3bde9bc7
@ -979,8 +979,6 @@ export class PegasusActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async computeNRGHealth() {
|
||||
if (this.isToken) return
|
||||
|
||||
if (this.isOwner || game.user.isGM) {
|
||||
let updates = {}
|
||||
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) {
|
||||
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!"} )
|
||||
this.warnMorality = true
|
||||
}
|
||||
@ -1059,8 +1057,7 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
//console.log("UPD", updates, this.data.data.biodata)
|
||||
await this.update(updates)
|
||||
|
||||
this.computeThreatLevel()
|
||||
this.computeThreatLevel()
|
||||
}
|
||||
|
||||
if (this.isOwner || game.user.isGM) {
|
||||
|
@ -502,7 +502,7 @@ export class PegasusUtility {
|
||||
static getTarget() {
|
||||
if (game.user.targets && game.user.targets.size == 1) {
|
||||
for (let target of game.user.targets) {
|
||||
return target;
|
||||
return target
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
@ -514,17 +514,17 @@ export class PegasusUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async updateDefenseState(defenderId, rollId) {
|
||||
this.defenderStore[defenderId] = rollId
|
||||
if (game.user.character && game.user.character.id == defenderId) {
|
||||
let defender = game.actors.get(defenderId);
|
||||
static async updateDefenseState(defenderTokenId, rollId) {
|
||||
this.defenderStore[defenderTokenId] = rollId
|
||||
let defender = game.canvas.tokens.get(defenderTokenId).actor
|
||||
if (game.user.character && game.user.character.id == defender.id) {
|
||||
let chatData = {
|
||||
user: game.user.id,
|
||||
alias: defender.name,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
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).
|
||||
<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 );
|
||||
await ChatMessage.create(chatData);
|
||||
@ -556,7 +556,7 @@ export class PegasusUtility {
|
||||
static async onSocketMesssage(msg) {
|
||||
console.log("SOCKET MESSAGE", msg.name)
|
||||
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") {
|
||||
this.updateRollData(msg.data)
|
||||
@ -583,11 +583,11 @@ export class PegasusUtility {
|
||||
static removeForeignEffect( effectData) {
|
||||
if (game.user.isGM) {
|
||||
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])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static chatDataSetup(content, modeOverride, isRoll = false, forceWhisper) {
|
||||
let chatData = {
|
||||
@ -667,6 +667,7 @@ export class PegasusUtility {
|
||||
let toRem = []
|
||||
for (let effect of rollData.effectsList) {
|
||||
if (effect.effect && effect.effect.data.isUsed && effect.effect.data.oneuse) {
|
||||
effect.defenderTokenId = rollData.defenderTokenId
|
||||
if (effect.foreign) {
|
||||
if (game.user.isGM) {
|
||||
this.removeForeignEffect(effect)
|
||||
@ -935,15 +936,13 @@ export class PegasusUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateWithTarget(rollData) {
|
||||
let objectDefender
|
||||
let target = PegasusUtility.getTarget();
|
||||
let target = PegasusUtility.getTarget()
|
||||
if (target) {
|
||||
let defenderActor = game.actors.get(target.data.actorId)
|
||||
objectDefender = PegasusUtility.data(defenderActor)
|
||||
objectDefender = mergeObject(objectDefender, target.data.actorData)
|
||||
rollData.defender = objectDefender
|
||||
console.log("TARGET ", target)
|
||||
let defenderActor = target.actor
|
||||
rollData.defenderTokenId = target.id
|
||||
rollData.attackerId = this.id
|
||||
rollData.defenderId = objectDefender._id
|
||||
console.log("DEFENDER", defenderActor)
|
||||
defenderActor.addHindrancesList(rollData.effectsList)
|
||||
}
|
||||
}
|
||||
|
@ -183,6 +183,6 @@
|
||||
"templateVersion": 96,
|
||||
"title": "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"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user