Initial import

This commit is contained in:
2023-11-26 17:00:12 +01:00
parent 09b89f794f
commit 386ce186af
64 changed files with 268 additions and 247 deletions

View File

@@ -106,21 +106,12 @@ export class WastelandActor extends Actor {
WastelandUtility.sortArrayObjectsByName(items)
return items
}
getDons() {
return this.getItemSorted(["don"])
}
getTendances() {
return this.getItemSorted(["tendance"])
}
getRunes() {
return this.getItemSorted(["rune"])
getPouvoirs() {
return this.getItemSorted(["pouvoir"])
}
getEquipments() {
return this.getItemSorted(["equipement"])
}
getTraitsChaotiques() {
return this.getItemSorted(["traitchaotique"])
}
getMonnaies() {
return this.getItemSorted(["monnaie"])
}
@@ -160,17 +151,6 @@ export class WastelandActor extends Actor {
return comp
}
/* -------------------------------------------- */
getAspect() {
return (this.system.balance.loi > this.system.balance.chaos) ? this.system.balance.loi : this.system.balance.chaos
}
getMarge() {
return Math.abs( this.system.balance.loi - this.system.balance.chaos)
}
getAlignement() {
return (this.system.balance.loi > this.system.balance.chaos) ? "loyal" : "chaotique"
}
/* -------------------------------------------- */
getDefenseBase() {
return this.system.attributs.tre.value + 5
@@ -213,9 +193,9 @@ export class WastelandActor extends Actor {
if (this.system.sante.base != newSante) {
this.update({ 'system.sante.base': newSante })
}
let newAme = (this.system.attributs.cla.value + this.system.attributs.tre.value) * this.system.biodata.amemultiplier + 5
if (this.system.ame.fullmax != newAme) {
this.update({ 'system.ame.fullmax': newAme })
let newPsyche = (this.system.attributs.cla.value + this.system.attributs.tre.value) * this.system.biodata.psychemultiplier + 5
if (this.system.psyche.fullmax != newPsyche) {
this.update({ 'system.psyche.fullmax': newPsyche })
}
}
@@ -240,7 +220,7 @@ export class WastelandActor extends Actor {
/* -------------------------------------------- */
async equipItem(itemId) {
let item = this.items.find(item => item.id == itemId)
if (item && item.system) {
if (item?.system) {
let update = { _id: item.id, "system.equipped": !item.system.equipped }
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
}
@@ -286,18 +266,10 @@ export class WastelandActor extends Actor {
}
/* -------------------------------------------- */
canEclatDoubleD20() {
return (this.getAlignement() == "loyal" && this.system.eclat.value > 0)
}
/* -------------------------------------------- */
subPointsAme(runeMode, value) {
let ame = duplicate(this.system.ame)
if(runeMode == "prononcer") {
ame.value -= value
} else {
ame.currentmax -= value
}
this.update( {'system.ame': ame})
subPointsPsyche(value) {
let psyche = duplicate(this.system.psyche)
psyche.currentmax -= value
this.update( {'system.psyche': psyche})
}
/* -------------------------------------------- */
@@ -324,7 +296,7 @@ export class WastelandActor extends Actor {
/* -------------------------------------------- */
async equipGear(equipmentId) {
let item = this.items.find(item => item.id == equipmentId);
if (item && item.system.data) {
if (item?.system) {
let update = { _id: item.id, "system.equipped": !item.system.equipped };
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
}
@@ -360,7 +332,7 @@ export class WastelandActor extends Actor {
let objetQ = this.items.get(objetId)
if (objetQ) {
let newQ = objetQ.system.quantite + incDec;
const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'system.quantite': newQ }]); // pdates one EmbeddedEntity
await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'system.quantite': newQ }]); // pdates one EmbeddedEntity
}
}
/* -------------------------------------------- */
@@ -408,7 +380,7 @@ export class WastelandActor extends Actor {
rollData.actorId = this.id
rollData.tokenId = this.token?.id
rollData.img = this.img
rollData.canEclatDoubleD20 = this.canEclatDoubleD20()
rollData.canEclatDoubleD20 = true // Always true in Wastelan
rollData.doubleD20 = false
rollData.attributs = WastelandUtility.getAttributs()
@@ -446,7 +418,7 @@ export class WastelandActor extends Actor {
}
/* -------------------------------------------- */
async rollRune(runeId) {
async rollPouvoir(pouvoirId) {
let comp = this.items.find(comp => comp.type == "competence" && comp.name.toLowerCase() == "savoir : runes")
if ( !comp) {
ui.notifications.warn("La compétence Savoirs : Runes n'a pas été trouvée, abandon.")