diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 30e89cf..1436aaf 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -14,7 +14,7 @@ export class SoSActorSheet extends ActorSheet { classes: ["sos", "sheet", "actor"], template: "systems/foundryvtt-shadows-over-sol/templates/actor-sheet.html", width: 640, - //height: 720, + height: 720, tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "stats" }], dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }], editStatSkill: false @@ -40,6 +40,10 @@ export class SoSActorSheet extends ActorSheet { data.data.weapons = this.actor.data.items.filter( item => item.type == 'weapon'); data.data.armors = this.actor.data.items.filter( item => item.type == 'armor'); data.data.totalEncumbrance = SoSUtility.computeEncumbrance(this.actor.data.items); + data.data.wounds = duplicate(this.actor.data.data.wounds); + data.data.isGM = game.user.isGM; + data.data.currentWounds = this.actor.computeCurrentWounds(); + data.data.totalWounds = this.actor.data.data.scores.wound.value; data.data.subculture = this.actor.data.items.find( item => item.type == 'subculture'); data.data.geneline = this.actor.data.items.find( item => item.type == 'geneline'); @@ -113,6 +117,11 @@ export class SoSActorSheet extends ActorSheet { //console.log("Competence changed :", skillName); this.actor.updateSkillExperience(skillName, parseInt(event.target.value)); }); + html.find('.wound-value').change((event) => { + let woundName = event.currentTarget.attributes.woundname.value; + //console.log("Competence changed :", skillName); + this.actor.updateWound(woundName, parseInt(event.target.value)); + }); html.find('.reset-deck-full').click((event) => { this.actor.resetDeckFull(); this.render(true); diff --git a/module/actor.js b/module/actor.js index 74954f2..a39b582 100644 --- a/module/actor.js +++ b/module/actor.js @@ -175,6 +175,13 @@ export class SoSActor extends Actor { } } + /* -------------------------------------------- */ + async updateWound(woundName, value) { + let wounds = duplicate(this.data.data.wounds) + wounds[woundName] = value; + await this.update( { 'data.wounds': wounds } ); + } + /* -------------------------------------------- */ async updateSkill(skillName, value) { let skill = this.data.items.find( item => item.name == skillName); @@ -268,6 +275,26 @@ export class SoSActor extends Actor { new SoSFlipDialog(flipData, html).render(true); } + /* -------------------------------------------- */ + async checkDeath( ) { + if ( this.data.data.scores.currentwounds.value >= this.data.data.scores.wound.value*2) { + let woundData = { + name: this.name, + wounds: this.data.data.wounds, + currentWounds: this.data.data.scores.currentwounds.value, + totalWounds: this.data.data.scores.wound.value + } + let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-character-death.html', woundData ); + ChatMessage.create( { content: html, whisper: [ChatMessage.getWhisperRecipients(this.name), ChatMessage.getWhisperRecipients("GM") ] } ); + } + } + + /* -------------------------------------------- */ + computeCurrentWounds( ) { + let wounds = this.data.data.wounds; + return wounds.light + (wounds.moderate*2) + (wounds.severe*3) + (wounds.critical*4); + } + /* -------------------------------------------- */ async applyConsequenceWound( severity, consequenceName) { if ( severity == 'none') return; // Nothing ! @@ -293,6 +320,8 @@ export class SoSActor extends Actor { } 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") ] } ); + + this.checkDeath(); } /* -------------------------------------------- */ @@ -315,7 +344,7 @@ export class SoSActor extends Actor { flipData.isBleeding = newSeverity; } await this.update( { 'data.scores.currentwounds': currentWounds, 'data.wounds': wounds } ); - + flipData.defenderName = this.name; flipData.wounds = wounds; flipData.currentWounds = sumWound; @@ -323,6 +352,7 @@ export class SoSActor extends Actor { let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-damage-taken.html', flipData ); ChatMessage.create( { content: html, whisper: [ChatMessage.getWhisperRecipients(this.name), ChatMessage.getWhisperRecipients("GM") ] } ); + this.checkDeath(); } } diff --git a/module/sos-combat.js b/module/sos-combat.js index 4fe7172..3b4e0b1 100644 --- a/module/sos-combat.js +++ b/module/sos-combat.js @@ -157,7 +157,7 @@ export class SoSCombat extends Combat { } if ( actionsDone ) { this.actionsRequested = false; - ChatMessage.create( { content: `Action declaration phase has been completed ! Now proceeding with actions.`, + ChatMessage.create( { content: `Action declaration has been completed ! Now proceeding with actions.`, whisper: [ ChatMessage.getWhisperRecipients("GM") ] } ); this.phaseNumber = 3; this.nextTurn(); diff --git a/styles/simple.css b/styles/simple.css index ea7a96c..be4c310 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -307,6 +307,11 @@ table {border: 1px solid #7a7971;} .foundryvtt-shadows-over-sol .sheet-body .tab .editor { height: 100%; } +.editor { + border: 2; + height: 300px; + padding: 0 3px; +} .medium-editor { border: 2; @@ -628,6 +633,7 @@ ul, li { } .skill-label, +.conseq-label, .generic-label { font-weight: bold; flex-grow: 2; @@ -640,7 +646,8 @@ ul, li { margin-left: 4px; } .sante-value, -.skill-value { +.skill-value, +.wound-value { flex-grow: 0; flex-basis: 2rem; margin-right: 0.25rem; @@ -819,7 +826,7 @@ ul, li { .chat-message { background: rgba(220,220,210,0.5); - font-size: 0.8rem; + font-size: 0.9rem; } .chat-message.whisper { diff --git a/system.json b/system.json index 32e1554..cf5ba5e 100644 --- a/system.json +++ b/system.json @@ -2,11 +2,11 @@ "name": "foundryvtt-shadows-over-sol", "title": "Shadows over Sol", "description": "Shadows over Sol for FoundryVTT", - "version": "0.0.22", + "version": "0.0.25", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "0.7.5", "compatibleCoreVersion": "0.7.9", - "templateVersion": 15, + "templateVersion": 17, "author": "LeRatierBretonnien", "esmodules": [ "module/sos-main.js" ], "styles": ["styles/simple.css"], diff --git a/template.json b/template.json index 2dc3668..faca8d5 100644 --- a/template.json +++ b/template.json @@ -121,7 +121,7 @@ "background": { "geneline": "", "subculture": "", - "history": "", + "history": "Background", "notes": "Notes", "gmnotes": "GM notes", "eyes": "", diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 9ec47f0..0bdf159 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -154,32 +154,59 @@ - - + {{!-- Consequences Tab --}}
- + lock/unlock{{#if data.editStatSkill}}Lock{{else}}Unlock{{/if}} +

Wounds & Conséquences

+
+
+
    +
  • Wounds :

  • +
  • Light : + +
  • +
  • Moderate : + +
  • +
  • Severe : + +
  • +
  • Critical : + +
  • +
  • Total : + {{data.currentWounds}} / {{data.totalWounds}} +
  • +
+
+
+
    + {{#each data.consequences as |conseq key|}} +
  • + + {{conseq.name}} + +
    + + +
    +
  • + {{/each}} +
+
+
{{!-- Gears Tab --}} @@ -274,14 +301,17 @@
+

Biography :

-
- {{editor content=data.biography target="data.biography" button=true owner=owner editable=editable}} +
+ {{editor content=data.history target="data.history" button=true owner=owner editable=editable}}
+

Notes :

-
+
{{editor content=data.notes target="data.notes" button=true owner=owner editable=editable}}
+
{{>"systems/foundryvtt-shadows-over-sol/templates/editor-notes-gm.html"}}
diff --git a/templates/chat-character-death.html b/templates/chat-character-death.html new file mode 100644 index 0000000..ab8b8f1 --- /dev/null +++ b/templates/chat-character-death.html @@ -0,0 +1,9 @@ +

{{name}} is dead !

+
+ + + + + + +