Gestion de la tête Augmentation de seuil
This commit is contained in:
parent
f659a7508a
commit
db448028f9
@ -1556,11 +1556,13 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async updatePointDeSeuil(value = 1) {
|
||||
async regainPointDeSeuil() {
|
||||
const seuil = Misc.toInt(this.system.reve.seuil.value);
|
||||
const reve = Misc.toInt(this.system.carac.reve.value);
|
||||
if (seuil < reve) {
|
||||
await this.setPointsDeSeuil(Math.min(seuil + value, reve));
|
||||
const seuilMax = Misc.toInt(this.system.carac.reve.value)
|
||||
+ 2 * EffetsDraconiques.countAugmentationSeuil(this);
|
||||
|
||||
if (seuil < seuilMax) {
|
||||
await this.setPointsDeSeuil(Math.min(seuil + 1, seuilMax));
|
||||
}
|
||||
}
|
||||
|
||||
|
18
module/tmr/augmentation-seuil.js
Normal file
18
module/tmr/augmentation-seuil.js
Normal file
@ -0,0 +1,18 @@
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
import { Misc } from "../misc.js";
|
||||
|
||||
export class AugmentationSeuil extends Draconique {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
type() { return 'tete' }
|
||||
match(item) { return Draconique.isTeteDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes('augmentation du seuil de reve'); }
|
||||
manualMessage() { return false }
|
||||
async onActorCreateOwned(actor, tete) {
|
||||
const seuil = Misc.toInt(actor.system.reve.seuil.value) + 2;
|
||||
await actor.update({ "system.reve.seuil.value": seuil })
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ import { Pelerinage } from "./pelerinage.js";
|
||||
import { Periple } from "./periple.js";
|
||||
import { UrgenceDraconique } from "./urgence-draconique.js";
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { AugmentationSeuil } from "./augmentation-seuil.js";
|
||||
|
||||
|
||||
export class EffetsDraconiques {
|
||||
@ -37,6 +38,7 @@ export class EffetsDraconiques {
|
||||
static pelerinage = new Pelerinage();
|
||||
static periple = new Periple();
|
||||
static urgenceDraconique = new UrgenceDraconique();
|
||||
static augmentationSeuil = new AugmentationSeuil();
|
||||
|
||||
static init() {
|
||||
Draconique.register(EffetsDraconiques.carteTmr);
|
||||
@ -56,6 +58,7 @@ export class EffetsDraconiques {
|
||||
Draconique.register(EffetsDraconiques.pelerinage);
|
||||
Draconique.register(EffetsDraconiques.periple);
|
||||
Draconique.register(EffetsDraconiques.urgenceDraconique);
|
||||
Draconique.register(EffetsDraconiques.augmentationSeuil)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -116,6 +119,10 @@ export class EffetsDraconiques {
|
||||
.filter(it => Grammar.includesLowerCaseNoAccent(it.name, name));
|
||||
}
|
||||
|
||||
static countAugmentationSeuil(actor) {
|
||||
return EffetsDraconiques.filterItems(actor, Draconique.isTeteDragon, 'Augmentation du seuil de rêve').length;
|
||||
}
|
||||
|
||||
static isDonDoubleReve(actor) {
|
||||
return EffetsDraconiques.filterItems(actor, Draconique.isTeteDragon, 'Don de double-rêve').length>0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user