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

View File

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