Ajout des saignements
This commit is contained in:
@@ -2917,7 +2917,9 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
break
|
||||
case ITEM_TYPES.race:
|
||||
await this.onCreateOwnedRace(item, options, id)
|
||||
break
|
||||
}
|
||||
await super.onCreateItem(item, options, id)
|
||||
await item.onCreateItemTemporel(this);
|
||||
await item.onCreateDecoupeComestible(this);
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ import { RdDConfirm } from "../rdd-confirm.js";
|
||||
import { RdDUtility } from "../rdd-utility.js";
|
||||
import { SystemCompendiums } from "../settings/system-compendiums.js";
|
||||
import { RdDItem } from "../item.js";
|
||||
import { STATUSES } from "../settings/status-effects.js";
|
||||
|
||||
export class RdDBaseActor extends Actor {
|
||||
|
||||
@@ -47,6 +48,7 @@ export class RdDBaseActor extends Actor {
|
||||
static init() {
|
||||
Hooks.on("preUpdateItem", (item, change, options, id) => Misc.documentIfResponsible(item.parent)?.onPreUpdateItem(item, change, options, id))
|
||||
Hooks.on("createItem", (item, options, id) => Misc.documentIfResponsible(item.parent)?.onCreateItem(item, options, id))
|
||||
Hooks.on("updateItem", (item, options, id) => Misc.documentIfResponsible(item.parent)?.onUpdateItem(item, options, id))
|
||||
Hooks.on("deleteItem", (item, options, id) => Misc.documentIfResponsible(item.parent)?.onDeleteItem(item, options, id))
|
||||
Hooks.on("updateActor", (actor, change, options, actorId) => Misc.documentIfResponsible(actor)?.onUpdateActor(change, options, actorId))
|
||||
}
|
||||
@@ -243,7 +245,28 @@ export class RdDBaseActor extends Actor {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async onPreUpdateItem(item, change, options, id) { }
|
||||
async onCreateItem(item, options, id) { }
|
||||
|
||||
async onCreateItem(item, options, id) {
|
||||
switch (item.type) {
|
||||
case ITEM_TYPES.blessure:
|
||||
await this.changeBleedingState()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
async onUpdateItem(item, options, id){
|
||||
switch (item.type) {
|
||||
case ITEM_TYPES.blessure:
|
||||
await this.changeBleedingState()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
async changeBleedingState() {
|
||||
const bleeding = this.itemTypes[ITEM_TYPES.blessure].find(it => it.isBleeding())
|
||||
await this.setEffect(STATUSES.StatusBleeding, bleeding ? true : false)
|
||||
}
|
||||
|
||||
async onUpdateActor(update, options, actorId) { }
|
||||
async onDeleteItem(item, options, id) {
|
||||
if (item.isInventaire()) {
|
||||
|
@@ -209,6 +209,9 @@ export class RdDItemBlessure extends RdDItem {
|
||||
isCritique() {
|
||||
return this.system.gravite > 4 && this.system.gravite <= 6
|
||||
}
|
||||
isBleeding() {
|
||||
return this.system.gravite > 2 && !this.system.premierssoins.done
|
||||
}
|
||||
isMort() {
|
||||
return this.system.gravite > 6
|
||||
}
|
||||
|
Reference in New Issue
Block a user