From 64ef6e3c67cb1f0ccae040ddc9aee9ef6cc6a667 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Wed, 17 Feb 2021 22:38:12 +0100 Subject: [PATCH] Add items --- module/actor.js | 12 ++++++++---- module/sos-combat.js | 13 +++++++++++-- module/sos-dialog-combat-actions.js | 5 +---- module/sos-utility.js | 9 +++------ 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/module/actor.js b/module/actor.js index 1a4ca12..ab284c5 100644 --- a/module/actor.js +++ b/module/actor.js @@ -229,7 +229,8 @@ export class SoSActor extends Actor { consequencesList: duplicate( this.getApplicableConsequences() ), wounds: duplicate( this.data.data.wounds), malusConsequence: 0, - bonusConsequence: 0 + bonusConsequence: 0, + woundMalus: 0 } let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/dialog-flip.html', flipData); new SoSFlipDialog(flipData, html).render(true); @@ -248,7 +249,8 @@ export class SoSActor extends Actor { modifierList: SoSUtility.fillRange(-10, +10), tnList: SoSUtility.fillRange(6, 20), malusConsequence: 0, - bonusConsequence: 0 + bonusConsequence: 0, + woundMalus: 0 } flipData.statList['nostat'] = { label: "No stat (ie defaulting skills)", value: 0, cardsuit: "none" } let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/dialog-flip.html', flipData); @@ -282,7 +284,9 @@ export class SoSActor extends Actor { actor: this, modifierList: SoSUtility.fillRange(-10, +10), tnList: SoSUtility.fillRange(6, 20), - malusConsequence: 0 + malusConsequence: 0, + bonusConsequence: 0, + woundMalus: 0 } console.log(flipData); @@ -336,7 +340,7 @@ export class SoSActor extends Actor { totalWounds: this.data.data.scores.wound.value } let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-damage-consequence.html', woundData ); - ChatMessage.create( { content: html, whisper: [ChatMessage.getWhisperRecipients(this.name), ChatMessage.getWhisperRecipients("GM") ] } ); + ChatMessage.create( { content: html, whisper: ChatMessage.getWhisperRecipients(this.name).concat(ChatMessage.getWhisperRecipients("GM")) } ); this.checkDeath(); } diff --git a/module/sos-combat.js b/module/sos-combat.js index 0f4686a..51ec277 100644 --- a/module/sos-combat.js +++ b/module/sos-combat.js @@ -97,13 +97,17 @@ export class SoSCombat extends Combat { if (game.user.isGM ) { for( let combatant of this.combatants) { let bleeding = combatant.actor.data.items.find( item => item.type == 'consequence' && item.name == 'Bleeding'); - combatant.actor.applyConsequenceWound( bleeding.severity, "bleeding" ); + combatant.actor.applyConsequenceWound( bleeding.data.severity, "bleeding" ); } } } /* -------------------------------------------- */ closeAction( uniqId) { + // Delete message ! + const toDelete = game.messages.filter(it => it.data.content.includes( uniqId )); + toDelete.forEach(it => it.delete()); + let action = this.currentActions.find( _action => _action.uniqId == uniqId ); if (action) { action.isDone = true; @@ -153,7 +157,12 @@ export class SoSCombat extends Combat { /* -------------------------------------------- */ async setupActorActions(actionConf) { - console.log("Setting combat for phase : ", actionConf); + console.log("Setting combat for phase : ", actionConf, actionConf.uniqId); + + // Delete message ! + const toDelete = game.messages.filter(it => it.data.content.includes( actionConf.uniqId )); + console.log("MESSAGE : ", toDelete); + toDelete.forEach(it => it.delete()); if ( !this.phaseSetup) this.phaseSetup = {}; // Opportunistic init diff --git a/module/sos-dialog-combat-actions.js b/module/sos-dialog-combat-actions.js index b0c0d16..3fba332 100644 --- a/module/sos-dialog-combat-actions.js +++ b/module/sos-dialog-combat-actions.js @@ -77,12 +77,9 @@ export class SoSDialogCombatActions extends Dialog { let combat = game.combats.get( this.combatActions.combatId ); // Get the associated combat combat.setupActorActions( msgdata ); } else { - game.socket.emit("system.foundryvtt-reve-de-dragon", { + game.socket.emit("system.foundryvtt-shadows-over-sol", { name: "msg_declare_actions", data: msgdata } ); } - // Delete message ! - const toDelete = game.messages.filter(it => it.data.content.includes( this.combatActions.uniqId )); - toDelete.forEach(it => it.delete()); } else { ui.notifications.warn("Action Points are below 0 ! Please check your phases !"); } diff --git a/module/sos-utility.js b/module/sos-utility.js index 2f7c36a..4e1c302 100644 --- a/module/sos-utility.js +++ b/module/sos-utility.js @@ -36,7 +36,7 @@ export class SoSUtility extends Entity { } /* -------------------------------------------- */ - onSocketMesssage( msg ) { + static onSocketMesssage( msg ) { if( !game.user.isGM ) return; // Only GM if (msg.name == 'msg_declare_actions' ) { @@ -120,10 +120,7 @@ export class SoSUtility extends Entity { /* -------------------------------------------- */ static closeAction(event) { let uniqId = event.currentTarget.attributes['data-uniq-id'].value; - // Delete message ! - const toDelete = game.messages.filter(it => it.data.content.includes( uniqId )); - toDelete.forEach(it => it.delete()); - + if ( game.user.isGM ) { game.combat.closeAction( uniqId ); } else { @@ -294,7 +291,7 @@ export class SoSUtility extends Entity { flipData.uniqId = randomID(16); this.registry[flipData.uniqId] = flipData; let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-damage-request-dodge.html', flipData ); - ChatMessage.create( { content: html, whisper: [ChatMessage.getWhisperRecipients(flipData.target.actor.name), ChatMessage.getWhisperRecipients("GM") ] } ); + ChatMessage.create( { content: html, whisper: ChatMessage.getWhisperRecipients(flipData.target.actor.name).concat(ChatMessage.getWhisperRecipients("GM")) } ); return; // Wait message response } }