Refouler des queues et supprimer des sorts en réserve #553
@ -1424,6 +1424,15 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async actionRefoulement(item) {
|
||||
const refoulement = item?.system.refoulement ?? 0;
|
||||
if (refoulement>0){
|
||||
await this.ajouterRefoulement(refoulement);
|
||||
await item.delete();
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async ajouterRefoulement(value = 1) {
|
||||
let refoulement = this.system.reve.refoulement.value + value;
|
||||
@ -1924,6 +1933,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 'queue': case 'ombre': return await this.actionRefoulement(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,24 +145,28 @@ export class RdDItem extends Item {
|
||||
}
|
||||
|
||||
getActionPrincipale(options = { warnIfNot: true }) {
|
||||
if (!this.isConteneur() && (this.system.quantite ?? 0) <= 0) {
|
||||
if (options.warnIfNot) {
|
||||
const warn = options.warnIfNot;
|
||||
switch (this.type) {
|
||||
case 'nourritureboisson': return this._actionOrWarnQuantiteZero(this.boisson ? 'Boire' : 'Manger', warn);
|
||||
case 'potion': return this._actionOrWarnQuantiteZero('Boire', warn);
|
||||
case 'livre': return this._actionOrWarnQuantiteZero('Lire', warn);
|
||||
case 'conteneur': return this._actionOrWarnQuantiteZero('Ouvrir', warn);
|
||||
case 'herbe': return this.isHerbeAPotion() ? this._actionOrWarnQuantiteZero('Décoction', warn) : undefined;
|
||||
case 'queue': case 'ombre': return this.system.refoulement>0 ? 'Refouler' : undefined;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
_actionOrWarnQuantiteZero(actionName, warn){
|
||||
if ((this.system.quantite ?? 0) <= 0) {
|
||||
if (warn) {
|
||||
ui.notifications.warn(`Vous n'avez plus de ${this.name}.`);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
switch (this.type) {
|
||||
case 'nourritureboisson': return this.boisson ? 'Boire' : 'Manger';
|
||||
case 'potion': return 'Boire';
|
||||
case 'livre': return 'Lire';
|
||||
case 'conteneur': return 'Ouvrir';
|
||||
else {
|
||||
return actionName;
|
||||
}
|
||||
if (this.isHerbeAPotion()) { return 'Décoction'; }
|
||||
if (options.warnIfNot) {
|
||||
ui.notifications.warn(`Impossible d'utiliser un ${this.name}, aucune action associée définie.`);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async diminuerQuantite(nombre, options = { diminuerQuantite: true, supprimerSiZero: false }) {
|
||||
|
@ -121,8 +121,10 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-liste-blessures-partial.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-queues.html',
|
||||
// Conteneur/item in Actor sheet
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-item-queue.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-item.html',
|
||||
"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html",
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-liens-animaux.html',
|
||||
|
9
templates/actor-sheet-item-queue.html
Normal file
9
templates/actor-sheet-item-queue.html
Normal file
@ -0,0 +1,9 @@
|
||||
<li class="item flexrow" data-attribute={{key}} data-item-id="{{queue._id}}">
|
||||
<span class="display-label flex-grow"><a>{{queue.name}}</a></span>
|
||||
<div class="item-controls">
|
||||
<a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
{{#if queue.system.refoulement}}
|
||||
<a class="item-action">Refouler</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</li>
|
15
templates/actor-sheet-queues.html
Normal file
15
templates/actor-sheet-queues.html
Normal file
@ -0,0 +1,15 @@
|
||||
{{#if (or queues.length ombres.length)}}
|
||||
<h3>
|
||||
{{#if queues.length}}Queues de Dragon{{/if}}
|
||||
{{#if (and queues.length ombres.length)}} et {{/if}}
|
||||
{{#if ombres.length}}Ombres de Thanatos{{/if}}
|
||||
:</h3>
|
||||
<ul class="flex-group-left">
|
||||
{{#each queues as |queue key|}}
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-item-queue.html" queue=queue key=key}}
|
||||
{{/each}}
|
||||
{{#each ombres as |ombre key|}}
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-item-queue.html" queue=ombre key=key}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/if}}
|
@ -510,32 +510,7 @@
|
||||
</div>
|
||||
<hr>
|
||||
{{!-- Queues, Souffles, Tetes, Ombre --}}
|
||||
{{#if queues.length}}
|
||||
<h3>Queues:</h3>
|
||||
<ul class="flex-group-left">
|
||||
{{#each queues as |queue key|}}
|
||||
<li class="item flexrow" data-attribute={{key}} data-item-id="{{queue._id}}">
|
||||
<span class="display-label flex-grow"><a data-item-id="{{queue._id}}">{{queue.name}}</a></span>
|
||||
<div class="item-controls flex-shrink">
|
||||
<a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
{{#if ombres.length}}
|
||||
<h3>Ombres de Thanatos:</h3>
|
||||
<ul class="item-list">
|
||||
{{#each ombres as |ombre key|}}
|
||||
<li class="item flexrow" data-attribute={{key}} data-item-id="{{ombre._id}}">
|
||||
<span class="display-label flex-grow"><a data-item-id="{{ombre._id}}">{{ombre.name}}</a></span>
|
||||
<div class="item-controls flex-shrink">
|
||||
<a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-queues.html"}}
|
||||
{{#if souffles.length}}
|
||||
<h3>Souffles:</h3>
|
||||
<ul class="item-list">
|
||||
|
@ -1,12 +1 @@
|
||||
<form class="{{cssClass}}" autocomplete="off">
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
|
||||
{{!-- Sheet Body --}}
|
||||
<section class="sheet-body">
|
||||
<div class="form-group">
|
||||
<label for="xp">Refoulement</label>
|
||||
<input class="attribute-value" type="text" name="system.refoulement" value="{{system.refoulement}}" data-dtype="Number"/>
|
||||
</div>
|
||||
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
|
||||
</section>
|
||||
</form>
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item-queue-sheet.html"}}
|
||||
|
@ -3,7 +3,15 @@
|
||||
{{!-- Sheet Body --}}
|
||||
<section class="sheet-body">
|
||||
<div class="form-group">
|
||||
<label for="xp">Refoulement</label>
|
||||
<label></label>
|
||||
<label class="attribute-value">{{#if (eq type 'ombre')}}Ombre de thanatos
|
||||
{{else if (eq type 'queue')}}Queue de Dragon
|
||||
{{/if}}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="system.refoulement">Refoulement</label>
|
||||
<input class="attribute-value" type="text" name="system.refoulement" value="{{system.refoulement}}" data-dtype="Number"/>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user