Compare commits

...

5 Commits

Author SHA1 Message Date
45332702dc Fix #99 effect stat for vehicle 2022-10-05 21:14:46 +02:00
d8215301b4 Fix #99 effect stat for vehicle 2022-10-05 21:14:15 +02:00
932573c9ae Fix #98 hindrance stuff 2022-10-05 14:44:35 +02:00
d6a57de134 Fix #98 hindrance stuff 2022-10-05 14:44:12 +02:00
e2d5a0ec74 Fix #96 hindrance stuff 2022-10-05 14:38:31 +02:00
4 changed files with 1919 additions and 1893 deletions

View File

@ -124,9 +124,9 @@ export class PegasusActor extends Actor {
this.updateSize() this.updateSize()
} }
if (this.type == 'vehicle') { if (this.type == 'vehicle') {
this.computeVehicleStats(); this.computeVehicleStats()
} }
super.prepareDerivedData(); super.prepareDerivedData()
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -263,8 +263,10 @@ export class PegasusActor extends Actor {
effect.system.stataffected = "mr" effect.system.stataffected = "mr"
effect.system.bonusdice = true effect.system.bonusdice = true
await this.createEmbeddedDocuments('Item', [effect]) await this.createEmbeddedDocuments('Item', [effect])
ChatMessage.create({ content: `Tactician Bonus Dice has been added to ${this.name} (${level})`, ChatMessage.create({
whisper: ChatMessage.getWhisperRecipients('GM') } ) content: `Tactician Bonus Dice has been added to ${this.name} (${level})`,
whisper: ChatMessage.getWhisperRecipients('GM')
})
} }
async removeTacticianEffect() { async removeTacticianEffect() {
let effect = this.items.find(item => item.name.toLowerCase().includes("tactician bonus dice")) let effect = this.items.find(item => item.name.toLowerCase().includes("tactician bonus dice"))
@ -2161,6 +2163,23 @@ addTopSpeedBonus(topspeed, bonus) {
effect.system.isspeed = speed effect.system.isspeed = speed
await this.createEmbeddedDocuments("Item", [effect]) await this.createEmbeddedDocuments("Item", [effect])
} }
/* -------------------------------------------- */
processVehicleStatEffects() {
let effects = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice)
for (let statKey in this.system.statistics) {
let stat = duplicate(this.system.statistics[statKey])
let bonus = 0
for (let effect of effects) {
if (effect.system.stataffected == statKey) {
bonus += Number(effect.system.effectlevel)
}
}
if (bonus != stat.bonuseffect) {
stat.bonuseffect = bonus
this.update({ [`system.statistics.${statKey}`]: stat })
}
}
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async computeVehicleStats() { async computeVehicleStats() {
@ -2252,6 +2271,7 @@ addTopSpeedBonus(topspeed, bonus) {
ChatMessage.create({ content: `The vehicle ${this.name} has been destroyed !` }) ChatMessage.create({ content: `The vehicle ${this.name} has been destroyed !` })
} }
this.processVehicleArmorShields() this.processVehicleArmorShields()
this.processVehicleStatEffects()
} }
} }

View File

