diff --git a/modules/crucible-actor-sheet.js b/modules/crucible-actor-sheet.js
index 2c086f0..8a6aaed 100644
--- a/modules/crucible-actor-sheet.js
+++ b/modules/crucible-actor-sheet.js
@@ -227,6 +227,11 @@ export class CrucibleActorSheet extends ActorSheet {
const skillId = li.data("item-id")
this.actor.rollSkill(skillId)
});
+ html.find('.roll-weapon').click((event) => {
+ const li = $(event.currentTarget).parents(".item");
+ const skillId = li.data("item-id")
+ this.actor.rollWeapon(skillId)
+ });
html.find('.weapon-roll').click((event) => {
const li = $(event.currentTarget).parents(".item");
const weaponId = li.data("item-id");
diff --git a/modules/crucible-actor.js b/modules/crucible-actor.js
index 15a2fc3..0ed40ab 100644
--- a/modules/crucible-actor.js
+++ b/modules/crucible-actor.js
@@ -166,6 +166,9 @@ export class CrucibleActor extends Actor {
/* -------------------------------------------- */
getSkills() {
let comp = duplicate(this.data.items.filter(item => item.type == 'skill') || [])
+ for (let skill of comp) {
+ CrucibleUtility.updateSkill(skill)
+ }
CrucibleUtility.sortArrayObjectsByName(comp)
return comp
}
@@ -403,12 +406,12 @@ export class CrucibleActor extends Actor {
}
ChatMessage.create(chatData)
if (skill.data.data.exp >= 25) {
- await this.updateEmbeddedDocuments('Item', [{ _id: skill.id, 'data.exp': 0, 'data.level': skill.data.data.level + 1 }])
+ await this.updateEmbeddedDocuments('Item', [{ _id: skill.id, 'data.exp': 0, 'data.explevel': skill.data.data.explevel + 1 }])
let chatData = {
user: game.user.id,
rollMode: game.settings.get("core", "rollMode"),
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
- content: `
${this.name} has gained 1 SL in the skill ${skill.name} (new SL : ${skill.data.data.level}) !
${this.name} has gained 1 exp SL in the skill ${skill.name} (new exp SL : ${skill.data.data.explevel}) ! item.name.toLowerCase() == weapon.data.skill.toLowerCase())
+ if (skill) {
+ skill = duplicate(skill)
+ CrucibleUtility.updateSkill(skill)
+ let abilityKey = skill.data.ability
+ let rollData = this.getCommonRollData(abilityKey)
+ rollData.mode = "weapon"
+ rollData.skill = skill
+ rollData.weapon = weapon
+ rollData.img = weapon.img
+
+ this.startRoll(rollData)
+ } else {
+ ui.notifications.warn("Unable to find the relevant skill for weapon " + weapon.name)
+ }
+ }
+ }
+
/* -------------------------------------------- */
async startRoll(rollData) {
this.syncRoll(rollData)
diff --git a/modules/crucible-item-sheet.js b/modules/crucible-item-sheet.js
index 32dda87..09e35f7 100644
--- a/modules/crucible-item-sheet.js
+++ b/modules/crucible-item-sheet.js
@@ -49,8 +49,12 @@ export class CrucibleItemSheet extends ItemSheet {
/* -------------------------------------------- */
async getData() {
const objectData = CrucibleUtility.data(this.object);
+ if ( objectData.type == "skill") {
+ console.log(objectData)
+ CrucibleUtility.updateSkill(objectData)
+ }
- let itemData = foundry.utils.deepClone(CrucibleUtility.templateData(this.object));
+ let itemData = foundry.utils.deepClone(CrucibleUtility.templateData(this.object))
let formData = {
title: this.title,
id: this.id,
diff --git a/modules/crucible-roll-dialog.js b/modules/crucible-roll-dialog.js
index ebea806..975852f 100644
--- a/modules/crucible-roll-dialog.js
+++ b/modules/crucible-roll-dialog.js
@@ -61,15 +61,18 @@ export class CrucibleRollDialog extends Dialog {
html.find('#advantage').change((event) => {
this.rollData.advantage = event.currentTarget.value
})
+ html.find('#disadvantage').change((event) => {
+ this.rollData.disadvantage = event.currentTarget.value
+ })
html.find('#rollAdvantage').change((event) => {
this.rollData.rollAdvantage = event.currentTarget.value
})
- html.find('#featDieName').change((event) => {
+ /*html.find('#featDieName').change((event) => {
this.rollData.featDieName = event.currentTarget.value
})
html.find('#featDieSL').change((event) => {
this.rollData.featDieSL = event.currentTarget.value
- })
+ })*/
}
}
\ No newline at end of file
diff --git a/modules/crucible-utility.js b/modules/crucible-utility.js
index bcd7b72..55f1ee1 100644
--- a/modules/crucible-utility.js
+++ b/modules/crucible-utility.js
@@ -5,6 +5,7 @@ import { CrucibleCommands } from "./crucible-commands.js";
/* -------------------------------------------- */
const __level2Dice = ["d0", "d4", "d6", "d8", "d10", "d12"];
const __name2DiceValue = { "0": 0, "d0": 0, "d4": 4, "d6": 6, "d8": 8, "d10": 10, "d12": 12 }
+const __skillLevel2Dice = ["0d8", "1d8", "2d8","3d8", "4d8", '6d8', "8d8", "10d8"]
/* -------------------------------------------- */
export class CrucibleUtility {
@@ -258,6 +259,12 @@ export class CrucibleUtility {
}
}
+ /* -------------------------------------------- */
+ static updateSkill( skill) {
+ skill.data.level = skill.data.background + skill.data.basic + skill.data.class + skill.data.explevel
+ if (skill.data.level > 7) { skill.data.level = 7}
+ skill.data.skilldice = __skillLevel2Dice[skill.data.level]
+ }
/* -------------------------------------------- */
static async rollCrucible(rollData) {
@@ -267,17 +274,27 @@ export class CrucibleUtility {
let diceFormula = String(rollData.ability.value) + "d6cs>=5"
if (rollData.skill) {
let level = rollData.skill.data.level
- if (rollData.featSLName != "none") {
- let feat = rollData.featsSL.find(item => item.name == rollData.featSLName )
- level += feat.data.sl
- rollData.featSL = feat.data.sl
+ if (level == 0 && rollData.skill.data.isfeatdie ) {
+ rollData.hasSLBonus = true
+ level += 2
+ if (level > 7) { level = 7}
+ rollData.skill.data.skilldice = __skillLevel2Dice[level]
}
- diceFormula += "+" + String(level) + "d8cs>=5"
+ diceFormula += "+" + String(rollData.skill.data.skilldice) + "cs>=5"
if (rollData.skill.data.skilltype == "complex" && rollData.skill.data.level == 0) {
rollData.complexSkillDisadvantage = true
rollData.rollAdvantage = "roll-disadvantage"
}
+
+ if (rollData.skill.data.level > 0 && rollData.skill.data.isfeatdie) {
+ rollData.hasFeatDie = true
+ diceFormula += "+ 1d10cs>=5"
+ }
+ if (rollData.skill.data.bonusdice != "none") {
+ rollData.hasBonusDice = rollData.skill.data.bonusdice
+ diceFormula += `+ ${rollData.hasBonusDice}cs>=5`
+ }
}
if(rollData.advantage == "advantage1") {
@@ -286,15 +303,21 @@ export class CrucibleUtility {
if(rollData.advantage == "advantage2") {
diceFormula += "+ 2d10cs>=5"
}
- if(rollData.advantage == "disadvantage1") {
+ if(rollData.disadvantage == "disadvantage1") {
diceFormula += "- 1d10cs>=5"
}
- if(rollData.advantage == "disadvantage2") {
+ if(rollData.disadvantage == "disadvantage2") {
diceFormula += "- 2d10cs>=5"
}
- if (rollData.featDieName != "none") {
- diceFormula += "+ 1d10cs>=5"
+ let skillArmorPenalty = 0
+ for (let armor of rollData.armors) {
+ skillArmorPenalty += armor.data.skillpenalty
}
+ if (skillArmorPenalty > 0 ) {
+ rollData.skillArmorPenalty = skillArmorPenalty
+ diceFormula += `- ${skillArmorPenalty}d10cs>=5`
+ }
+
// Performs roll
let myRoll = rollData.roll
if (!myRoll) { // New rolls only of no rerolls
diff --git a/packs/skills.db b/packs/skills.db
index 608ff10..fd7bb6e 100644
--- a/packs/skills.db
+++ b/packs/skills.db
@@ -23,3 +23,4 @@
{"_id":"s2AAQviLttcHul3X","name":"Charm","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Charm.png","data":{"ability":"cha","armorpenalty":false,"bonusdice":"none","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"Getting someone to do what you want because they want to do it.
"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
{"_id":"xlYUHAUSfQrsjQoi","name":"Survival","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Survival.webp","data":{"ability":"wit","armorpenalty":false,"bonusdice":"","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"Help me set this snare and we'll eat like kings in the morning.
"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
{"_id":"yAhtkgqf7pKyjJTA","name":"Poison Use","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/skills/Poison%20Use.webp","data":{"ability":"dex","armorpenalty":false,"bonusdice":"","level":0,"background":0,"basic":0,"class":0,"exp":0,"description":"Let me apply this to my blade.
"},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{}}
+{"name":"Axe (Copy)","type":"skill","img":"systems/fvtt-crucible-rpg/images/icons/icon_skill.webp","data":{"ability":"agi","armorpenalty":false,"isproficient":true,"isweaponskill":true,"isfeatdie":false,"islore":false,"skilltype":"complex","isinnate":false,"bonusdice":"none","background":0,"basic":0,"class":0,"exp":0,"explevel":0,"description":"","level":2},"effects":[],"folder":null,"sort":0,"permission":{"default":0,"Up3b6rNa3VKAFQC3":3},"flags":{"core":{"sourceId":"Item.Cnw8keaxD1SI3vun"}},"_id":"fJjXMpUILcN983XV"}
diff --git a/system.json b/system.json
index ac24858..d819894 100644
--- a/system.json
+++ b/system.json
@@ -208,11 +208,11 @@
"styles": [
"styles/simple.css"
],
- "templateVersion": 10,
+ "templateVersion": 11,
"title": "Crucible RPG",
"manifest": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/raw/master/system.json",
- "download": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/archive/fvtt-crucible-rpg-v0.1.16.zip",
+ "download": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/archive/fvtt-crucible-rpg-v0.1.17.zip",
"url": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg",
- "version": "0.1.16",
+ "version": "0.1.17",
"background" : "./images/ui/crucible_welcome_page.webp"
}
diff --git a/template.json b/template.json
index 3b178a6..0a992ad 100644
--- a/template.json
+++ b/template.json
@@ -121,15 +121,16 @@
"armorpenalty": false,
"isproficient": false,
"isweaponskill": false,
+ "isfeatdie": false,
"islore": false,
"skilltype": "",
"isinnate": false,
"bonusdice": "",
- "level": 0,
"background": 0,
"basic": 0,
"class": 0,
"exp": 0,
+ "explevel": 0,
"description": ""
},
"armor": {
diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html
index 6b3873c..ff010c9 100644
--- a/templates/actor-sheet.html
+++ b/templates/actor-sheet.html
@@ -63,7 +63,7 @@
-
+
@@ -75,7 +75,7 @@
src="{{skill.img}}" />
{{skill.name}}
{{upper skill.data.ability}}
- {{skill.data.level}}d8
+ {{skill.data.skilldice}}
-
@@ -107,7 +107,7 @@
- {{weapon.name}}
+ {{weapon.name}}
{{weapon.data.ability}}
diff --git a/templates/chat-generic-result.html b/templates/chat-generic-result.html
index 62c5b5d..68554a1 100644
--- a/templates/chat-generic-result.html
+++ b/templates/chat-generic-result.html
@@ -47,7 +47,15 @@
{{#if (eq rollAdvantage "roll-disadvantage")}}
Roll with Disadvantage !
{{/if}}
+
+ {{#if skillArmorPenalty}}
+
Armor Penalty : {{skillArmorPenalty}} Disadvantage Dice
+ {{/if}}
+ {{#if hasBonusDice}}
+
Skill bonus dice : {{hasBonusDice}}
+ {{/if}}
+
{{#if complexSkillDisadvantage}}
Roll with Disadvantage because of Complex Skill at SL 0 !
{{/if}}
diff --git a/templates/item-skill-sheet.html b/templates/item-skill-sheet.html
index b43571e..7357a79 100644
--- a/templates/item-skill-sheet.html
+++ b/templates/item-skill-sheet.html
@@ -23,12 +23,12 @@
-
-
+
+
-
-
+
+
@@ -41,19 +41,7 @@
-
+
@@ -96,7 +84,11 @@
-
+
+
+
+
+
diff --git a/templates/item-weapon-sheet.html b/templates/item-weapon-sheet.html
index 7d28af8..3635d48 100644
--- a/templates/item-weapon-sheet.html
+++ b/templates/item-weapon-sheet.html
@@ -31,7 +31,7 @@
-
+ {{#if weapon}}
+
+ Weapon :
+ {{weapon.name}}
+
+ {{/if}}
+
{{#if skill}}
Skill :
- {{skill.name}} - {{skill.data.level}}d8
+ {{skill.name}} - {{skill.data.skilldice}}
+
+
+ Feature die or SL+2? :
+ {{#if skill.data.isfeatdie}} Yes {{else}} No {{/if}}
{{/if}}
- Advantage/Disadvantage :
+ Advantage :
{{#select advantage}}
+ {{/select}}
+
+
+
+
+ Disadvantage :
+
+ {{#select isadvantage}}
+
{{/select}}
@@ -44,30 +64,6 @@
-
- Feature Die :
-
- {{#select featDieName}}
-
- {{#each featsDie as |feat idx|}}
-
- {{/each}}
- {{/select}}
-
-
-
-
- Feature SL :
-
- {{#select featSLName}}
-
- {{#each featsSL as |feat idx|}}
-
- {{/each}}
- {{/select}}
-
-
-
\ No newline at end of file