Armes sur la fiche de PNJ
This commit is contained in:
parent
a6ae7babbe
commit
99f5578c4f
@ -5,6 +5,7 @@
|
||||
- boutons pour ajuster les compteurs
|
||||
- visualisation des blessures
|
||||
- click sur blessure pour ajouter/enlever
|
||||
- gestion des armes
|
||||
|
||||
## 12.0.13 - La Chance d'Astrobazzarh
|
||||
- Fix: jets de caractéristiques
|
||||
|
@ -220,7 +220,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
// Points de reve actuel
|
||||
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('.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
|
||||
this.html.find('.arme-initiative a').click(async event => {
|
||||
|
@ -39,7 +39,8 @@ export class RdDActorExportSheet extends RdDActorSheet {
|
||||
async getData() {
|
||||
const formData = await super.getData()
|
||||
// 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.draconic = this.getCompetences(CATEGORIES_DRACONIC)
|
||||
const legeres = this.actor.nbBlessuresLegeres()
|
||||
@ -59,13 +60,12 @@ export class RdDActorExportSheet extends RdDActorSheet {
|
||||
return formData
|
||||
}
|
||||
|
||||
getMappingValues() {
|
||||
const context = Mapping.prepareContext(this.actor)
|
||||
getMappingValues(context, actor) {
|
||||
return Object.fromEntries(Mapping.getMapping().map(it => [it.column, {
|
||||
colName: it.colName ?? it.column,
|
||||
column: it.column,
|
||||
rollClass: it.rollClass,
|
||||
value: String(it.getter(this.actor, context))
|
||||
value: String(it.getter(actor, context))
|
||||
}]))
|
||||
}
|
||||
|
||||
|
@ -142,11 +142,11 @@ export class Mapping {
|
||||
const armes = actor.items.filter(it => it.type == ITEM_TYPES.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.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)
|
||||
).reduce((a, b) => a.concat(b), [])
|
||||
@ -160,14 +160,27 @@ export class Mapping {
|
||||
}
|
||||
const dmgArme = RdDItemArme.dommagesReels(arme, maniement)
|
||||
const dommages = dmgArme + RdDBonus.bonusDmg(actor, maniement, dmgArme)
|
||||
const categorie = Mapping.complementCategorie(arme, maniement)
|
||||
return {
|
||||
name: arme.name,
|
||||
name: arme.name + categorie,
|
||||
niveau: Misc.toSignedString(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) {
|
||||
const mapping = MAPPING_BASE.find(it => it.column == categorie)
|
||||
if (mapping) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
data-competence-name="{{arme.system.competence}}"
|
||||
data-tooltip="{{arme.name}}: niveau {{plusMoins arme.system.niveau}}">
|
||||
<span class="arme-label">
|
||||
<a>
|
||||
<a class="roll-arme">
|
||||
{{#if arme.img}}
|
||||
<img class="sheet-competence-img" src="{{arme.img}}" data-tooltip="{{arme.name}}"/>
|
||||
{{/if}}
|
||||
|
@ -71,16 +71,12 @@
|
||||
<hr>
|
||||
<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=export.arme_name_0.value niveau=export.arme_niveau_0.value init=export.arme_init_0.value dommages=export.arme_dommages_0.value}}
|
||||
{{>"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" name=export.arme_name_2.value niveau=export.arme_niveau_2.value init=export.arme_init_2.value dommages=export.arme_dommages_2.value}}
|
||||
{{>"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}}
|
||||
{{>"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}}
|
||||
{{>"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}}
|
||||
{{#each context.armes as |arme|}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs"
|
||||
name=arme.name niveau=arme.niveau init=arme.init dommages=arme.dommages
|
||||
arme=arme.arme competence=arme.competence
|
||||
}}
|
||||
{{/each}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/esquive.hbs" name='Esquive' niveau=export.esquive.value}}
|
||||
{{#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}}
|
||||
|
@ -1,6 +1,9 @@
|
||||
{{#if name}}
|
||||
<div class="flexrow">
|
||||
<div>{{upperFirst name}}</div>
|
||||
<div class="flexrow item"
|
||||
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>{{niveau}}</div>
|
||||
{{#if init}}
|
||||
|
Loading…
Reference in New Issue
Block a user