Fix: ignorer personnages joueurs non liés

Pour les fenêtres de stress/repos/voyage/astrologie, ignorer
les personnages non liés (par exemple, un guerrier sorde)
This commit is contained in:
Vincent Vandemeulebrouck 2024-03-09 23:12:13 +01:00
parent dde3011f1d
commit 6414f76d67
8 changed files with 15 additions and 13 deletions

View File

@ -95,6 +95,10 @@ export class RdDActor extends RdDBaseActorSang {
return ![TYPES.competencecreature, TYPES.tarot, TYPES.service].includes(item.type)
}
isPersonnageJoueur() {
return this.hasPlayerOwner && this.prototypeToken.actorLink
}
isPersonnage() { return true }
isHautRevant() { return this.system.attributs.hautrevant.value != "" }

View File

@ -85,6 +85,8 @@ export class RdDBaseActor extends Actor {
return game.actors.get(actorId)
}
isPersonnageJoueur() { return false }
static extractActorMin = (actor) => { return { id: actor?.id, type: actor?.type, name: actor?.name, img: actor?.img }; };
static getParentActor(document) {

View File

@ -12,7 +12,7 @@ export const XP_TOPIC = {
export class ExperienceLog {
static async add(actor, topic, from, to, raison, manuel = false) {
if (!actor.hasPlayerOwner || !actor.isPersonnage()) {
if (!actor.isPersonnageJoueur()) {
return
}
if (from == to) {

View File

@ -463,14 +463,13 @@ export class RdDCommands {
let motif = params.slice(1, params.length - 2);
let name = params[params.length - 1];
const personnages = game.actors.filter(actor => actor.isPersonnageJoueur());
if (name == undefined) {
for (let actor of game.actors) {
// TODO: ne plus stresser les entités de cauchemar!
for (let actor of personnages) {
await actor.distribuerStress('stress', stress, motif);
}
} else {
//console.log(stressValue, nomJoueur);
let actor = Misc.findActor(name, game.actors.filter(it => it.hasPlayerOwner)) ?? Misc.findPlayer(name)?.character
let actor = Misc.findActor(name, personnages) ?? Misc.findPlayer(name)?.character
if (actor) {
await actor.distribuerStress('stress', stress, motif);
}

View File

@ -85,7 +85,7 @@ export class AppAstrologie extends Application {
const nbAstral = calendrier.getNombreAstral()
const heures = RdDTimestamp.heures();
return {
ajustementsActors: game.actors.filter(it => it.isPersonnage() && it.hasPlayerOwner)
ajustementsActors:game.actors.filter(actor => actor.isPersonnageJoueur())
.map(actor => this.getAjustementActor(actor, nbAstral, heures)),
nombresAstraux: calendrier.getNombresAstraux().map(na => this.getDetailNombreAstral(na))
}

View File

@ -3,10 +3,8 @@ export class DialogChateauDormant extends Dialog {
static async create() {
const date = game.system.rdd.calendrier.dateCourante();
const actors = game.actors.filter(actor => actor.hasPlayerOwner && actor.isPersonnage());
const dialogData = {
actors: actors,
actors: game.actors.filter(actor => actor.isPersonnageJoueur()),
date: date,
motifStress: `Nuit du ${date}`,
finChateauDormant: game.system.rdd.calendrier.getTimestampFinChateauDormant()

View File

@ -6,7 +6,7 @@ export class DialogStress extends Dialog {
motif: "Motif",
stress: 10,
immediat: false,
actors: game.actors.filter(actor => actor.hasPlayerOwner && actor.isPersonnage())
actors: game.actors.filter(actor => actor.isPersonnageJoueur())
.map(actor => ({
id: actor.id,
name: actor.name,

View File

@ -33,11 +33,10 @@ export class DialogFatigueVoyage extends Dialog {
return
}
if (!DialogFatigueVoyage.dialog) {
const playerActors = game.actors.filter(actor => actor.hasPlayerOwner && actor.isPersonnage())
.map(actor => DialogFatigueVoyage.prepareActor(actor))
const parameters = {
tableauFatigueMarche: TABLEAU_FATIGUE_MARCHE,
playerActors: playerActors,
playerActors: game.actors.filter(actor => actor.isPersonnageJoueur())
.map(actor => DialogFatigueVoyage.prepareActor(actor)),
nombreHeures: 1,
}
DialogFatigueVoyage.setModeDeplacement(parameters, undefined, undefined)