Add ability to role

This commit is contained in:
sladecraven 2022-03-16 15:08:34 +01:00
parent 0d34b30467
commit 55efa32739
2 changed files with 12 additions and 2 deletions

View File

@ -468,6 +468,8 @@ export class PegasusActor extends Actor {
console.log("Pre-process !!!", item) console.log("Pre-process !!!", item)
if (item.data.type == 'race') { if (item.data.type == 'race') {
this.applyRace(item.data) this.applyRace(item.data)
} else if (item.data.type == 'role') {
this.applyRole(item.data)
} else if (item.data.type == 'ability') { } else if (item.data.type == 'ability') {
this.applyAbility(item.data, [], true) this.applyAbility(item.data, [], true)
if (!onDrop) { if (!onDrop) {
@ -996,6 +998,7 @@ export class PegasusActor extends Actor {
newItems.push(armor); newItems.push(armor);
} }
} }
console.log("Ability : adding", newItems)
await this.createEmbeddedDocuments('Item', newItems) await this.createEmbeddedDocuments('Item', newItems)
} }
@ -1041,10 +1044,14 @@ export class PegasusActor extends Actor {
this.getIncreaseStatValue(updates, role.data.statincrease1) this.getIncreaseStatValue(updates, role.data.statincrease1)
this.getIncreaseStatValue(updates, role.data.statincrease2) this.getIncreaseStatValue(updates, role.data.statincrease2)
if ( role.data.specialability.length > 0) {
console.log("Adding ability", role.data.specialability)
newItems = newItems.concat( duplicate(role.data.specialability) ) // Add new ability newItems = newItems.concat( duplicate(role.data.specialability) ) // Add new ability
this.applyAbility(role.data.specialability[0], newItems)
}
await this.update(updates) await this.update(updates)
await this.createEmbeddedDocuments('Item', newItems) await this.createEmbeddedDocuments('Item', newItems)
} }

View File

@ -279,6 +279,9 @@ export class PegasusUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getDiceValue(level = 0) { static getDiceValue(level = 0) {
let diceString = this.diceList[level] let diceString = this.diceList[level]
if ( !diceString) {
console.log("Level error", level)
}
let diceTab = diceString.split(" ") let diceTab = diceString.split(" ")
let diceValue = 0 let diceValue = 0
for (let dice of diceTab) { for (let dice of diceTab) {