Minor fixes on powers

This commit is contained in:
sladecraven 2022-08-28 18:51:52 +02:00
parent f92d8552bc
commit 92cea77239
4 changed files with 37 additions and 5 deletions

View File

@ -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)
@ -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) {

View File

@ -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"
}

View File

@ -517,6 +517,10 @@
"activated": false,
"purchasedeffects": "",
"effectsgained": [],
"purchasedtext": "",
"activatedtext": "",
"deactivatedtext": "",
"powerlevelcost": "",
"dmgroll": false,
"dmgstatistic": "",
"description": ""

View File

@ -114,6 +114,21 @@
</li>
{{/if}}
<li class="flexrow"><label class="generic-label">When purchased display text</label>
<input type="text" class="padd-right" name="data.purchasedtext" value="{{data.purchasedtext}}" data-dtype="String"/>
</li>
<li class="flexrow"><label class="generic-label">When activated display text</label>
<input type="text" class="padd-right" name="data.activatedtext" value="{{data.activatedtext}}" data-dtype="String"/>
</li>
<li class="flexrow"><label class="generic-label">When deactivated display text</label>
<input type="text" class="padd-right" name="data.deactivatedtext" value="{{data.deactivatedtext}}" data-dtype="String"/>
</li>
<li class="flexrow"><label class="generic-label">Power Level Cost</label>
<input type="text" class="input-numeric-short padd-right" name="data.powerlevelcost" value="{{data.powerlevelcost}}"
data-dtype="Number" />
</li>
<li class="flexrow"><label class="generic-label">Effects Gained</label>
</li>
<li>