diff --git a/modules/avd12-actor-sheet.js b/modules/avd12-actor-sheet.js index aca7410..abb9b23 100644 --- a/modules/avd12-actor-sheet.js +++ b/modules/avd12-actor-sheet.js @@ -134,8 +134,11 @@ export class Avd12ActorSheet extends ActorSheet { const li = $(event.currentTarget).parents(".item"); this.actor.rollCrafting( li.data("item-id") ) }); - - + html.find('.roll-universal').click((event) => { + let skillKey = $(event.currentTarget).data("skill-key") + this.actor.rollUniversal(skillKey) + }); + html.find('.roll-weapon').click((event) => { const li = $(event.currentTarget).parents(".item"); const weponId = li.data("item-id") diff --git a/modules/avd12-actor.js b/modules/avd12-actor.js index d0a987e..f849456 100644 --- a/modules/avd12-actor.js +++ b/modules/avd12-actor.js @@ -494,12 +494,21 @@ export class Avd12Actor extends Actor { await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity } } + + /* -------------------------------------------- */ + clearInitiative(){ + this.getFlag("world", "initiative", -1) + } /* -------------------------------------------- */ getInitiativeScore(combatId, combatantId) { if (this.type == 'character') { - this.rollMR(true, combatId, combatantId) + let init = this.getFlag("world", "initiative" ) + console.log("INIT", init) + if (!init || init == -1) { + ChatMessage.create( { content: "Roll your initiative for this combat"} ) + } + return init } - console.log("Init required !!!!") return -1; } @@ -667,13 +676,30 @@ export class Avd12Actor extends Actor { skill.attr = duplicate(attr) let rollData = this.getCommonRollData() rollData.mode = "skill" + rollMode.skillKey = skillKey rollData.skill = skill - rollData.title = "Roll Skill " + skill.name + rollData.title = "Roll Skill " + skill.name rollData.img = skill.img this.startRoll(rollData) } } + /* -------------------------------------------- */ + rollUniversal(skillKey) { + let skill = this.system.universal.skills[skillKey] + if (skill) { + skill = duplicate(skill) + skill.name = Avd12Utility.upperFirst(skillKey) + let rollData = this.getCommonRollData() + rollData.mode = "universal" + rollData.skillKey = skillKey + rollData.skill = skill + rollData.title = "Roll Skill " + skill.name + rollData.img = skill.img + this.startRoll(rollData) + } + } + /* -------------------------------------------- */ async rollSpell(spellId) { let spell = this.items.get(spellId) diff --git a/modules/avd12-combat.js b/modules/avd12-combat.js index 96ecd70..0f7812d 100644 --- a/modules/avd12-combat.js +++ b/modules/avd12-combat.js @@ -27,4 +27,14 @@ export class Avd12Combat extends Combat { } } + /* -------------------------------------------- */ + _onDelete() { + let combatants = this.combatants.contents + for (let c of combatants) { + let actor = game.actors.get(c.actorId) + actor.clearInitiative() + } + super._onDelete() + } + } diff --git a/modules/avd12-utility.js b/modules/avd12-utility.js index 09e8a40..8a42e71 100644 --- a/modules/avd12-utility.js +++ b/modules/avd12-utility.js @@ -568,6 +568,10 @@ export class Avd12Utility { content: await renderTemplate(`systems/fvtt-avd12/templates/chat/chat-generic-result.hbs`, rollData) }) msg.setFlag("world", "rolldata", rollData) + if (rollData.skillKey == "initiative") { + console.log("REGISTERED") + actor.setFlag("world", "initiative", myRoll.total) + } console.log("Rolldata result", rollData) } diff --git a/styles/simple.css b/styles/simple.css index 83cc859..b7cfddc 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1320,7 +1320,16 @@ ul, li { min-width:2rem; max-width: 2rem; } - +.attribute-label { + font-weight: bold; +} +.flexrow-no-expand { + flex-grow: 0; +} +.item-input-small { + max-width: 16px; + max-height: 12px; +} .drop-module-step { background: linear-gradient(to bottom, #6c95b9fc 5%, #105177ab 100%); background-color: #7d5d3b00; diff --git a/system.json b/system.json index 5d2be7a..8b7457c 100644 --- a/system.json +++ b/system.json @@ -64,7 +64,7 @@ ], "title": "AnyVenture D12 RPG", "url": "https://www.uberwald.me/gitea/public/fvtt-avd12", - "version": "10.0.23", - "download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.23.zip", + "version": "10.0.24", + "download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.24.zip", "background": "systems/fvtt-avd12/images/ui/avd12_welcome_page.webp" } \ No newline at end of file diff --git a/template.json b/template.json index 9ac0261..c903d19 100644 --- a/template.json +++ b/template.json @@ -164,11 +164,13 @@ "universal": { "skills": { "search": { + "label": "Search", "modifier": 0, "finalvalue": 0, "good": false }, "initiative": { + "label": "Initiative", "modifier": 0, "finalvalue": 0, "good": false diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index 06fbe15..657ce17 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -11,26 +11,45 @@
{{#each system.attributes as |attr attrKey|}}
-
- {{attr.label}} +
+ {{attr.label}}
- {{#each attr.skills as |skill skillKey|}} -
- {{upperFirst skillKey}} {{skill.finalvalue}} - + {{#each attr.skills as |skill skillKey|}} + + {{/each}} +
+   +
+ {{#if (eq attrKey "might")}} +
+ Universal +
+ {{#each @root.system.universal.skills as |skill skillKey|}} + {{/each}} -
+ {{else}} +
+
+ {{/if}} +
{{/each}} +
-
-
- -
-
-
diff --git a/templates/dialogs/roll-dialog-generic.hbs b/templates/dialogs/roll-dialog-generic.hbs index e017c32..a29824e 100644 --- a/templates/dialogs/roll-dialog-generic.hbs +++ b/templates/dialogs/roll-dialog-generic.hbs @@ -61,22 +61,26 @@ - {{#if (or spell weapon)}} + {{#if (eq skillKey "initiative") }} {{else}} -
- Target check : - -
+ {{#if (or spell weapon)}} + + {{else}} +
+ Target check : + +
+ {{/if}} {{/if}}