Lates fixes

This commit is contained in:
LeRatierBretonnien 2023-02-07 15:18:00 +01:00
parent 7d8791f675
commit cae8cd5ae8
15 changed files with 230 additions and 103 deletions

View File

@ -70,12 +70,18 @@
"WH.ui.parrybonustotal": "Parry bonus total",
"WH.ui.drbonustotal": "DR bonus total",
"WH.ui.counterspell": "Counter spell",
"WH.ui.createitem": "Create item",
"WH.ui.createitem": "Bonus to percentage throws",
"WH.ui.classSkills": "Class Skills",
"WH.ui.skills": "Skills",
"WH.ui.skills": "Skills based on level",
"WH.ui.isclassskill": "Class skill ?",
"WH.ui.unlimited": "Unlimited use ?",
"WH.ui.currentuse": "Current use",
"WH.ui.maxuse": "Max use",
"WH.ui.languages": "Languages"
"WH.ui.languages": "Languagess",
"WH.ui.languagesbonus": "Bonus Languages (mind/2)",
"WH.ui.competency": "Competency",
"WH.ui.conditions": "Conditions",
"WH.ui.effect": "Effect",
"WH.chat.save": "Save"
}

View File

@ -46,12 +46,14 @@ export class WarheroActorSheet extends ActorSheet {
classSkills: this.actor.getClassSkills( ),
languages: this.actor.getLanguages( ),
weapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getWeapons()) ),
conditions: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getConditions()) ),
armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())),
shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields())),
powers: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getPowers())),
equipments: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getEquipmentsOnly()) ),
slotEquipments: this.actor.buildEquipmentsSlot(),
subActors: duplicate(this.actor.getSubActors()),
competency: this.actor.getCompetency(),
race: duplicate(race),
class: duplicate(this.actor.getClass()),
moneys: duplicate(this.actor.getMoneys()),

View File