@ -146,10 +146,10 @@ export class PegasusUtility {
static updateEffectsBonusDice(rollData) { static updateEffectsBonusDice(rollData) {
let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-bonus-dice") let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-bonus-dice")
for (let effect of rollData.effectsList) { for (let effect of rollData.effectsList) {
if (effect && effect.applied && effect.type == "effect" && effect.effect && effect.effect.system.bonusdice) { if (effect && effect.applied && effect.type == "effect" && !effect.effect?.system?.hindrance && effect.effect && effect.effect.system.bonusdice) {
newDicePool = newDicePool.concat(this.buildDicePool("effect-bonus-dice", effect.effect.system.effectlevel, 0, effect.effect.name)) newDicePool = newDicePool.concat(this.buildDicePool("effect-bonus-dice", effect.effect.system.effectlevel, 0, effect.effect.name))
} }
if (effect && effect.applied && effect.type == "effect" && effect.value && effect.isdynamic) { if (effect && effect.applied && effect.type == "effect" && effect.value && effect.isdynamic && !effect.effect?.system?.hindrance) {
newDicePool = newDicePool.concat(this.buildDicePool("effect-bonus-dice", effect.value, 0, effect.name)) newDicePool = newDicePool.concat(this.buildDicePool("effect-bonus-dice", effect.value, 0, effect.name))
} }
} }
@ -161,7 +161,9 @@ export class PegasusUtility {
let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-hindrance") let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-hindrance")
for (let hindrance of rollData.effectsList) { for (let hindrance of rollData.effectsList) {
if (hindrance && hindrance.applied && (hindrance.type == "hindrance" || (hindrance.type == "effect" && hindrance.effect?.system?.hindrance))) { if (hindrance && hindrance.applied && (hindrance.type == "hindrance" || (hindrance.type == "effect" && hindrance.effect?.system?.hindrance))) {
console.log("Adding Hindrance 1", hindrance, newDicePool)
newDicePool = newDicePool.concat(this.buildDicePool("effect-hindrance", (hindrance.value) ? hindrance.value : hindrance.effect.system.effectlevel, 0, hindrance.name)) newDicePool = newDicePool.concat(this.buildDicePool("effect-hindrance", (hindrance.value) ? hindrance.value : hindrance.effect.system.effectlevel, 0, hindrance.name))
console.log("Adding Hindrance 2", newDicePool)
} }
} }
rollData.dicePool = newDicePool rollData.dicePool = newDicePool
@ -1211,11 +1213,15 @@ export class PegasusUtility {
if (token.document.disposition == 0) { if (token.document.disposition == 0) {
continue continue
} }
let disposition = ( token.document.disposition == -1) ? 1 : -1 let ennemies = []
let ennemies = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && newToken.document.disposition == disposition) if (token.document.disposition == -1) {
let neutrals = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && newToken.document.disposition == 0) ennemies = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && (newToken.document.disposition == 1 || newToken.document.disposition == 0 ))
if (neutrals ) { }
ennemies = ennemies.concat(neutrals) if (token.document.disposition == 1) {
ennemies = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && (newToken.document.disposition == -1 || newToken.document.disposition == 0 ))
}
if (token.document.disposition == 0) {
ennemies = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && (newToken.document.disposition == -1 || newToken.document.disposition == 1 ))
} }
for (let ennemy of ennemies) { for (let ennemy of ennemies) {
if (ennemy.actor.id != token.actor.id) { if (ennemy.actor.id != token.actor.id) {

View File

@ -23,7 +23,7 @@
"manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/raw/branch/master/system.json", "manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/raw/branch/master/system.json",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",
"verified": "10.285", "verified": "10.286",
"maximum": "10" "maximum": "10"
}, },
"id": "fvtt-pegasus-rpg", "id": "fvtt-pegasus-rpg",
@ -253,7 +253,7 @@
], ],
"title": "Pegasus RPG", "title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "10.1.0", "version": "10.1.2",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.1.0.zip", "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.1.2.zip",
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp" "background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
} }

View File

@ -14,7 +14,7 @@
</span> </span>
<select class="status-small-label color-class-common" type="text" name="system.statistics.{{key}}.level" <select class="status-small-label color-class-common" type="text" name="system.statistics.{{key}}.level"
value="{{stat.level}}" data-dtype="Number" disabled> value="{{stat.level}}" data-dtype="Number" disabled>
{{#select stat.level}} {{#select (add stat.level stat.bonuseffect)}}
{{#if (eq key "ad")}} {{#if (eq key "ad")}}
{{{@root.optionsLevel}}} {{{@root.optionsLevel}}}
{{else}} {{else}}