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:
parent
dde3011f1d
commit
6414f76d67
@ -95,6 +95,10 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
return ![TYPES.competencecreature, TYPES.tarot, TYPES.service].includes(item.type)
|
return ![TYPES.competencecreature, TYPES.tarot, TYPES.service].includes(item.type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isPersonnageJoueur() {
|
||||||
|
return this.hasPlayerOwner && this.prototypeToken.actorLink
|
||||||
|
}
|
||||||
|
|
||||||
isPersonnage() { return true }
|
isPersonnage() { return true }
|
||||||
isHautRevant() { return this.system.attributs.hautrevant.value != "" }
|
isHautRevant() { return this.system.attributs.hautrevant.value != "" }
|
||||||
|
|
||||||
|
@ -85,6 +85,8 @@ export class RdDBaseActor extends Actor {
|
|||||||
return game.actors.get(actorId)
|
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 extractActorMin = (actor) => { return { id: actor?.id, type: actor?.type, name: actor?.name, img: actor?.img }; };
|
||||||
|
|
||||||
static getParentActor(document) {
|
static getParentActor(document) {
|
||||||
|
@ -12,7 +12,7 @@ export const XP_TOPIC = {
|
|||||||
export class ExperienceLog {
|
export class ExperienceLog {
|
||||||
|
|
||||||
static async add(actor, topic, from, to, raison, manuel = false) {
|
static async add(actor, topic, from, to, raison, manuel = false) {
|
||||||
if (!actor.hasPlayerOwner || !actor.isPersonnage()) {
|
if (!actor.isPersonnageJoueur()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (from == to) {
|
if (from == to) {
|
||||||
|
@ -463,14 +463,13 @@ export class RdDCommands {
|
|||||||
|
|
||||||
let motif = params.slice(1, params.length - 2);
|
let motif = params.slice(1, params.length - 2);
|
||||||
let name = params[params.length - 1];
|
let name = params[params.length - 1];
|
||||||
|
const personnages = game.actors.filter(actor => actor.isPersonnageJoueur());
|
||||||
if (name == undefined) {
|
if (name == undefined) {
|
||||||
for (let actor of game.actors) {
|
for (let actor of personnages) {
|
||||||
// TODO: ne plus stresser les entités de cauchemar!
|
|
||||||
await actor.distribuerStress('stress', stress, motif);
|
await actor.distribuerStress('stress', stress, motif);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//console.log(stressValue, nomJoueur);
|
let actor = Misc.findActor(name, personnages) ?? Misc.findPlayer(name)?.character
|
||||||
let actor = Misc.findActor(name, game.actors.filter(it => it.hasPlayerOwner)) ?? Misc.findPlayer(name)?.character
|
|
||||||
if (actor) {
|
if (actor) {
|
||||||
await actor.distribuerStress('stress', stress, motif);
|
await actor.distribuerStress('stress', stress, motif);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ export class AppAstrologie extends Application {
|
|||||||
const nbAstral = calendrier.getNombreAstral()
|
const nbAstral = calendrier.getNombreAstral()
|
||||||
const heures = RdDTimestamp.heures();
|
const heures = RdDTimestamp.heures();
|
||||||
return {
|
return {
|
||||||
ajustementsActors: game.actors.filter(it => it.isPersonnage() && it.hasPlayerOwner)
|
ajustementsActors:game.actors.filter(actor => actor.isPersonnageJoueur())
|
||||||
.map(actor => this.getAjustementActor(actor, nbAstral, heures)),
|
.map(actor => this.getAjustementActor(actor, nbAstral, heures)),
|
||||||
nombresAstraux: calendrier.getNombresAstraux().map(na => this.getDetailNombreAstral(na))
|
nombresAstraux: calendrier.getNombresAstraux().map(na => this.getDetailNombreAstral(na))
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,8 @@ export class DialogChateauDormant extends Dialog {
|
|||||||
|
|
||||||
static async create() {
|
static async create() {
|
||||||
const date = game.system.rdd.calendrier.dateCourante();
|
const date = game.system.rdd.calendrier.dateCourante();
|
||||||
const actors = game.actors.filter(actor => actor.hasPlayerOwner && actor.isPersonnage());
|
|
||||||
|
|
||||||
const dialogData = {
|
const dialogData = {
|
||||||
actors: actors,
|
actors: game.actors.filter(actor => actor.isPersonnageJoueur()),
|
||||||
date: date,
|
date: date,
|
||||||
motifStress: `Nuit du ${date}`,
|
motifStress: `Nuit du ${date}`,
|
||||||
finChateauDormant: game.system.rdd.calendrier.getTimestampFinChateauDormant()
|
finChateauDormant: game.system.rdd.calendrier.getTimestampFinChateauDormant()
|
||||||
|
@ -6,7 +6,7 @@ export class DialogStress extends Dialog {
|
|||||||
motif: "Motif",
|
motif: "Motif",
|
||||||
stress: 10,
|
stress: 10,
|
||||||
immediat: false,
|
immediat: false,
|
||||||
actors: game.actors.filter(actor => actor.hasPlayerOwner && actor.isPersonnage())
|
actors: game.actors.filter(actor => actor.isPersonnageJoueur())
|
||||||
.map(actor => ({
|
.map(actor => ({
|
||||||
id: actor.id,
|
id: actor.id,
|
||||||
name: actor.name,
|
name: actor.name,
|
||||||
|
@ -33,11 +33,10 @@ export class DialogFatigueVoyage extends Dialog {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!DialogFatigueVoyage.dialog) {
|
if (!DialogFatigueVoyage.dialog) {
|
||||||
const playerActors = game.actors.filter(actor => actor.hasPlayerOwner && actor.isPersonnage())
|
|
||||||
.map(actor => DialogFatigueVoyage.prepareActor(actor))
|
|
||||||
const parameters = {
|
const parameters = {
|
||||||
tableauFatigueMarche: TABLEAU_FATIGUE_MARCHE,
|
tableauFatigueMarche: TABLEAU_FATIGUE_MARCHE,
|
||||||
playerActors: playerActors,
|
playerActors: game.actors.filter(actor => actor.isPersonnageJoueur())
|
||||||
|
.map(actor => DialogFatigueVoyage.prepareActor(actor)),
|
||||||
nombreHeures: 1,
|
nombreHeures: 1,
|
||||||
}
|
}
|
||||||
DialogFatigueVoyage.setModeDeplacement(parameters, undefined, undefined)
|
DialogFatigueVoyage.setModeDeplacement(parameters, undefined, undefined)
|
||||||
|
Loading…
Reference in New Issue
Block a user