Diverses ameliorations

This commit is contained in:
LeRatierBretonnien 2023-03-09 13:16:19 +01:00
parent b0a3cb08cb
commit 11b0f22aa7
12 changed files with 136 additions and 25 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

@ -146,6 +146,11 @@ export class HeritiersActorSheet extends ActorSheet {
let armeId = li.data("item-id") let armeId = li.data("item-id")
this.actor.rollAttaqueArme(armeId) 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) => { html.find('.item-add').click((event) => {
const itemType = $(event.currentTarget).data("type") const itemType = $(event.currentTarget).data("type")

View File

@ -42,8 +42,8 @@ export class HeritiersActor extends Actor {
data.items = [] data.items = []
for (let skill of skills) { for (let skill of skills) {
if (skill.system.categorie == "utile") { if (skill.system.categorie == "utile") {
data.items.push( skill.toObject()) data.items.push(skill.toObject())
} }
} }
} }
if (data.type == 'creature') { if (data.type == 'creature') {
@ -162,7 +162,7 @@ export class HeritiersActor extends Actor {
prepareUtileSkill(item) { prepareUtileSkill(item) {
let specList = [] let specList = []
if (item.system.categorie == "utile") { if (item.system.categorie == "utile") {
for (let spec of item.system.specialites) { for (let spec of item.system.specialites) {
specList.push(spec.name) specList.push(spec.name)
} }
} }
@ -190,12 +190,12 @@ export class HeritiersActor extends Actor {
return comp return comp
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
organizeContacts( ) { organizeContacts() {
let contactList = {} let contactList = {}
for (let item of this.items) { for (let item of this.items) {
if (item.type == "contact") { if (item.type == "contact") {
let c = contactList[item.system.contacttype] || { label: game.system.lesheritiers.config.contactType[item.system.contacttype], list: [] } 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 contactList[item.system.contacttype] = c
} }
} }
@ -524,7 +524,7 @@ export class HeritiersActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async rollInitiative() { async rollInitiative() {
let rollData = this.getCommonRollData(undefined, "Art de la guerre") 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) { if (this.system.caracteristiques["san"].value > this.system.caracteristiques["per"].value) {
rollData.caracKey = "san" rollData.caracKey = "san"
} else { } else {
@ -534,11 +534,11 @@ export class HeritiersActor extends Actor {
let rollDialog = await HeritiersRollDialog.create(this, rollData) let rollDialog = await HeritiersRollDialog.create(this, rollData)
rollDialog.render(true) rollDialog.render(true)
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async rollCarac(key, isInit = false) { async rollCarac(key, isInit = false) {
let rollData = this.getCommonRollData() let rollData = this.getCommonRollData()
rollData.mode = "carac" rollData.mode = "carac"
rollData.carac = this.system.caracteristiques[key] rollData.carac = this.system.caracteristiques[key]
rollData.caracKey = key rollData.caracKey = key
let rollDialog = await HeritiersRollDialog.create(this, rollData) let rollDialog = await HeritiersRollDialog.create(this, rollData)
@ -563,13 +563,32 @@ export class HeritiersActor extends Actor {
competenceName = "Mêlée" competenceName = "Mêlée"
key = "agi" key = "agi"
} }
let rollData = this.getCommonRollData(undefined, competenceName ) let rollData = this.getCommonRollData(undefined, competenceName)
rollData.carac = this.system.caracteristiques[key] rollData.carac = this.system.caracteristiques[key]
rollData.caracKey = key rollData.caracKey = key
rollData.arme = duplicate(arme)
rollData.mode = "arme" rollData.mode = "arme"
let rollDialog = await HeritiersRollDialog.create(this, rollData) let rollDialog = await HeritiersRollDialog.create(this, rollData)
rollDialog.render(true) 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) { async rollArmeOffensif(armeId) {

View File

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

View File

@ -16,7 +16,8 @@ export const defaultItemImg = {
accessoire: "systems/fvtt-les-heritiers/assets/icons/item.webp", accessoire: "systems/fvtt-les-heritiers/assets/icons/item.webp",
protection: "systems/fvtt-les-heritiers/assets/icons/armor.webp", protection: "systems/fvtt-les-heritiers/assets/icons/armor.webp",
fee: "systems/fvtt-les-heritiers/assets/icons/faery_type.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

@ -362,15 +362,13 @@ export class HeritiersUtility {
let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0 let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0
let specBonus = (rollData.useSpecialite) ? 1 : 0 let specBonus = (rollData.useSpecialite) ? 1 : 0
rollData.diceFormula += `+${rollData.carac.value}+${rollData.competence.system.niveau}+${specBonus}+${rollData.bonusMalusContext}+${compmod}` 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 { } else {
rollData.diceFormula += `+${rollData.carac.value}+${rollData.bonusMalusContext}` rollData.diceFormula += `+${rollData.carac.value}+${rollData.bonusMalusContext}`
} }
rollData.diceFormula += `+${rollData.pvMalus}` 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 }) let myRoll = new Roll(rollData.diceFormula).roll({ async: false })
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode")) await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
rollData.roll = myRoll rollData.roll = myRoll
@ -382,6 +380,17 @@ export class HeritiersUtility {
actor.setFlag("world", "last-initiative", rollData.finalResult) 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, { this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-les-heritiers/templates/chat-generic-result.html`, rollData) content: await renderTemplate(`systems/fvtt-les-heritiers/templates/chat-generic-result.html`, rollData)
}, rollData) }, rollData)

File diff suppressed because one or more lines are too long

View File

@ -647,7 +647,12 @@ ul, li {
margin: 4px 0; margin: 4px 0;
padding-top: 7px; 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 { .short-label {
flex-grow: 1; flex-grow: 1;
} }

View File

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

View File

@ -92,7 +92,7 @@
</li> </li>
{{#each skillList as |skill key|}} {{#each skillList as |skill key|}}
<li class="item flexrow " data-item-id="{{skill._id}}" data-item-type="competence"> <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> data-attr-key="tochoose">{{skill.name}}</a></span>
<select class="item-field-label-short edit-item-data" type="text" <select class="item-field-label-short edit-item-data" type="text"
data-item-field="niveau" value="{{skill.system.niveau}}" data-dtype="Number"> data-item-field="niveau" value="{{skill.system.niveau}}" data-dtype="Number">
@ -128,7 +128,7 @@
</li> </li>
{{#each futileSkills as |skill key|}} {{#each futileSkills as |skill key|}}
<li class="item flexrow " data-item-id="{{skill._id}}" data-item-type="competence"> <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> data-attr-key="tochoose">{{skill.name}}</a></span>
<select class="item-field-label-short" type="text" <select class="item-field-label-short" type="text"
@ -227,7 +227,7 @@
</span> </span>
<span class="item-field-label-short"> <span class="item-field-label-short">
<button class="roll-arme-degats button-sheet-roll">{{arme.system.totalDegats}}</button> {{arme.system.degats}}
</span> </span>
<div class="item-filler">&nbsp;</div> <div class="item-filler">&nbsp;</div>
@ -402,7 +402,11 @@
{{#each pouvoirs as |pouvoir key|}} {{#each pouvoirs as |pouvoir key|}}
<li class="item flexrow " data-item-id="{{pouvoir._id}}" data-item-type="pouvoir"> <li class="item flexrow " data-item-id="{{pouvoir._id}}" data-item-type="pouvoir">
<img class="item-name-img" src="{{pouvoir.img}}" /> <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> <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.masquetype}}</span>
<span class="item-field-label-medium">{{upperFirst pouvoir.system.pouvoirtype}}</span> <span class="item-field-label-medium">{{upperFirst pouvoir.system.pouvoirtype}}</span>
<span class="item-field-label-medium">{{upperFirst pouvoir.system.niveau}}</span> <span class="item-field-label-medium">{{upperFirst pouvoir.system.niveau}}</span>
@ -458,6 +462,8 @@
</span> </span>
<div class="item-filler">&nbsp;</div> <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>
</div> </div>
</li> </li>
{{#each equipements as |equip key|}} {{#each equipements as |equip key|}}

View File

@ -27,14 +27,26 @@
{{/if}} {{/if}}
{{/if}} {{/if}}
<li>Formule : {{diceFormula}}</li> {{#if arme}}
<li>Résultat du dé : {{diceResult}}</li> <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 sdValue}}
{{#if isSuccess}} {{#if isSuccess}}
<li class="chat-success">Succés... <li class="chat-success">Succés...
{{#if arme}}
<li>Dégats : {{degatsArme}}</li>
{{/if}}
</li> </li>
{{else}} {{else}}
<li class="chat-failure">Echec...</li> <li class="chat-failure">Echec...</li>
@ -43,6 +55,9 @@
{{#if isCriticalSuccess}} {{#if isCriticalSuccess}}
<li class="chat-success">Réussite Critique !!!</li> <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}}
{{#if isCriticalFailure}} {{#if isCriticalFailure}}
<li class="chat-failure">Echec Critique !!!</li> <li class="chat-failure">Echec Critique !!!</li>

View File

@ -42,6 +42,23 @@
{{/if}} {{/if}}
{{/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"> <div class="flexrow">
<span class="roll-dialog-label">Malus de Santé</span> <span class="roll-dialog-label">Malus de Santé</span>
<span class="small-label roll-dialog-label">{{pvMalus}}</span> <span class="small-label roll-dialog-label">{{pvMalus}}</span>