v11 #714

Merged
uberwald merged 5 commits from VincentVk/foundryvtt-reve-de-dragon:v11 into v11 2024-10-11 17:42:24 +02:00
7 changed files with 36 additions and 23 deletions
Showing only changes of commit 99f5578c4f - Show all commits

View File

@ -5,6 +5,7 @@
- boutons pour ajuster les compteurs - boutons pour ajuster les compteurs
- visualisation des blessures - visualisation des blessures
- click sur blessure pour ajouter/enlever - click sur blessure pour ajouter/enlever
- gestion des armes
## 12.0.13 - La Chance d'Astrobazzarh ## 12.0.13 - La Chance d'Astrobazzarh
- Fix: jets de caractéristiques - Fix: jets de caractéristiques

View File

@ -220,7 +220,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
// Points de reve actuel // Points de reve actuel
this.html.find('.roll-reve-actuel').click(async event => this.actor.rollCarac('reve-actuel', true)) this.html.find('.roll-reve-actuel').click(async event => this.actor.rollCarac('reve-actuel', true))
this.html.find('.empoignade-label a').click(async event => RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor))) this.html.find('.empoignade-label a').click(async event => RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor)))
this.html.find('.arme-label a').click(async event => this.actor.rollArme(foundry.utils.duplicate(this._getEventArmeCombat(event)))) this.html.find('.roll-arme').click(async event => this.actor.rollArme(foundry.utils.duplicate(this._getEventArmeCombat(event))))
// Initiative pour l'arme // Initiative pour l'arme
this.html.find('.arme-initiative a').click(async event => { this.html.find('.arme-initiative a').click(async event => {

View File

@ -39,7 +39,8 @@ export class RdDActorExportSheet extends RdDActorSheet {
async getData() { async getData() {
const formData = await super.getData() const formData = await super.getData()
// Add any structured, precomputed list of data // Add any structured, precomputed list of data
formData.export = this.getMappingValues(); formData.context = Mapping.prepareContext(this.actor)
formData.export = this.getMappingValues(formData.context, this.actor)
formData.competences = this.getCompetences(CATEGORIES_COMPETENCES) formData.competences = this.getCompetences(CATEGORIES_COMPETENCES)
formData.draconic = this.getCompetences(CATEGORIES_DRACONIC) formData.draconic = this.getCompetences(CATEGORIES_DRACONIC)
const legeres = this.actor.nbBlessuresLegeres() const legeres = this.actor.nbBlessuresLegeres()
@ -59,13 +60,12 @@ export class RdDActorExportSheet extends RdDActorSheet {
return formData return formData
} }
getMappingValues() { getMappingValues(context, actor) {
const context = Mapping.prepareContext(this.actor)
return Object.fromEntries(Mapping.getMapping().map(it => [it.column, { return Object.fromEntries(Mapping.getMapping().map(it => [it.column, {
colName: it.colName ?? it.column, colName: it.colName ?? it.column,
column: it.column, column: it.column,
rollClass: it.rollClass, rollClass: it.rollClass,
value: String(it.getter(this.actor, context)) value: String(it.getter(actor, context))
}])) }]))
} }

View File

@ -142,11 +142,11 @@ export class Mapping {
const armes = actor.items.filter(it => it.type == ITEM_TYPES.arme) const armes = actor.items.filter(it => it.type == ITEM_TYPES.arme)
return armes.map(arme => return armes.map(arme =>
[ [
arme.system.tir != "" ? Mapping.prepareArme(actor, arme, 'tir') : undefined,
arme.system.lancer = "" ? Mapping.prepareArme(actor, arme, 'lancer') : undefined,
arme.system.unemain ? Mapping.prepareArme(actor, arme, 'unemain') : undefined, arme.system.unemain ? Mapping.prepareArme(actor, arme, 'unemain') : undefined,
arme.system.deuxmains ? Mapping.prepareArme(actor, arme, 'deuxmains') : undefined, arme.system.deuxmains ? Mapping.prepareArme(actor, arme, 'deuxmains') : undefined,
!(arme.system.unemain || arme.system.deuxmains) ? Mapping.prepareArme(actor, arme, 'competence') : undefined !(arme.system.unemain || arme.system.deuxmains) ? Mapping.prepareArme(actor, arme, 'competence') : undefined,
arme.system.lancer != "" ? Mapping.prepareArme(actor, arme, 'lancer') : undefined,
arme.system.tir != "" ? Mapping.prepareArme(actor, arme, 'tir') : undefined
] ]
.filter(it => it != undefined) .filter(it => it != undefined)
).reduce((a, b) => a.concat(b), []) ).reduce((a, b) => a.concat(b), [])
@ -160,14 +160,27 @@ export class Mapping {
} }
const dmgArme = RdDItemArme.dommagesReels(arme, maniement) const dmgArme = RdDItemArme.dommagesReels(arme, maniement)
const dommages = dmgArme + RdDBonus.bonusDmg(actor, maniement, dmgArme) const dommages = dmgArme + RdDBonus.bonusDmg(actor, maniement, dmgArme)
const categorie = Mapping.complementCategorie(arme, maniement)
return { return {
name: arme.name, name: arme.name + categorie,
niveau: Misc.toSignedString(competence.system.niveau), niveau: Misc.toSignedString(competence.system.niveau),
init: Mapping.calculBaseInit(actor, competence.system.categorie) + competence.system.niveau, init: Mapping.calculBaseInit(actor, competence.system.categorie) + competence.system.niveau,
dommages: Misc.toSignedString(dommages) dommages: Misc.toSignedString(dommages),
competence: competence,
arme: arme
} }
} }
static complementCategorie(arme, maniement) {
switch (maniement) {
case 'unemain': return (arme.system.deuxmains) ? ' 1 main' : (arme.system.lancer||arme.system.tir) ? ' mêlée': ''
case 'deuxmains': return (arme.system.unemain) ? ' 2 mains' : (arme.system.lancer||arme.system.tir) ? ' mêlée': ''
case 'lancer': return (arme.system.unemain || arme.system.deuxmains || arme.system.tir) ? ' jet' : ''
case 'tir': return (arme.system.unemain || arme.system.deuxmains || arme.system.lancer) ? ' tir' : ''
}
return ''
}
static calculBaseInit(actor, categorie) { static calculBaseInit(actor, categorie) {
const mapping = MAPPING_BASE.find(it => it.column == categorie) const mapping = MAPPING_BASE.find(it => it.column == categorie)
if (mapping) { if (mapping) {

View File

@ -13,7 +13,7 @@
data-competence-name="{{arme.system.competence}}" data-competence-name="{{arme.system.competence}}"
data-tooltip="{{arme.name}}: niveau {{plusMoins arme.system.niveau}}"> data-tooltip="{{arme.name}}: niveau {{plusMoins arme.system.niveau}}">
<span class="arme-label"> <span class="arme-label">
<a> <a class="roll-arme">
{{#if arme.img}} {{#if arme.img}}
<img class="sheet-competence-img" src="{{arme.img}}" data-tooltip="{{arme.name}}"/> <img class="sheet-competence-img" src="{{arme.img}}" data-tooltip="{{arme.name}}"/>
{{/if}} {{/if}}

View File

@ -71,16 +71,12 @@
<hr> <hr>
<div> <div>
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=' ' niveau='Niv' init='Init' dommages='+dom'}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=' ' niveau='Niv' init='Init' dommages='+dom'}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_0.value niveau=export.arme_niveau_0.value init=export.arme_init_0.value dommages=export.arme_dommages_0.value}} {{#each context.armes as |arme|}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_1.value niveau=export.arme_niveau_1.value init=export.arme_init_1.value dommages=export.arme_dommages_1.value}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs"
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_2.value niveau=export.arme_niveau_2.value init=export.arme_init_2.value dommages=export.arme_dommages_2.value}} name=arme.name niveau=arme.niveau init=arme.init dommages=arme.dommages
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_3.value niveau=export.arme_niveau_3.value init=export.arme_init_3.value dommages=export.arme_dommages_3.value}} arme=arme.arme competence=arme.competence
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_4.value niveau=export.arme_niveau_4.value init=export.arme_init_4.value dommages=export.arme_dommages_4.value}} }}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_5.value niveau=export.arme_niveau_5.value init=export.arme_init_5.value dommages=export.arme_dommages_5.value}} {{/each}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_6.value niveau=export.arme_niveau_6.value init=export.arme_init_6.value dommages=export.arme_dommages_6.value}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_7.value niveau=export.arme_niveau_7.value init=export.arme_init_7.value dommages=export.arme_dommages_7.value}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_8.value niveau=export.arme_niveau_8.value init=export.arme_init_8.value dommages=export.arme_dommages_8.value}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_9.value niveau=export.arme_niveau_9.value init=export.arme_init_9.value dommages=export.arme_dommages_9.value}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/esquive.hbs" name='Esquive' niveau=export.esquive.value}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/esquive.hbs" name='Esquive' niveau=export.esquive.value}}
{{#if (gt export.malue_armure.value 0)}} {{#if (gt export.malue_armure.value 0)}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/esquive.hbs" name='Esquive (avec armure)' niveau=export.esquive_armure.value}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/esquive.hbs" name='Esquive (avec armure)' niveau=export.esquive_armure.value}}

View File

@ -1,6 +1,9 @@
{{#if name}} {{#if name}}
<div class="flexrow"> <div class="flexrow item"
<div>{{upperFirst name}}</div> data-item-id="{{arme._id}}"
data-arme-name="{{arme.name}}"
data-competence-name="{{competence.name}}">
<a class="roll-arme">{{upperFirst name}}</a>
<div class="flexrow"> <div class="flexrow">
<div>{{niveau}}</div> <div>{{niveau}}</div>
{{#if init}} {{#if init}}