forked from public/foundryvtt-reve-de-dragon
On ne peut pas tout donner
Limitation des types d'objets pouvant être donnés à différents acteurs
This commit is contained in:
@ -145,7 +145,7 @@ export class RdDActor extends Actor {
|
||||
// Make separate methods for each Actor type (character, npc, etc.) to keep
|
||||
// things organized.
|
||||
if (this.isPersonnage()) this._prepareCharacterData(this)
|
||||
if (this.isCreature()) this._prepareCreatureData(this)
|
||||
if (this.isCreatureEntite()) this._prepareCreatureData(this)
|
||||
if (this.isVehicule()) this._prepareVehiculeData(this)
|
||||
this.computeEtatGeneral();
|
||||
}
|
||||
@ -193,10 +193,36 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
canReceive(item) {
|
||||
if (this.isCreature()) {
|
||||
return item.type == 'competencecreature' || RdDItem.isItemInventaire(item);
|
||||
}
|
||||
if (this.isEntite()) {
|
||||
return item.type == 'competencecreature';
|
||||
}
|
||||
if (this.isVehicule()) {
|
||||
return RdDItem.isItemInventaire(item);
|
||||
}
|
||||
if (this.isPersonnage()) {
|
||||
switch (item.type) {
|
||||
case 'competencecreature': case 'tarot':
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
isCreature() {
|
||||
isCreatureEntite() {
|
||||
return this.type == 'creature' || this.type == 'entite';
|
||||
}
|
||||
isCreature() {
|
||||
return this.type == 'creature';
|
||||
}
|
||||
isEntite() {
|
||||
return this.type == 'entite';
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
isPersonnage() {
|
||||
return this.type == 'personnage';
|
||||
@ -1175,13 +1201,13 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
let result = true;
|
||||
const item = this.getObjet(itemId);
|
||||
if (item?.isEquipement() && sourceActorId == targetActorId) {
|
||||
if (item?.isInventaire() && sourceActorId == targetActorId) {
|
||||
// rangement
|
||||
if (srcId != destId && itemId != destId) { // déplacement de l'objet
|
||||
const src = this.getObjet(srcId);
|
||||
const dest = this.getObjet(destId);
|
||||
const cible = this.getContenantOrParent(dest);
|
||||
const [empilable, message] = item.isEquipementEmpilable(dest);
|
||||
const [empilable, message] = item.isInventaireEmpilable(dest);
|
||||
if (empilable) {
|
||||
await this.regrouperEquipementsSimilaires(item, dest);
|
||||
result = false;
|
||||
@ -1359,7 +1385,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computePrixTotalEquipement() {
|
||||
const valeur = this.items.filter(it => it.isEquipement())
|
||||
const valeur = this.items.filter(it => it.isInventaire())
|
||||
.map(it => it.valeurTotale())
|
||||
.reduce(Misc.sum(), 0);
|
||||
return valeur;
|
||||
@ -2995,7 +3021,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getHeureNaissance() {
|
||||
if (this.isCreature()) {
|
||||
if (this.isCreatureEntite()) {
|
||||
return 0;
|
||||
}
|
||||
return this.system.heure;
|
||||
@ -3003,7 +3029,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
ajustementAstrologique() {
|
||||
if (this.isCreature()) {
|
||||
if (this.isCreatureEntite()) {
|
||||
return 0;
|
||||
}
|
||||
// selon l'heure de naissance...
|
||||
|
Reference in New Issue
Block a user