Feuille de véhicule avec compteurs
This commit is contained in:
parent
e35f77b5a8
commit
7557d33c73
@ -18,5 +18,22 @@ export class RdDActorVehiculeSheet extends RdDActorSheet {
|
||||
});
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
if (!this.options.editable) return;
|
||||
|
||||
html.find('.resistance-moins').click(async event => {
|
||||
this.actor.vehicleIncDec("resistance", -1);
|
||||
});
|
||||
html.find('.resistance-plus').click(async event => {
|
||||
this.actor.vehicleIncDec("resistance", 1);
|
||||
});
|
||||
html.find('.structure-moins').click(async event => {
|
||||
this.actor.vehicleIncDec("structure", -1);
|
||||
});
|
||||
html.find('.structure-plus').click(async event => {
|
||||
this.actor.vehicleIncDec("structure", 1);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1779,6 +1779,18 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
async vehicleIncDec(name, inc) {
|
||||
if (!this.isVehicule() || !['resistance', 'structure'].includes(name)) {
|
||||
return
|
||||
}
|
||||
const value = this.system.etat[name].value;
|
||||
const max = this.system.etat[name].max;
|
||||
const newValue = value + inc;
|
||||
if (0 <= newValue && newValue <=max) {
|
||||
await this.update({ [`system.etat.${name}.value`]: newValue })
|
||||
}
|
||||
}
|
||||
|
||||
isDead() {
|
||||
return !this.isEntite() && this.system.sante.vie.value < -this.getSConst()
|
||||
|
@ -2,13 +2,37 @@
|
||||
|
||||
{{!-- Sheet Header --}}
|
||||
<header class="sheet-header">
|
||||
<img class="profile-img" src="{{img}}" data-edit="img" title="{{name}}" />
|
||||
<div class="header-fields">
|
||||
<div class="flexrow">
|
||||
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
|
||||
<img class="profile-img" src="{{img}}" data-edit="img" title="{{name}}" />
|
||||
<div class="flexcol">
|
||||
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
|
||||
<div class="flexrow">
|
||||
<div class="flex-group-left header-compteurs">
|
||||
<ul>
|
||||
<li data-attribute="resistance" class="flexrow">
|
||||
<span class="carac-label">Résistance</span>
|
||||
<a class="resistance-moins"><i class="fas fa-minus-square"></i></a>
|
||||
<input type="text" name="system.etat.resistance.value" value="{{system.etat.resistance.value}}" data-dtype="Number" />
|
||||
/
|
||||
<input type="text" name="system.etat.resistance.max" value="{{system.etat.resistance.max}}" data-dtype="Number" {{#unless @root.options.vueDetaillee}}disabled{{/unless}} />
|
||||
<a class="resistance-plus"><i class="fas fa-plus-square"></i></a>
|
||||
</li>
|
||||
<li data-attribute="structure" class="flexrow">
|
||||
<span class="carac-label">Structure</span>
|
||||
<a class="structure-moins"><i class="fas fa-minus-square"></i></a>
|
||||
<input type="text" name="system.etat.structure.value" value="{{system.etat.structure.value}}" data-dtype="Number" />
|
||||
/
|
||||
<input type="text" name="system.etat.structure.max" value="{{system.etat.structure.max}}" data-dtype="Number" {{#unless @root.options.vueDetaillee}}disabled{{/unless}} />
|
||||
<a class="structure-plus"><i class="fas fa-plus-square"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</header>
|
||||
|
||||
{{!-- Sheet Tab Navigation --}}
|
||||
<nav class="sheet-tabs tabs" data-group="primary">
|
||||
@ -25,22 +49,6 @@
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.html"}}
|
||||
</div>
|
||||
<div class="grid grid-2col">
|
||||
<div class="flex-group-left flexcol">
|
||||
<ol class="carac-list alterne-list">
|
||||
<li class="caracteristique flexrow list-item">
|
||||
<span class="carac-label">Résistance</span>
|
||||
<input class="competence-value" type="text" name="system.etat.resistance.value" value="{{system.etat.resistance.value}}" data-dtype="Number" />
|
||||
/
|
||||
<input class="competence-value" type="text" name="system.etat.resistance.max" value="{{system.etat.resistance.max}}" data-dtype="Number" {{#unless @root.options.vueDetaillee}}disabled{{/unless}} />
|
||||
</li>
|
||||
<li class="caracteristique flexrow list-item">
|
||||
<span class="carac-label">Structure</span>
|
||||
<input class="competence-value" type="text" name="system.etat.structure.value" value="{{system.etat.structure.value}}" data-dtype="Number" />
|
||||
/
|
||||
<input class="competence-value" type="text" name="system.etat.structure.max" value="{{system.etat.structure.max}}" data-dtype="Number" {{#unless @root.options.vueDetaillee}}disabled{{/unless}} />
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="flex-group-left flexcol">
|
||||
<ol>
|
||||
<li class="caracteristique flexrow list-item">
|
||||
|
Loading…
Reference in New Issue
Block a user