Compare commits

...

8 Commits

13 changed files with 358 additions and 88 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

@@ -43,6 +43,7 @@ export class HeritiersActorSheet extends ActorSheet {
contacts: this.actor.organizeContacts(),
armes: duplicate(this.actor.getWeapons()),
monnaies: duplicate(this.actor.getMonnaies()),
pouvoirs: duplicate(this.actor.getPouvoirs()),
fee: duplicate(this.actor.getFee() || {} ),
protections: duplicate(this.actor.getArmors()),
combat: this.actor.getCombatValues(),
@@ -140,6 +141,16 @@ export class HeritiersActorSheet extends ActorSheet {
let compId = li.data("item-id")
this.actor.rollCompetence(compId)
})
html.find('.roll-attaque-arme').click((event) => {
const li = $(event.currentTarget).parents(".item")
let armeId = li.data("item-id")
this.actor.rollAttaqueArme(armeId)
})
html.find('.roll-pouvoir').click((event) => {
const li = $(event.currentTarget).parents(".item")
let pouvoirId = li.data("item-id")
this.actor.rollPouvoir(pouvoirId)
})
html.find('.item-add').click((event) => {
const itemType = $(event.currentTarget).data("type")

View File

@@ -39,7 +39,12 @@ export class HeritiersActor extends Actor {
if (data.type == 'personnage') {
const skills = await HeritiersUtility.loadCompendium("fvtt-les-heritiers.competences")
data.items = skills.map(i => i.toObject())
data.items = []
for (let skill of skills) {
if (skill.system.categorie == "utile") {
data.items.push(skill.toObject())
}
}
}
if (data.type == 'creature') {
const skills = await HeritiersUtility.loadCompendium("fvtt-les-heritiers.skills-creatures")
@@ -103,38 +108,46 @@ export class HeritiersActor extends Actor {
}
/* ----------------------- --------------------- */
getItemSorted( types) {
let items = this.items.filter(item => types.includes(item.type )) || []
HeritiersUtility.sortArrayObjectsByName(items)
return items
}
getEquipments() {
return this.items.filter(item => item.type == "equipement" || item.type == "accessoire")
return this.getItemSorted( ["equipement", "accessoire"] )
}
getAvantages() {
return this.items.filter(item => item.type == "avantage")
return this.getItemSorted( ["avantage"])
}
getDesavantages() {
return this.items.filter(item => item.type == "desavantage")
return this.getItemSorted( ["desavantage"])
}
getMonnaies() {
return this.items.filter(item => item.type == "monnaie")
return this.getItemSorted( ["monnaie"])
}
getArmors() {
return this.items.filter(item => item.type == "protection")
return this.getItemSorted( ["protection"])
}
getTalents() {
return this.items.filter(item => item.type == "talent")
return this.getItemSorted( ["talent"])
}
getContacts() {
return this.items.filter(item => item.type == "contact")
return this.getItemSorted( ["contact"])
}
getAtouts() {
return this.items.filter(item => item.type == "atoutfeerique")
return this.getItemSorted( ["atoutfeerique"])
}
getCapacites() {
return this.items.filter(item => item.type == "capacitenaturelle")
return this.getItemSorted( ["capacitenaturelle"])
}
getFee() {
return this.items.find(item => item.type == "fee")
return this.items.filter(item => item.type =="fee")
}
getProfils() {
return this.items.filter(item => item.type == "profil")
return this.getItemSorted( ["profil"])
}
getPouvoirs() {
return this.getItemSorted( ["pouvoir"])
}
/* -------------------------------------------- */
getSkills() {
@@ -152,7 +165,7 @@ export class HeritiersActor extends Actor {
prepareUtileSkill(item) {
let specList = []
if (item.system.categorie == "utile") {
for (let spec of item.system.specialites) {
for (let spec of item.system.specialites) {
specList.push(spec.name)
}
}
@@ -174,18 +187,24 @@ export class HeritiersActor extends Actor {
}
}
}
for (let key in comp) {
HeritiersUtility.sortArrayObjectsByName(comp[key])
}
return comp
}
/* -------------------------------------------- */
organizeContacts( ) {
organizeContacts() {
let contactList = {}
for (let item of this.items) {
if (item.type == "contact") {
let c = contactList[item.system.contacttype] || { label: game.system.lesheritiers.config.contactType[item.system.contacttype], list: [] }
c.list.push( item )
c.list.push(item)
contactList[item.system.contacttype] = c
}
}
for (let key in contactList) {
HeritiersUtility.sortArrayObjectsByName(contactList[key].list)
}
return contactList
}
@@ -199,6 +218,7 @@ export class HeritiersActor extends Actor {
}
}
}
HeritiersUtility.sortArrayObjectsByName(comp)
return HeritiersUtility.sortByName(comp)
}
@@ -279,10 +299,12 @@ export class HeritiersActor extends Actor {
let item = this.items.find(item => item.id == itemId)
if (item) {
console.log("Item ", item, itemField, dataType, value)
if (dataType.toLowerCase() == "number") {
value = Number(value)
} else {
value = String(value)
if (dataType) {
if (dataType.toLowerCase() == "number") {
value = Number(value)
} else {
value = String(value)
}
}
let update = { _id: item.id, [`system.${itemField}`]: value };
this.updateEmbeddedDocuments("Item", [update])
@@ -510,7 +532,7 @@ export class HeritiersActor extends Actor {
/* -------------------------------------------- */
async rollInitiative() {
let rollData = this.getCommonRollData(undefined, "Art de la guerre")
rollData.mode = "init"
rollData.mode = "init"
if (this.system.caracteristiques["san"].value > this.system.caracteristiques["per"].value) {
rollData.caracKey = "san"
} else {
@@ -520,11 +542,11 @@ export class HeritiersActor extends Actor {
let rollDialog = await HeritiersRollDialog.create(this, rollData)
rollDialog.render(true)
}
/* -------------------------------------------- */
async rollCarac(key, isInit = false) {
let rollData = this.getCommonRollData()
rollData.mode = "carac"
rollData.mode = "carac"
rollData.carac = this.system.caracteristiques[key]
rollData.caracKey = key
let rollDialog = await HeritiersRollDialog.create(this, rollData)
@@ -539,7 +561,43 @@ export class HeritiersActor extends Actor {
let rollDialog = await HeritiersRollDialog.create(this, rollData)
rollDialog.render(true)
}
/* -------------------------------------------- */
async rollAttaqueArme(armeId) {
let arme = this.items.get(armeId)
if (arme) {
let competenceName = "Tir"
let key = "prec"
if (arme.system.categorie == "blanche" || arme.system.categorie == "improvise") {
competenceName = "Mêlée"
key = "agi"
}
let rollData = this.getCommonRollData(undefined, competenceName)
rollData.carac = this.system.caracteristiques[key]
rollData.caracKey = key
rollData.arme = duplicate(arme)
rollData.mode = "arme"
let rollDialog = await HeritiersRollDialog.create(this, rollData)
rollDialog.render(true)
}
}
/* -------------------------------------------- */
async rollPouvoir(pouvoirId) {
let pouvoir = this.items.get(pouvoirId)
if (pouvoir) {
let rollData = this.getCommonRollData(undefined, undefined)
if ( pouvoir.system.feeriemasque != "autre") {
rollData.pouvoirBase = duplicate(this.system.rang[pouvoir.system.feeriemasque.toLowerCase()])
rollData.pouvoirBase.label = "Féerie"
rollData.carac = duplicate(this.system.caracteristiques[pouvoir.system.carac])
rollData.caracKey = pouvoir.system.carac
}
rollData.pouvoir = duplicate(pouvoir)
rollData.mode = "pouvoir"
let rollDialog = await HeritiersRollDialog.create(this, rollData)
rollDialog.render(true)
}
}
/* -------------------------------------------- */
async rollArmeOffensif(armeId) {
let arme = this.items.get(armeId)

View File

@@ -8,7 +8,7 @@ export const HERITIERS_CONFIG = {
"prec": "Précision",
"esp": "Esprit",
"per": "Perception",
"pres": "Présence",
"pres": "Prestance",
"san": "Sang-Froid"
},
@@ -34,7 +34,7 @@ export const HERITIERS_CONFIG = {
},
baseTestPouvoir: {
"feerie": "Féerie",
"Masque": "Masque",
"masque": "Masque",
"autre": "Autre"
},
resistancePouvoir: {

View File

@@ -16,7 +16,8 @@ export const defaultItemImg = {
accessoire: "systems/fvtt-les-heritiers/assets/icons/item.webp",
protection: "systems/fvtt-les-heritiers/assets/icons/armor.webp",
fee: "systems/fvtt-les-heritiers/assets/icons/faery_type.webp",
profil: "systems/fvtt-les-heritiers/assets/icons/profil.webp"
profil: "systems/fvtt-les-heritiers/assets/icons/profil.webp",
equipement: "systems/fvtt-les-heritiers/assets/icons/equipement.webp",
}
/**

View File

@@ -55,6 +55,21 @@ export class HeritiersUtility {
return 0;
})
}
/* -------------------------------------------- */
static sortArrayObjectsByName(myArray) {
myArray.sort((a, b) => {
let fa = a.name.toLowerCase();
let fb = b.name.toLowerCase();
if (fa < fb) {
return -1;
}
if (fa > fb) {
return 1;
}
return 0;
})
}
/* -------------------------------------------- */
static getSkills() {
@@ -347,15 +362,13 @@ export class HeritiersUtility {
let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0
let specBonus = (rollData.useSpecialite) ? 1 : 0
rollData.diceFormula += `+${rollData.carac.value}+${rollData.competence.system.niveau}+${specBonus}+${rollData.bonusMalusContext}+${compmod}`
} else if (rollData.pouvoirBase) {
rollData.diceFormula += `+${rollData.pouvoirBase.value}+${rollData.bonusMalusContext}`
} else {
rollData.diceFormula += `+${rollData.carac.value}+${rollData.bonusMalusContext}`
}
rollData.diceFormula += `+${rollData.pvMalus}`
if (rollData.arme && rollData.arme.type == "arme") {
rollData.diceFormula += `+${rollData.arme.system.bonusmaniementoff}`
}
let myRoll = new Roll(rollData.diceFormula).roll({ async: false })
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
rollData.roll = myRoll
@@ -367,6 +380,17 @@ export class HeritiersUtility {
actor.setFlag("world", "last-initiative", rollData.finalResult)
}
// Compute damages, cf p 187
if (rollData.arme && rollData.isSuccess) {
rollData.degatsArme = rollData.arme.system.degats + rollData.marge
if (rollData.arme.system.categorie == "lourde" ) {
rollData.degatsArme += actor.system.caracteristiques.for.value
}
if (rollData.arme.system.categorie == "blanche" || rollData.arme.system.categorie == "improvise" ) {
rollData.degatsArme += Math.max(0, actor.system.caracteristiques.for.value - 2)
}
}
this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-les-heritiers/templates/chat-generic-result.html`, rollData)
}, rollData)

File diff suppressed because one or more lines are too long

View File

@@ -647,7 +647,12 @@ ul, li {
margin: 4px 0;
padding-top: 7px;
}
.roll-style {
background-color: rgba(56, 32, 32, 0.4);
border-radius: 0.25rem;
padding-left: 0.25rem;
margin-right: 0.25rem;
}
.short-label {
flex-grow: 1;
}

View File

@@ -1,7 +1,7 @@
{
"id": "fvtt-les-heritiers",
"description": "Les Héritiers pour FoundryVTT",
"version": "10.0.18",
"version": "10.0.25",
"authors": [
{
"name": "Uberwald/LeRatierBretonnien",
@@ -19,7 +19,7 @@
"gridUnits": "m",
"license": "LICENSE.txt",
"manifest": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/raw/branch/master/system.json",
"download": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/archive/fvtt-les-heritiers-10.0.18.zip",
"download": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/archive/fvtt-les-heritiers-10.0.25.zip",
"languages": [
{
"lang": "fr",

View File

@@ -97,8 +97,8 @@
"max": 1
},
"pres": {
"label": "Présence",
"labelnorm": "presence",
"label": "Prestance",
"labelnorm": "prestance",
"abbrev": "pre",
"kind": "mental",
"value": 1,

View File

@@ -14,7 +14,7 @@
{{#each system.caracteristiques as |carac key|}}
{{#if (eq kind "physical")}}
<li class="item flexrow ">
<h4 class="item-name-label competence-name"><a class="roll-carac" data-key="{{key}}">{{carac.label}}</a></h4>
<h4 class="item-name-label competence-name roll-style"><a class="roll-carac" data-key="{{key}}">{{carac.label}}</a></h4>
<input type="text" class="padd-right status-small-label color-class-common item-field-label-short"
name="system.caracteristiques.{{key}}.value" value="{{carac.value}}" data-dtype="Number" />
<input type="text" class="padd-right status-small-label color-class-common item-field-label-short"
@@ -30,7 +30,7 @@
{{#each system.caracteristiques as |carac key|}}
{{#if (eq kind "mental")}}
<li class="item flexrow ">
<h4 class="item-name-label competence-name"><a class="roll-carac" data-key="{{key}}">{{carac.label}}</a></h4>
<h4 class="item-name-label competence-name roll-style"><a class="roll-carac" data-key="{{key}}">{{carac.label}}</a></h4>
<input type="text" class="padd-right status-small-label color-class-common item-field-label-short"
name="system.caracteristiques.{{key}}.value" value="{{carac.value}}" data-dtype="Number" />
<input type="text" class="padd-right status-small-label color-class-common item-field-label-short"
@@ -92,7 +92,7 @@
</li>
{{#each skillList as |skill key|}}
<li class="item flexrow " data-item-id="{{skill._id}}" data-item-type="competence">
<span class="item-field-label-long"><a class="roll-competence item-field-label-short"
<span class="item-field-label-long roll-style"><a class="roll-competence item-field-label-short"
data-attr-key="tochoose">{{skill.name}}</a></span>
<select class="item-field-label-short edit-item-data" type="text"
data-item-field="niveau" value="{{skill.system.niveau}}" data-dtype="Number">
@@ -101,12 +101,13 @@
{{/select}}
</select>
<input type="checkbox" class="item-field-label-short" name="skill.system.predilection" {{checked skill.system.predilection}}/>
<input type="checkbox" class="item-field-label-short edit-item-data" data-item-field="predilection" {{checked skill.system.predilection}}/>
<span class="item-field-label-long2">{{skill.specList}}</span>
<div class="item-controls item-controls-fixed">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
@@ -127,10 +128,10 @@
</li>
{{#each futileSkills as |skill key|}}
<li class="item flexrow " data-item-id="{{skill._id}}" data-item-type="competence">
<span class="item-field-label-long2"><a class="roll-competence item-field-label-short"
<span class="item-field-label-long2 roll-style"><a class="roll-competence item-field-label-short"
data-attr-key="tochoose">{{skill.name}}</a></span>
<select class="item-field-label-short" type="text"
<select class="item-field-label-short edit-item-data" type="text"
data-item-field="niveau" value="{{skill.system.niveau}}" data-dtype="Number">
{{#select skill.system.niveau}}
{{> systems/fvtt-les-heritiers/templates/partial-list-niveau.html}}
@@ -207,9 +208,6 @@
<span class="item-field-label-short">
<label class="short-label">Attaque</label>
</span>
<span class="item-field-label-short">
<label class="short-label">Défense</label>
</span>
<span class="item-field-label-short">
<label class="short-label">Dégats</label>
</span>
@@ -225,11 +223,11 @@
<span class="item-name-label competence-name">{{arme.name}}</span>
<span class="item-field-label-short">
<button class="roll-arme-offensif button-sheet-roll">Attaquer</button>
<button class="roll-attaque-arme button-sheet-roll">Attaquer</button>
</span>
<span class="item-field-label-short">
<button class="roll-arme-degats button-sheet-roll">{{arme.system.totalDegats}}</button>
{{arme.system.degats}}
</span>
<div class="item-filler">&nbsp;</div>
@@ -382,6 +380,48 @@
</ul>
</div>
<div class="sheet-box color-bg-archetype">
<ul class="item-list alternate-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header item-field-label-long2-img">
<h3><label class="items-title-text">Pouvoirs</label></h3>
</span>
<span class="item-field-label-medium">
<label class="short-label">Masque</label>
</span>
<span class="item-field-label-medium">
<label class="short-label">Type</label>
</span>
<span class="item-field-label-medium">
<label class="short-label">Niveau</label>
</span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
</div>
</li>
{{#each pouvoirs as |pouvoir key|}}
<li class="item flexrow " data-item-id="{{pouvoir._id}}" data-item-type="pouvoir">
<img class="item-name-img" src="{{pouvoir.img}}" />
{{#if pouvoir.system.istest}}
<span class="item-field-label-long2 roll-style"><a class="roll-pouvoir">{{pouvoir.name}}</a></span>
{{else}}
<span class="item-field-label-long2">{{pouvoir.name}}</span>
{{/if}}
<span class="item-field-label-medium">{{upperFirst pouvoir.system.masquetype}}</span>
<span class="item-field-label-medium">{{upperFirst pouvoir.system.pouvoirtype}}</span>
<span class="item-field-label-medium">{{upperFirst pouvoir.system.niveau}}</span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</div>
<div class="sheet-box color-bg-archetype">
<ul class="item-list alternate-list">
<li class="item flexrow list-item items-title-bg">
@@ -421,7 +461,8 @@
<h3><label class="items-title-text">Equipements</label></h3>
</span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<div class="item-controls item-controls-fixed">
<a class="item-control item-add" data-type="equipement" title="Créer un équipement"><i class="fas fa-plus"></i></a>
</div>
</li>
{{#each equipements as |equip key|}}
@@ -441,7 +482,20 @@
{{!-- Contact Tab --}}
<div class="tab contact" data-group="primary" data-tab="contact">
<div class="sheet-box color-bg-archetype">
<ul class="item-list alternate-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header item-field-label-long3">
<h3><label class="items-title-text">Contacts, Allies et Ennemis</label></h3>
</span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<a class="item-control item-add" data-type="contact" title="Créer un contact"><i class="fas fa-plus"></i></a>
</div>
</li>
</div>
{{#each contacts as |contactList idx|}}
<div class="sheet-box color-bg-archetype">
<ul class="item-list alternate-list">
@@ -450,7 +504,8 @@
<h3><label class="items-title-text">{{contactList.label}}</label></h3>
</span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<div class="item-controls item-controls-fixed">
<a class="item-control item-add" data-type="contact" title="Créer un contact"><i class="fas fa-plus"></i></a>
</div>
</li>
{{#each contactList.list as |contact key|}}

View File

@@ -27,14 +27,26 @@
{{/if}}
{{/if}}
<li>Formule : {{diceFormula}}</li>
<li>Résultat du dé : {{diceResult}}</li>
{{#if arme}}
<li>Attaque avec : {{arme.name}}</li>
{{/if}}
{{#if pouvoir}}
<li>Pouvoir : {{pouvoir.name}}</li>
<li>Effet : {{pouvoir.system.effet}}</li>
{{/if}}
<li>Formule : {{diceFormula}}</li>
<li>Résultat du dé : {{diceResult}} </li>
<li>Total : {{finalResult}} (Marge : {{marge}})</li>
<li>Total : {{finalResult}}</li>
{{#if sdValue}}
{{#if isSuccess}}
<li class="chat-success">Succés...
{{#if arme}}
<li>Dégats : {{degatsArme}}</li>
{{/if}}
</li>
{{else}}
<li class="chat-failure">Echec...</li>
@@ -43,6 +55,9 @@
{{#if isCriticalSuccess}}
<li class="chat-success">Réussite Critique !!!</li>
{{#if arme}}
<li>Vous pouvez augmenter les dégats de +2 ou bien bénéficier d'une Aubaine.</li>
{{/if}}
{{/if}}
{{#if isCriticalFailure}}
<li class="chat-failure">Echec Critique !!!</li>

View File

@@ -42,6 +42,23 @@
{{/if}}
{{/if}}
{{#if pouvoir}}
<div class="flexrow">
<span class="roll-dialog-label">Pouvoir : </span>
<span class="small-label roll-dialog-label">{{pouvoir.name}}</span>
</div>
<div class="flexrow">
<span class="roll-dialog-label">Activation : </span>
<span class="small-label roll-dialog-label">{{pouvoir.system.activation}}</span>
</div>
{{#if pouvoirBase}}
<div class="flexrow">
<span class="roll-dialog-label">{{pouvoirBase.label}} : </span>
<span class="small-label roll-dialog-label">{{pouvoirBase.value}}</span>
</div>
{{/if}}
{{/if}}
<div class="flexrow">
<span class="roll-dialog-label">Malus de Santé</span>
<span class="small-label roll-dialog-label">{{pvMalus}}</span>