Minor changes

This commit is contained in:
LeRatierBretonnien 2023-02-20 10:16:17 +01:00
parent 46b129cf81
commit 7137de0983
16 changed files with 123 additions and 60 deletions

View File

@ -118,7 +118,8 @@
"WH.ui.details": "Details", "WH.ui.details": "Details",
"WH.ui.magicschool": "Magic School", "WH.ui.magicschool": "Magic School",
"WH.ui.providedslot": "Provided slot", "WH.ui.providedslot": "Provided slot",
"WH.ui.skilllevelacquired": "Acquired at level",
"WH.chat.save": "Save", "WH.chat.save": "Save",
"WH.chat.mweaponmalus": "Multiple weapons malus ", "WH.chat.mweaponmalus": "Multiple weapons malus ",
"WH.chat.diceresult": "Dice result", "WH.chat.diceresult": "Dice result",
@ -128,5 +129,7 @@
"WH.chat.rollformula": "Roll Formula", "WH.chat.rollformula": "Roll Formula",
"WH.chat.useshield":"Use shield ?", "WH.chat.useshield":"Use shield ?",
"WH.chat.power": "Power", "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"
} }

View File

@ -134,6 +134,15 @@ export class WarheroActorSheet extends ActorSheet {
const li = $(event.currentTarget).parents(".item"); const li = $(event.currentTarget).parents(".item");
this.actor.incDecQuantity( li.data("item-id"), +1 ); 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 => { html.find('.ammo-minus').click(event => {
const li = $(event.currentTarget).parents(".item") const li = $(event.currentTarget).parents(".item")

View File

@ -461,12 +461,10 @@ export class WarheroActor extends Actor {
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getInitiativeScore(combatId, combatantId) { async getInitiativeScore(combatId, combatantId) {
if (this.type == 'character') { let roll = new Roll("1d20+"+this.system.attributes.ini.value).roll({async: false})
this.rollMR(true, combatId, combatantId) await WarheroUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode"))
} return roll.total
console.log("Init required !!!!")
return -1;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -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) { async incDecQuantity(objetId, incDec = 0) {
let objetQ = this.items.get(objetId) 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) this.system.secondary.nblanguage.value = Math.floor(this.system.statistics.min.value / 2)
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
spentMana(mana) { spentMana(spentValue) {
if (Number(mana) > this.system.attributes.mana.value) { let mana = duplicate(this.system.attributes.mana)
if (Number(spentValue) > mana.value) {
ui.notifications.warn("Not enough Mana points !") ui.notifications.warn("Not enough Mana points !")
return false 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 return true
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -651,6 +663,10 @@ export class WarheroActor extends Actor {
let rollData = this.getCommonRollData() let rollData = this.getCommonRollData()
rollData.mode = rollType rollData.mode = rollType
rollData.stat = stat rollData.stat = stat
if (stat && stat.stat)
{
rollData.statBonus = duplicate(this.system.statistics[stat.stat])
}
if (rollKey == "parrybonustotal") { if (rollKey == "parrybonustotal") {
WarheroUtility.rollParry(rollData) WarheroUtility.rollParry(rollData)
return return
@ -678,8 +694,8 @@ export class WarheroActor extends Actor {
} else { } else {
rollData.stat = duplicate(this.system.attributes.txcm) rollData.stat = duplicate(this.system.attributes.txcm)
} }
rollData.usemWeaponMalus = rollData.usemWeaponMalus = false
rollData.mWeaponMalus = this.system.secondary.malusmultiweapon.value rollData.mWeaponMalus = this.system.secondary.malusmultiweapon.value
rollData.weapon = weapon rollData.weapon = weapon
rollData.img = weapon.img rollData.img = weapon.img
this.startRoll(rollData) this.startRoll(rollData)
@ -707,7 +723,7 @@ export class WarheroActor extends Actor {
let rollData = this.getCommonRollData() let rollData = this.getCommonRollData()
rollData.mode = "power" rollData.mode = "power"
rollData.power = power rollData.power = power
rollData.powerLevel = power.system.level rollData.powerLevel = Number(power.system.level)
rollData.img = power.img rollData.img = power.img
rollData.hasBM = false rollData.hasBM = false
this.startRoll(rollData) this.startRoll(rollData)

View File

@ -9,7 +9,7 @@ export class WarheroCombat extends Combat {
for (let cId = 0; cId < ids.length; cId++) { for (let cId = 0; cId < ids.length; cId++) {
const c = this.combatants.get(ids[cId]); const c = this.combatants.get(ids[cId]);
let id = c._id || c.id; 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 } ]); await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: initBonus } ]);
} }

View File

@ -71,16 +71,6 @@ Hooks.once("init", async function () {
WarheroUtility.init() WarheroUtility.init()
}); });
/* -------------------------------------------- */
function welcomeMessage() {
/*ChatMessage.create({
user: game.user.id,
whisper: [game.user.id],
content: `<div id="welcome-message-crucible"><span class="rdd-roll-part">
<strong>Welcome to the Warhero RPG.</strong>
` });*/
}
/* -------------------------------------------- */ /* -------------------------------------------- */
/* Foundry VTT Initialization */ /* Foundry VTT Initialization */
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -96,15 +86,14 @@ Hooks.once("ready", function () {
} }
// CSS patch for v9 // CSS patch for v9
if (game.version) { /*if (game.version) {
let sidebar = document.getElementById("sidebar"); let sidebar = document.getElementById("sidebar");
sidebar.style.width = "min-content"; sidebar.style.width = "min-content";
} }*/
welcomeMessage(); //welcomeMessage();
WarheroUtility.ready() WarheroUtility.ready()
WarheroCommands.init() //WarheroHotbar.initDropbar()
WarheroHotbar.initDropbar()
}) })

View File

@ -552,7 +552,7 @@ export class WarheroUtility {
let actor = game.actors.get(rollData.actorId) let actor = game.actors.get(rollData.actorId)
if (rollData.mode == "power") { if (rollData.mode == "power") {
let manaCost = Array.from(rollData.powerLevel)[0] let manaCost = rollData.powerLevel
if (actor.spentMana(manaCost)) { if (actor.spentMana(manaCost)) {
let powerKey = "level" + rollData.powerLevel let powerKey = "level" + rollData.powerLevel
rollData.powerText = rollData.power.system[powerKey] rollData.powerText = rollData.power.system[powerKey]
@ -592,6 +592,9 @@ export class WarheroUtility {
if (rollData.stat) { if (rollData.stat) {
diceFormula += "+" + rollData.stat.value diceFormula += "+" + rollData.stat.value
} }
if (rollData.statBonus) {
diceFormula += "+" + rollData.statBonus.value
}
} }
if (rollData.usemWeaponMalus) { if (rollData.usemWeaponMalus) {
diceFormula += "+" + rollData.mWeaponMalus diceFormula += "+" + rollData.mWeaponMalus

View File

@ -876,16 +876,36 @@ li {
/* background: rgb(105,85,65) url("../images/ui/texture_feuille_perso_onglets.webp") no-repeat right bottom;*/ /* 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, #sidebar-tabs > .collapsed,
#chat-controls .chat-control-icon { #chat-controls .chat-control-icon {
color: rgba(220, 220, 220, 0.75); color: rgba(220, 220, 220, 0.75);
text-shadow: 1px 1px 0 rgba(0, 0, 0, 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 { .sidebar-tab .directory-list .entity {
border-top: 1px dashed rgba(0, 0, 0, 0.25); border-top: 1px dashed rgba(0, 0, 0, 0.25);
border-bottom: 0 none; border-bottom: 0 none;
@ -1028,21 +1048,6 @@ li {
box-shadow: inset 0 0 2rem rgba(0, 0, 0, 0.5); 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 */ /* Control, Tool, hotbar & navigation */

View File

@ -107,7 +107,7 @@
"styles": [ "styles": [
"styles/simple.css" "styles/simple.css"
], ],
"version": "10.0.29", "version": "10.0.31",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",
"verified": "10", "verified": "10",
@ -115,7 +115,7 @@
}, },
"title": "Warhero RPG", "title": "Warhero RPG",
"manifest": "https://www.uberwald.me/gitea/public/fvtt-warhero/raw/branch/master/system.json", "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", "url": "https://www.uberwald.me/gitea/public/fvtt-warhero",
"background": "images/ui/warhero_welcome_page.webp", "background": "images/ui/warhero_welcome_page.webp",
"id": "fvtt-warhero" "id": "fvtt-warhero"

View File

@ -111,6 +111,7 @@
"label": "WH.ui.Initiative", "label": "WH.ui.Initiative",
"abbrev": "ini", "abbrev": "ini",
"style": "edit", "style": "edit",
"roll": true,
"max": 1, "max": 1,
"value": 1 "value": 1
}, },
@ -180,9 +181,11 @@
}, },
"counterspell": { "counterspell": {
"label": "WH.ui.counterspell", "label": "WH.ui.counterspell",
"stat": "min",
"abbrev": "counterspell", "abbrev": "counterspell",
"style": "edit", "style": "edit",
"hasmax": true, "hasmax": true,
"roll": true,
"max": 1, "max": 1,
"value": 0 "value": 0
}, },
@ -236,7 +239,8 @@
"power", "power",
"language", "language",
"condition", "condition",
"class" "class",
"genericitem"
], ],
"templates": { "templates": {
"commonclassrace": { "commonclassrace": {
@ -260,6 +264,9 @@
} }
} }
}, },
"genericitem": {
"description": ""
},
"condition": { "condition": {
"shortdescription": "", "shortdescription": "",
"description": "" "description": ""
@ -288,6 +295,7 @@
"skill": { "skill": {
"classskill": false, "classskill": false,
"unlimited": false, "unlimited": false,
"acquiredatlevel": 0,
"currentuse": 0, "currentuse": 0,
"maxuse": 0, "maxuse": 0,
"description": "" "description": ""

View File

@ -191,7 +191,7 @@
src="{{weapon.img}}" /></a> src="{{weapon.img}}" /></a>
<span class="item-name-label-long"><a class="roll-weapon"><i class="fa-solid fa-dice-d20"></i>{{weapon.name}}</a></span> <span class="item-name-label-long"><a class="roll-weapon"><i class="fa-solid fa-dice-d20"></i>{{weapon.name}}</a></span>
<span class="item-field-label-medium">{{weapon.system.weapontype}}</span> <span class="item-field-label-medium">{{localize (concat "WH.conf." weapon.system.weapontype)}}</span>
{{#if (eq system.weapontype "special")}} {{#if (eq system.weapontype "special")}}
<span class="item-field-label-medium"><a class="roll-damage"><i class="fa-solid fa-dice-d20"></i>{{weapon.system.damageformula}}</a></span> <span class="item-field-label-medium"><a class="roll-damage"><i class="fa-solid fa-dice-d20"></i>{{weapon.system.damageformula}}</a></span>
@ -306,7 +306,9 @@
<span class="item-field-label-medium">N/A</span> <span class="item-field-label-medium">N/A</span>
<span class="item-field-label-medium">N/A</span> <span class="item-field-label-medium">N/A</span>
{{else}} {{else}}
<span class="item-field-label-medium">{{skill.system.currentuse}}</span> <span class="item-field-label-medium">{{skill.system.currentuse}}
(<a class="skill-use-minus plus-minus-button">&nbsp;-</a>/<a class="skill-use-plus plus-minus-button">+</a>)
</span>
<span class="item-field-label-medium">{{skill.system.maxuse}}</span> <span class="item-field-label-medium">{{skill.system.maxuse}}</span>
{{/if}} {{/if}}

View File

@ -13,7 +13,7 @@
<div class="tab details" data-group="primary" data-tab="description"> <div class="tab details" data-group="primary" data-tab="description">
<label class="generic-label">{{localize "WH.ui.description"}}</label> <label class="generic-label">{{localize "WH.ui.description"}}</label>
<div class="medium-editor item-text-long-line"> <div class="editor item-text-long-line">
{{editor description target="system.description" button=true owner=owner editable=editable}} {{editor description target="system.description" button=true owner=owner editable=editable}}
</div> </div>
</div> </div>

View File

@ -0,0 +1,24 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="item-sheet-img" src="{{img}}" data-edit="img" title="{{name}}" />
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
</div>
</header>
{{> systems/fvtt-warhero/templates/partial-item-nav.html}}
{{!-- Sheet Body --}}
<section class="sheet-body">
{{> systems/fvtt-warhero/templates/partial-item-description.html}}
<div class="tab details" data-group="primary" data-tab="details">
<ul>
</ul>
</div>
</section>
</form>

View File

@ -13,7 +13,7 @@
<div class="tab details" data-group="primary" data-tab="description"> <div class="tab details" data-group="primary" data-tab="description">
<label class="generic-label">Description</label> <label class="generic-label">Description</label>
<div class="medium-editor item-text-long-line"> <div class="editor item-text-long-line">
{{editor description target="system.description" button=true owner=owner editable=editable}} {{editor description target="system.description" button=true owner=owner editable=editable}}
</div> </div>
</div> </div>

View File

@ -23,6 +23,10 @@
<input type="checkbox" name="system.unlimited" {{checked system.unlimited}}/> <input type="checkbox" name="system.unlimited" {{checked system.unlimited}}/>
</li> </li>
<li class="flexrow"><label class="item-field-label-long ">{{localize "WH.ui.skilllevelacquired"}}</label>
<input type="text" class="item-field-label-medium " name="system.acquiredatlevel" value="{{system.acquiredatlevel}}" data-dtype="Number"/>
</li>
{{#if system.unlimited}} {{#if system.unlimited}}
{{else}} {{else}}

View File

@ -1,7 +1,7 @@
<div class="tab description" data-group="primary" data-tab="description"> <div class="tab description" data-group="primary" data-tab="description">
<div> <div>
<label class="generic-label">{{localize "WH.ui.description"}}</label> <label class="generic-label">{{localize "WH.ui.description"}}</label>
<div class="medium-editor item-text-long-line"> <div class="editor item-text-long-line">
{{editor description target="system.description" button=true owner=owner editable=editable}} {{editor description target="system.description" button=true owner=owner editable=editable}}
</div> </div>
</div> </div>

View File

@ -26,7 +26,7 @@
{{#if is2hands}} {{#if is2hands}}
<span class="item-field-label-vlong">{{weapon.damageFormula2Hands}}</span> <span class="item-field-label-vlong">{{weapon.damageFormula2Hands}}</span>
{{else}} {{else}}
<span class="item-field-label-vlong">{{weapon.damage}}</span> <span class="item-field-label-vlong">{{weapon.damageFormula}}</span>
{{/if}} {{/if}}
</div> </div>
{{/if}} {{/if}}