diff --git a/lang/en.json b/lang/en.json
index 3e5f122..2ecdfc9 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -118,7 +118,8 @@
"WH.ui.details": "Details",
"WH.ui.magicschool": "Magic School",
"WH.ui.providedslot": "Provided slot",
-
+ "WH.ui.skilllevelacquired": "Acquired at level",
+
"WH.chat.save": "Save",
"WH.chat.mweaponmalus": "Multiple weapons malus ",
"WH.chat.diceresult": "Dice result",
@@ -128,5 +129,7 @@
"WH.chat.rollformula": "Roll Formula",
"WH.chat.useshield":"Use shield ?",
"WH.chat.power": "Power",
- "WH.chat.powerlevel": "Power Level"
+ "WH.chat.powerlevel": "Power Level",
+
+ "WH.notif.skillmaxuse": "Maximum skill usage reach - Use is not allowed"
}
\ No newline at end of file
diff --git a/modules/warhero-actor-sheet.js b/modules/warhero-actor-sheet.js
index c59de59..7926ce7 100644
--- a/modules/warhero-actor-sheet.js
+++ b/modules/warhero-actor-sheet.js
@@ -134,6 +134,15 @@ export class WarheroActorSheet extends ActorSheet {
const li = $(event.currentTarget).parents(".item");
this.actor.incDecQuantity( li.data("item-id"), +1 );
} );
+ html.find('.skill-use-minus').click(event => {
+ const li = $(event.currentTarget).parents(".item");
+ this.actor.incDecSkillUse( li.data("item-id"), -1 );
+ } );
+ html.find('.skill-use-plus').click(event => {
+ const li = $(event.currentTarget).parents(".item");
+ this.actor.incDecSkillUse( li.data("item-id"), +1 );
+ } );
+
html.find('.ammo-minus').click(event => {
const li = $(event.currentTarget).parents(".item")
diff --git a/modules/warhero-actor.js b/modules/warhero-actor.js
index 6c6cc2e..1f5a8e2 100644
--- a/modules/warhero-actor.js
+++ b/modules/warhero-actor.js
@@ -461,12 +461,10 @@ export class WarheroActor extends Actor {
}
}
/* -------------------------------------------- */
- getInitiativeScore(combatId, combatantId) {
- if (this.type == 'character') {
- this.rollMR(true, combatId, combatantId)
- }
- console.log("Init required !!!!")
- return -1;
+ async getInitiativeScore(combatId, combatantId) {
+ let roll = new Roll("1d20+"+this.system.attributes.ini.value).roll({async: false})
+ await WarheroUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode"))
+ return roll.total
}
/* -------------------------------------------- */
@@ -547,7 +545,19 @@ export class WarheroActor extends Actor {
}
}
}
-
+ /* -------------------------------------------- */
+ async incDecSkillUse(skillId, value) {
+ let skill = this.items.get(skillId)
+ if (skill) {
+ let newUse = skill.system.currentuse + value
+ if (newUse > skill.system.maxuse) {
+ ui.notifications.warn(game.i18n.localize("WH.notif.skillmaxuse"))
+ return
+ }
+ newUse = Math.max(newUse, 0)
+ this.updateEmbeddedDocuments('Item', [{ _id: skill.id, 'system.currentuse': newUse }])
+ }
+ }
/* -------------------------------------------- */
async incDecQuantity(objetId, incDec = 0) {
let objetQ = this.items.get(objetId)
@@ -625,12 +635,14 @@ export class WarheroActor extends Actor {
this.system.secondary.nblanguage.value = Math.floor(this.system.statistics.min.value / 2)
}
/* -------------------------------------------- */
- spentMana(mana) {
- if (Number(mana) > this.system.attributes.mana.value) {
+ spentMana(spentValue) {
+ let mana = duplicate(this.system.attributes.mana)
+ if (Number(spentValue) > mana.value) {
ui.notifications.warn("Not enough Mana points !")
return false
}
- this.update({ 'system.attributes.mana.value': this.system.attributes.mana.value - mana })
+ mana.value -= Number(spentValue)
+ this.update({ 'system.attributes.mana': mana })
return true
}
/* -------------------------------------------- */
@@ -651,6 +663,10 @@ export class WarheroActor extends Actor {
let rollData = this.getCommonRollData()
rollData.mode = rollType
rollData.stat = stat
+ if (stat && stat.stat)
+ {
+ rollData.statBonus = duplicate(this.system.statistics[stat.stat])
+ }
if (rollKey == "parrybonustotal") {
WarheroUtility.rollParry(rollData)
return
@@ -678,8 +694,8 @@ export class WarheroActor extends Actor {
} else {
rollData.stat = duplicate(this.system.attributes.txcm)
}
- rollData.usemWeaponMalus =
- rollData.mWeaponMalus = this.system.secondary.malusmultiweapon.value
+ rollData.usemWeaponMalus = false
+ rollData.mWeaponMalus = this.system.secondary.malusmultiweapon.value
rollData.weapon = weapon
rollData.img = weapon.img
this.startRoll(rollData)
@@ -707,7 +723,7 @@ export class WarheroActor extends Actor {
let rollData = this.getCommonRollData()
rollData.mode = "power"
rollData.power = power
- rollData.powerLevel = power.system.level
+ rollData.powerLevel = Number(power.system.level)
rollData.img = power.img
rollData.hasBM = false
this.startRoll(rollData)
diff --git a/modules/warhero-combat.js b/modules/warhero-combat.js
index 7f60afe..1267400 100644
--- a/modules/warhero-combat.js
+++ b/modules/warhero-combat.js
@@ -9,7 +9,7 @@ export class WarheroCombat extends Combat {
for (let cId = 0; cId < ids.length; cId++) {
const c = this.combatants.get(ids[cId]);
let id = c._id || c.id;
- let initBonus = c.actor ? c.actor.getInitiativeScore( this.id, id ) : -1;
+ let initBonus = c.actor ? await c.actor.getInitiativeScore( this.id, id ) : -1;
await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: initBonus } ]);
}
diff --git a/modules/warhero-main.js b/modules/warhero-main.js
index 685ee0e..8559991 100644
--- a/modules/warhero-main.js
+++ b/modules/warhero-main.js
@@ -71,16 +71,6 @@ Hooks.once("init", async function () {
WarheroUtility.init()
});
-/* -------------------------------------------- */
-function welcomeMessage() {
- /*ChatMessage.create({
- user: game.user.id,
- whisper: [game.user.id],
- content: `
- Welcome to the Warhero RPG.
- ` });*/
-}
-
/* -------------------------------------------- */
/* Foundry VTT Initialization */
/* -------------------------------------------- */
@@ -96,15 +86,14 @@ Hooks.once("ready", function () {
}
// CSS patch for v9
- if (game.version) {
+ /*if (game.version) {
let sidebar = document.getElementById("sidebar");
sidebar.style.width = "min-content";
- }
+ }*/
- welcomeMessage();
+ //welcomeMessage();
WarheroUtility.ready()
- WarheroCommands.init()
- WarheroHotbar.initDropbar()
+ //WarheroHotbar.initDropbar()
})
diff --git a/modules/warhero-utility.js b/modules/warhero-utility.js
index 6660b8b..ecff4da 100644
--- a/modules/warhero-utility.js
+++ b/modules/warhero-utility.js
@@ -552,7 +552,7 @@ export class WarheroUtility {
let actor = game.actors.get(rollData.actorId)
if (rollData.mode == "power") {
- let manaCost = Array.from(rollData.powerLevel)[0]
+ let manaCost = rollData.powerLevel
if (actor.spentMana(manaCost)) {
let powerKey = "level" + rollData.powerLevel
rollData.powerText = rollData.power.system[powerKey]
@@ -592,6 +592,9 @@ export class WarheroUtility {
if (rollData.stat) {
diceFormula += "+" + rollData.stat.value
}
+ if (rollData.statBonus) {
+ diceFormula += "+" + rollData.statBonus.value
+ }
}
if (rollData.usemWeaponMalus) {
diceFormula += "+" + rollData.mWeaponMalus
diff --git a/styles/simple.css b/styles/simple.css
index a7348b3..36afbf1 100644
--- a/styles/simple.css
+++ b/styles/simple.css
@@ -876,16 +876,36 @@ li {
/* background: rgb(105,85,65) url("../images/ui/texture_feuille_perso_onglets.webp") no-repeat right bottom;*/
-#sidebar.collapsed {
- height: 470px !important;
-}
-
#sidebar-tabs > .collapsed,
#chat-controls .chat-control-icon {
color: rgba(220, 220, 220, 0.75);
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.75);
}
+#sidebar-tabs {
+ flex: 0 0 28px;
+ box-sizing: border-box;
+ margin: 0 0 3px;
+ border-bottom: 1px solid rgba(0,0,0,0);
+ box-shadow: inset 0 0 2rem rgba(0,0,0,0.5);
+}
+
+#sidebar-tabs > .item.active {
+ border: 1px solid rgba(114,98,72,1);
+ background: rgba(30, 25, 20, 0.75);
+ box-shadow: 0 0 6px inset rgba(114,98,72,1);
+}
+
+#sidebar #sidebar-tabs i{
+ width: 23px;
+ height: 23px;
+ display: inline-block;
+ background-position:center;
+ background-size:cover;
+ text-shadow: 1px 1px 0 rgba(0,0,0,0.75);
+
+}
+
.sidebar-tab .directory-list .entity {
border-top: 1px dashed rgba(0, 0, 0, 0.25);
border-bottom: 0 none;
@@ -1028,21 +1048,6 @@ li {
box-shadow: inset 0 0 2rem rgba(0, 0, 0, 0.5);
}
-#sidebar-tabs > .item.active {
- border: 1px solid rgba(114, 98, 72, 1);
- background: rgba(30, 25, 20, 0.75);
- box-shadow: 0 0 6px inset rgba(114, 98, 72, 1);
-}
-
-#sidebar #sidebar-tabs i {
- width: 25px;
- height: 25px;
- display: inline-block;
- background-position: center;
- background-size: cover;
- text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.75);
-}
-
/*--------------------------------------------------------------------------*/
/* Control, Tool, hotbar & navigation */
diff --git a/system.json b/system.json
index 3ceab64..c98d2d6 100644
--- a/system.json
+++ b/system.json
@@ -107,7 +107,7 @@
"styles": [
"styles/simple.css"
],
- "version": "10.0.29",
+ "version": "10.0.31",
"compatibility": {
"minimum": "10",
"verified": "10",
@@ -115,7 +115,7 @@
},
"title": "Warhero RPG",
"manifest": "https://www.uberwald.me/gitea/public/fvtt-warhero/raw/branch/master/system.json",
- "download": "https://www.uberwald.me/gitea/uberwald/fvtt-warhero/archive/fvtt-warhero-10.0.29.zip",
+ "download": "https://www.uberwald.me/gitea/uberwald/fvtt-warhero/archive/fvtt-warhero-10.0.31.zip",
"url": "https://www.uberwald.me/gitea/public/fvtt-warhero",
"background": "images/ui/warhero_welcome_page.webp",
"id": "fvtt-warhero"
diff --git a/template.json b/template.json
index f806f45..6be2fbe 100644
--- a/template.json
+++ b/template.json
@@ -111,6 +111,7 @@
"label": "WH.ui.Initiative",
"abbrev": "ini",
"style": "edit",
+ "roll": true,
"max": 1,
"value": 1
},
@@ -180,9 +181,11 @@
},
"counterspell": {
"label": "WH.ui.counterspell",
+ "stat": "min",
"abbrev": "counterspell",
"style": "edit",
"hasmax": true,
+ "roll": true,
"max": 1,
"value": 0
},
@@ -236,7 +239,8 @@
"power",
"language",
"condition",
- "class"
+ "class",
+ "genericitem"
],
"templates": {
"commonclassrace": {
@@ -260,6 +264,9 @@
}
}
},
+ "genericitem": {
+ "description": ""
+ },
"condition": {
"shortdescription": "",
"description": ""
@@ -288,6 +295,7 @@
"skill": {
"classskill": false,
"unlimited": false,
+ "acquiredatlevel": 0,
"currentuse": 0,
"maxuse": 0,
"description": ""
diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html
index c18966b..210e156 100644
--- a/templates/actor-sheet.html
+++ b/templates/actor-sheet.html
@@ -191,7 +191,7 @@
src="{{weapon.img}}" />
{{weapon.name}}
- {{weapon.system.weapontype}}
+ {{localize (concat "WH.conf." weapon.system.weapontype)}}
{{#if (eq system.weapontype "special")}}
{{weapon.system.damageformula}}
@@ -306,7 +306,9 @@
N/A
N/A
{{else}}
- {{skill.system.currentuse}}
+ {{skill.system.currentuse}}
+ ( -/+)
+
{{skill.system.maxuse}}
{{/if}}
diff --git a/templates/item-class-sheet.html b/templates/item-class-sheet.html
index 35993f7..4030ef7 100644
--- a/templates/item-class-sheet.html
+++ b/templates/item-class-sheet.html
@@ -13,7 +13,7 @@
-
+
{{editor description target="system.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-genericitem-sheet.html b/templates/item-genericitem-sheet.html
new file mode 100644
index 0000000..63f8b2c
--- /dev/null
+++ b/templates/item-genericitem-sheet.html
@@ -0,0 +1,24 @@
+
\ No newline at end of file
diff --git a/templates/item-race-sheet.html b/templates/item-race-sheet.html
index 38cf4a5..c24ec11 100644
--- a/templates/item-race-sheet.html
+++ b/templates/item-race-sheet.html
@@ -13,7 +13,7 @@
-
+
{{editor description target="system.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-skill-sheet.html b/templates/item-skill-sheet.html
index f6866ff..4800a2a 100644
--- a/templates/item-skill-sheet.html
+++ b/templates/item-skill-sheet.html
@@ -23,6 +23,10 @@
+
+
+
+
{{#if system.unlimited}}
{{else}}
diff --git a/templates/partial-item-description.html b/templates/partial-item-description.html
index af0db77..295374a 100644
--- a/templates/partial-item-description.html
+++ b/templates/partial-item-description.html
@@ -1,7 +1,7 @@
-
+
{{editor description target="system.description" button=true owner=owner editable=editable}}
diff --git a/templates/roll-dialog-generic.html b/templates/roll-dialog-generic.html
index 753e5eb..39ce73b 100644
--- a/templates/roll-dialog-generic.html
+++ b/templates/roll-dialog-generic.html
@@ -26,7 +26,7 @@
{{#if is2hands}}
{{weapon.damageFormula2Hands}}
{{else}}
-
{{weapon.damage}}
+
{{weapon.damageFormula}}
{{/if}}
{{/if}}