diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js index 3c92cb4..524c986 100644 --- a/modules/pegasus-actor.js +++ b/modules/pegasus-actor.js @@ -47,6 +47,7 @@ export class PegasusActor extends Actor { if (data.type == 'npc') { } + return super.create(data, options); } @@ -61,6 +62,9 @@ export class PegasusActor extends Actor { /* -------------------------------------------- */ prepareDerivedData() { + if (!this.traumaState) { + this.traumaState = "none" + } if (this.type == 'character') { this.computeNRGHealth(); @@ -277,6 +281,7 @@ export class PegasusActor extends Actor { if (item.data.data.costspent > nrg.value || item.data.data.costspent > nrg.max) { return ui.notifications.warn("Not enough NRG to activate the Power " + item.name) } + nrg.activated += item.data.data.costspent nrg.value -= item.data.data.costspent nrg.max -= item.data.data.costspent @@ -290,6 +295,9 @@ export class PegasusActor extends Actor { if (effects.length) { await this.createEmbeddedDocuments('Item', effects) } + if (item.data.data.activatedtext.length > 0) { + ChatMessage.create({ content: `Power ${item.name} activated : ${item.data.data.activatedtext}` }) + } } else { nrg.activated -= item.data.data.costspent nrg.max += item.data.data.costspent @@ -304,6 +312,9 @@ export class PegasusActor extends Actor { if (toRem.length) { await this.deleteEmbeddedDocuments('Item', toRem) } + if (item.data.data.deactivatedtext.length > 0) { + ChatMessage.create({ content: `Power ${item.name} deactivated : ${item.data.data.deactivatedtext}` }) + } } let update = { _id: item.id, "data.activated": !item.data.data.activated } await this.updateEmbeddedDocuments('Item', [update]) // Updates one EmbeddedEntity @@ -612,7 +623,9 @@ export class PegasusActor extends Actor { return false } } - + if (item.data.type == "power" && item.data.data.purchasedtext.length > 0 ) { + ChatMessage.create({ content: `Power ${item.name} puchased : ${item.data.data.purchasedtext}` }) + } let dropID = $(event.target).parents(".item").attr("data-item-id") // Only relevant if container drop let objectID = item.id || item._id this.addObjectToContainer(objectID, dropID) @@ -1408,7 +1421,7 @@ export class PegasusActor extends Actor { if (isPowerDmg && effect.data.stataffected == "powerdmgroll") { this.pushEffect(rollData, effect) } - + } } @@ -1433,7 +1446,7 @@ export class PegasusActor extends Actor { if (weapon.data.equipped && weapon.data.statistic == statKey) { rollData.weaponsList.push({ label: `Attack ${weapon.name}`, type: "attack", applied: false, weapon: weapon, value: 0, damageDice: PegasusUtility.getDiceFromLevel(0) }) } - if (weapon.data.equipped && weapon.data.canbethrown && statKey == "agi" ) { + if (weapon.data.equipped && weapon.data.canbethrown && statKey == "agi") { rollData.weaponsList.push({ label: `Attack ${weapon.name}`, type: "attack", applied: false, weapon: weapon, value: 0, damageDice: PegasusUtility.getDiceFromLevel(0) }) } if (weapon.data.equipped && weapon.data.enhanced && weapon.data.enhancedstat == statKey) { diff --git a/system.json b/system.json index c35398c..4264772 100644 --- a/system.json +++ b/system.json @@ -270,9 +270,9 @@ "styles": [ "styles/simple.css" ], - "templateVersion": 108, + "templateVersion": 109, "title": "Pegasus RPG", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", - "version": "0.6.25", + "version": "0.6.26", "background" : "./images/ui/pegasus_welcome_page.webp" } diff --git a/template.json b/template.json index a432e42..a675ea5 100644 --- a/template.json +++ b/template.json @@ -517,6 +517,10 @@ "activated": false, "purchasedeffects": "", "effectsgained": [], + "purchasedtext": "", + "activatedtext": "", + "deactivatedtext": "", + "powerlevelcost": "", "dmgroll": false, "dmgstatistic": "", "description": "" diff --git a/templates/item-power-sheet.html b/templates/item-power-sheet.html index 3aa2886..8d2bd72 100644 --- a/templates/item-power-sheet.html +++ b/templates/item-power-sheet.html @@ -114,6 +114,21 @@ {{/if}} +