@ -203,6 +203,12 @@ export class WarheroActor extends Actor {
return comp;
}
/* -------------------------------------------- */
getConditions() {
let comp = duplicate(this.items.filter(item => item.type == 'condition') || []);
WarheroUtility.sortArrayObjectsByName(comp)
return comp;
}
/* -------------------------------------------- */
getItemById(id) {
let item = this.items.find(item => item.id == id);
if (item) {
@ -365,6 +371,28 @@ export class WarheroActor extends Actor {
this.update({ 'system.secondary.hp': hp })
return Number(dmgRoll.total)
}
/* -------------------------------------------- */
updateCompetency(competency, obj) {
for(let key in obj) {
if (obj[key]) {
competency[key] = true
}
}
}
getCompetency() {
let myRace = this.getRace()
let myClass = this.getClass()
let competency = { weapons: {}, armors: {}, shields: {}}
if ( myRace.system && myClass.system) {
this.updateCompetency(competency.weapons, myRace.system.weapons)
this.updateCompetency(competency.armors, myRace.system.armors)
this.updateCompetency(competency.shields, myRace.system.shields)
this.updateCompetency(competency.weapons, myClass.system.weapons)
this.updateCompetency(competency.armors, myClass.system.armors)
this.updateCompetency(competency.shields, myClass.system.shields)
}
return competency
}
/* -------------------------------------------- */
getAbility(abilKey) {
@ -549,7 +577,7 @@ export class WarheroActor extends Actor {
/* -------------------------------------------- */
setLevel() {
let xp = this.system.secondary.xp.value
this.system.secondary.xp.level = Math.floor(xp/10)
this.system.secondary.xp.level = 1 + Math.floor(xp/10)
}
/* -------------------------------------------- */
computeDRTotal() {

View File

@ -519,12 +519,18 @@ export class WarheroUtility {
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
}
rollData.roll = myRoll
rollData.diceFormula = diceFormula
rollData.diceResult = myRoll.terms[0].results[0].result
rollData.isSuccess = false
if (myRoll.total >= 12 || myRoll.terms[0].results[0].result == 12) {
if (myRoll.total >= 12 || rollData.diceResult == 12) {
rollData.isSuccess = true
if (rollData.diceResult == 12) {
rollData.isCriticalSuccess = true
}
if (myRoll.terms[0].results[0].result == 1) {
}
if (rollData.diceResult == 1) {
rollData.isSuccess = false
rollData.isCriticalFailure = true
}
let msg = await this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-warhero/templates/chat-parry-result.html`, rollData)
@ -554,6 +560,8 @@ export class WarheroUtility {
let myRoll = new Roll(rollData.weapon.damageFormula + "+" + rollData.bonusMalus).roll({ async: false })
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
rollData.roll = myRoll
rollData.diceFormula = myRoll.formula
rollData.diceResult = myRoll.terms[0].results[0].result
let msg = await this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-warhero/templates/chat-generic-result.html`, rollData)
@ -571,7 +579,6 @@ export class WarheroUtility {
diceFormula += "+" + rollData.mWeaponMalus
}
diceFormula += "+" + rollData.bonusMalus
rollData.diceFormula = diceFormula
// Performs roll
console.log("Roll formula", diceFormula)
@ -581,6 +588,14 @@ export class WarheroUtility {
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
}
rollData.roll = myRoll
rollData.diceFormula = diceFormula
rollData.diceResult = myRoll.terms[0].results[0].result
if (rollData.diceResult == 20) {
rollData.isCriticalSuccess = true
}
if (rollData.diceResult == 1) {
rollData.isCriticalFailure = true
}
let msg = await this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-warhero/templates/chat-generic-result.html`, rollData)

View File

@ -1495,3 +1495,9 @@
form .notes {
color: rgba(214, 230, 230, 0.95);
}
.crit-success {
color: darkgreen;
}
.crit-failure {
color: darkred;
}

View File

@ -100,7 +100,7 @@
"styles": [
"styles/simple.css"
],
"version": "10.0.18",
"version": "10.0.19",
"compatibility": {
"minimum": "10",
"verified": "10",
@ -108,7 +108,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.18.zip",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-warhero/archive/fvtt-warhero-10.0.19.zip",
"url": "https://www.uberwald.me/gitea/public/fvtt-warhero",
"background": "images/ui/warhero_welcome_page.webp",
"id": "fvtt-warhero"

View File

@ -56,6 +56,7 @@
"abbrev": "hp",
"style": "edit",
"hasmax": true,
"isheader": true,
"max": 1,
"value": 1
},
@ -98,6 +99,7 @@
"abbrev": "pm",
"style": "edit",
"hasmax": true,
"isheader": true,
"max": 1,
"value": 1
},
@ -187,7 +189,7 @@
"value": 0
},
"nblanguage": {
"label": "WH.ui.languages",
"label": "WH.ui.languagesbonus",
"abbrev": "nblanguage",
"style": "edit",
"disabled": true,
@ -208,14 +210,15 @@
}
},
"Item": {
"types": [ "equipment", "race", "weapon", "armor", "shield", "money" , "skill", "power", "language", "condition", "class"],
"types": [ "equipment", "race", "weapon", "armor", "shield", "skill", "power", "language", "condition", "class"],
"templates": {
"commonclassrace": {
"weapons": {
"short": false,
"long": false,
"twohanded": false,
"shotgun": false,
"shooting": false,
"polearm": false,
"throwing": false
},
"armors": {
@ -231,6 +234,7 @@
}
},
"condition": {
"shortdescription": "",
"description": ""
},
"class": {
@ -247,6 +251,7 @@
"templates": ["commonclassrace"]
},
"language": {
"shortdescription": "",
"description": ""
},
"skill": {
@ -303,11 +308,6 @@
"level4_2": "",
"description": ""
},
"money" : {
"value": 0,
"quantity": 0,
"description": ""
},
"spell":{
"lore": "",
"circle": 1,

View File

@ -23,11 +23,17 @@
<label class="item-field-label-medium">Race</label>
<a class="item-edit"><img class="sheet-competence-img" src="{{race.img}}"></a>
<input type="text" class="item-field-label-medium" disabled value="{{race.name}}" data-dtype="String" />
<div class="item-controls item-controls-fixed">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
<li class="item flexrow list-item" data-item-id="{{class._id}}">
<label class="item-field-label-medium">Class</label>
<a class="item-edit"><img class="sheet-competence-img" src="{{class.img}}"></a>
<input type="text" class="item-field-label-medium" disabled value="{{class.name}}" data-dtype="String" />
<div class="item-controls item-controls-fixed">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
<li class="item flexrow list-item" >
<label class="item-field-label-medium">Religion</label>
@ -35,6 +41,18 @@
</li>
</ul>
</div>
</div>
<div class="flexrow">
{{#each system.attributes as |attr key|}}
{{#if attr.isheader}}
<div class="flexrow">
{{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=attr key=key path="attributes" fieldClass="item-field-label-medium"}}
</div>
{{/if}}
{{/each}}
</ul>
</div>
</div>
@ -65,18 +83,47 @@
<div class="ability-item">
<ul>
{{#each system.attributes as |attr key|}}
{{#if (not attr.isheader)}}
{{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=attr key=key path="attributes" fieldClass="item-field-label-vlong"}}
{{/if}}
{{/each}}
</ul>
<div>
<ul class="stat-list alternate-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header-long">
<h3><label class="items-title-text">{{localize "WH.ui.competency"}}</label></h3>
</span>
</li>
{{#each competency.weapons as |flag key|}}
{{#if flag}}
<li class="item flexrow list-item list-item-shadow" data-item-id="{{language._id}}">
<span class="item-name-label-long">{{localize "WH.ui.weapons"}} {{key}}</span>
</li>
{{/if}}
{{/each}}
{{#each competency.shields as |flag key|}}
{{#if flag}}
<li class="item flexrow list-item list-item-shadow" data-item-id="{{language._id}}">
<span class="item-name-label-long">{{localize "WH.ui.shields"}} {{key}}</span>
</li>
{{/if}}
{{/each}}
{{#each competency.armors as |flag key|}}
{{#if flag}}
<li class="item flexrow list-item list-item-shadow" data-item-id="{{language._id}}">
<span class="item-name-label-long">{{localize "WH.ui.armors"}} {{key}}</span>
</li>
{{/if}}
{{/each}}
</ul>
</div>
</div>
<div class="ability-item">
<ul>
{{#each system.secondary as |second key|}}
{{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=second key=key path="secondary" fieldClass="item-field-label-vlong"}}
{{/each}}
<li class="item flexrow list-item item-stat-roll" data-attr-key="{{key}}">
<span class="item-field-label-vlong" name="{{key}}">
<h4 class="item-field-label-vlong">
@ -86,7 +133,35 @@
<span class="item-field-label-long" >{{hpprogression}}</span>
</li>
{{#each system.secondary as |second key|}}
{{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=second key=key path="secondary" fieldClass="item-field-label-vlong"}}
{{/each}}
</ul>
<div>
<ul class="stat-list alternate-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header-long">
<h3><label class="items-title-text">{{localize "WH.ui.languages"}}</label></h3>
</span>
</li>
{{#each languages as |language key|}}
<li class="item flexrow list-item list-item-shadow" data-item-id="{{language._id}}">
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
src="{{language.img}}" /></a>
<span class="item-name-label-long">{{language.name}}</span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</div>
</div>
</div>
@ -242,6 +317,12 @@
<span class="item-name-label-header-long">
<h3><label class="items-title-text">{{localize "WH.ui.skills"}}</label></h3>
</span>
<span class="item-field-label-medium">
<label class="short-label">{{localize "WH.ui.currentuse"}}</label>
</span>
<span class="item-field-label-medium">
<label class="short-label">{{localize "WH.ui.maxuse"}}</label>
</span>
</li>
{{#each skills as |skill key|}}
<li class="item flexrow list-item list-item-shadow" data-item-id="{{skill._id}}">
@ -249,6 +330,14 @@
src="{{skill.img}}" /></a>
<span class="item-name-label-long">{{skill.name}}</span>
{{#if skill.system.unlimited}}
<span class="item-field-label-medium">N/A</span>
<span class="item-field-label-medium">N/A</span>
{{else}}
<span class="item-field-label-medium">{{skill.system.currentuse}}</span>
<span class="item-field-label-medium">{{skill.system.maxuse}}</span>
{{/if}}
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
@ -262,14 +351,19 @@
<ul class="stat-list alternate-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header-long">
<h3><label class="items-title-text">{{localize "WH.ui.languages"}}</label></h3>
<h3><label class="items-title-text">{{localize "WH.ui.conditions"}}</label></h3>
</span>
<span class="item-field-label-medium">
<label class="short-label">{{localize "WH.ui.effect"}}</label>
</span>
</li>
{{#each languages as |language key|}}
<li class="item flexrow list-item list-item-shadow" data-item-id="{{language._id}}">
{{#each conditions as |cond key|}}
<li class="item flexrow list-item list-item-shadow" data-item-id="{{cond._id}}">
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
src="{{language.img}}" /></a>
<span class="item-name-label-long">{{language.name}}</span>
src="{{cond.img}}" /></a>
<span class="item-name-label-long">{{cond.name}}</span>
<span class="item-field-label-medium">{{cond.system.shortdescription}}</span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
@ -280,6 +374,7 @@
</ul>
</div>
</div>
</div>

View File

@ -15,20 +15,36 @@
<div>
<ul>
{{#if (eq mode "save")}}
<li>{{localize "WH.chat.save"}} {{localize stat.label}} : {{stat.save}}</li>
{{else}}
{{#if stat}}
<li>{{localize stat.label}} : {{stat.value}}</li>
{{/if}}
{{/if}}
{{#if weapon}}
<li>{{localize "WH.ui.weapon"}} : {{weapon.name}}</li>
{{/if}}
{{#if hasBM}}
<li>Bonus/Malus : {{bonusMalus}}</li>
{{/if}}
*
{{#if usemWeaponMalus}}
<li>Multiple weapons malus : {{mWeaponMalus}}</li>
{{/if}}
<li>Formula : {{diceFormula}}</li>
{{#if isCriticalSuccess}}
<li><span class="crit-success">Dice result : {{diceResult}}</span></li>
{{else}}
{{#if isCriticalFailure}}
<li><span class="crit-failure">Dice result : {{diceResult}}</span></li>
{{else}}
<li>Dice result : <span>{{diceResult}}</span></li>
{{/if}}
{{/if}}
{{#if power}}
<li>{{localize "WH.ui.power"}} : {{power.name}}</li>
<li>{{{powerText}}}</li>

View File

@ -17,6 +17,18 @@
<ul>
<li>{{localize stat.label}} : {{stat.value}}</li>
<li><strong>Result : {{roll.total}} </strong></li>
<li>Formula : {{diceFormula}}</li>
{{#if isCriticalSuccess}}
<li><span class="crit-success">Dice result : {{diceResult}}</span></li>
{{else}}
{{#if isCriticalFailure}}
<li><span class="crit-failure">Dice result : {{diceResult}}</span></li>
{{else}}
<li>Dice result : <span>{{diceResult}}</span></li>
{{/if}}
{{/if}}
{{#if isSuccess}}
<li><strong>Parry success ! </strong></li>
{{else}}

View File

@ -21,6 +21,10 @@
<div class="tab details" data-group="primary" data-tab="details">
<ul>
<li class="flexrow"><label class="item-field-label-long ">{{localize "WH.ui.effect"}}</label>
<input type="text" class="item-field-label-long" name="system.shortdescription" value="{{system.shortdescription}}" data-dtype="String"/>
</li>
</ul>
</div>

View File

@ -1,28 +0,0 @@
<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>
<li class="flexrow"><label class="item-field-label-medium ">Quantity</label>
<input type="text" class="item-field-label-medium " name="system.quantity" value="{{system.quantity}}" data-dtype="Number"/>
</li>
<li class="flexrow"><label class="item-field-label-medium">Unit value</label>
<input type="text" class="item-field-label-medium " name="system.value" value="{{system.value}}" data-dtype="Number"/>
</li>
</ul>
</div>
</section>
</form>

View File

@ -1,28 +0,0 @@
<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">
<div class="tab details" data-group="primary" data-tab="description">
<label class="generic-label">Description</label>
<div class="medium-editor item-text-long-line">
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</div>
<div class="tab details" data-group="primary" data-tab="details">
<ul>
</ul>
</div>
</section>
</form>

View File

@ -18,7 +18,7 @@
<li class="flexrow"><label class="item-field-label-long ">{{localize "WH.ui.isclassskill"}}</label>
<input type="checkbox" name="system.classskill" {{checked system.classskill}}/>
</li>
{{#if system.classskill}}
<li class="flexrow"><label class="item-field-label-long ">{{localize "WH.ui.unlimited"}}</label>
<input type="checkbox" name="system.unlimited" {{checked system.unlimited}}/>
</li>
@ -33,7 +33,6 @@
<input type="text" class="item-field-label-medium " name="system.maxuse" value="{{system.maxuse}}" data-dtype="Number"/>
</li>
{{/if}}
{{/if}}
</ul>
</div>

View File

@ -37,7 +37,7 @@
<span class="item-field-label-short" name="{{key}}">
<h4 class="item-field-label-short">
<i class="fa-solid fa-dice-d20"></i>
<a class="roll-this stat-margin" data-is-save="yes" data-type="{{path}}" data-key="{{key}}">
<a class="roll-save stat-margin" data-type="{{path}}" data-key="{{key}}">
{{localize "WH.ui.save"}}
</a>
</h4>