From de3e16a3f0a70ba91d18e4cc7a58d152e016a726 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Thu, 6 Oct 2022 13:17:42 +0200 Subject: [PATCH] Fix #103 size warning --- modules/pegasus-actor.js | 43 ++++++++++++++++++++++++++++++---------- system.json | 4 ++-- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js index 8292c3f..bddf304 100644 --- a/modules/pegasus-actor.js +++ b/modules/pegasus-actor.js @@ -811,8 +811,8 @@ export class PegasusActor extends Actor { ChatMessage.create({ content: "Effects of this type cannot be applied while Immunity is applied" }) return } - if ( item.system.droptext && item.system.droptext.length > 0) { - ChatMessage.create( { content: `Effect ${item.name} message : ${item.system.droptext}`}) + if (item.system.droptext && item.system.droptext.length > 0) { + ChatMessage.create({ content: `Effect ${item.name} message : ${item.system.droptext}` }) } } @@ -918,7 +918,7 @@ export class PegasusActor extends Actor { } else { stat = duplicate(this.system.statistics[statKey]) } - if ( stat.currentlevel) { + if (stat.currentlevel) { stat.dice = PegasusUtility.getDiceFromLevel(stat.currentlevel) } else { stat.dice = PegasusUtility.getDiceFromLevel(stat.value || stat.level) @@ -1810,6 +1810,27 @@ export class PegasusActor extends Actor { } } + /* -------------------------------------------- */ + processVehicleTargetMessage(rollData) { + if (rollData.defenderTokenId) { + let vehicle = game.canvas.tokens.get(rollData.defenderTokenId).actor + if (vehicle.type == "vehicle") { + if (rollData.subKey == "defence" && vehicle.system.statistics.ad.currentspeed == "crawling") { + ChatMessage.create({ content: `${vehicle.name} is moving at Crawling speed : add a D8 to your Attack Dice Pool against this Vehicle` }) + } + if (rollData.subKey == "defence" && vehicle.system.statistics.ad.currentspeed == "slow") { + ChatMessage.create({ content: `${vehicle.name} is moving at Slow speed : add a D4 to your Attack Dice Pool against this Vehicle` }) + } + } + if (this.type == "vehicle" && rollData.statKey == "man" && this.system.statistics.ad.currentspeed == "fast") { + ChatMessage.create({ content: `Vehicle is moving at Fast speed : anyone using the vehicles MAN Dice Pool suffers a D8 Hindrance which is added to the Difficulty Dice Pool against this Vehicle` }) + } + if (this.type == "vehicle" && rollData.statKey == "man" && this.system.statistics.ad.currentspeed == "extfast") { + ChatMessage.create({ content: `Vehicle is moving at Extremely Fast speed : anyone using the vehicles MAN Dice Pool suffers a D12 Hindrance which is added to the Difficulty Dice Pool against this Vehicle` }) + } + } + } + /* -------------------------------------------- */ getCommonRollData(statKey = undefined, useShield = false, isInit = false, isPower = false, subKey = "", vehicle = undefined) { let rollData = PegasusUtility.getBasicRollData(isInit) @@ -1869,8 +1890,6 @@ export class PegasusActor extends Actor { vehicle.addVehicleShields(rollData) } vehicle.addEffects(rollData, false, false, false) - //this.addVehiculeHindrances(rollData.effectsList, vehicle) - //this.addVehicleBonus(rollData, vehicle) } rollData.specList = this.getRelevantSpec(statKey) @@ -1914,6 +1933,8 @@ export class PegasusActor extends Actor { this.addArmorsShields(rollData, statKey, useShield, subKey) this.addWeapons(rollData, statKey, useShield) this.addEquipments(rollData, statKey) + this.processVehicleTargetMessage(rollData) + console.log("ROLLDATA", rollData) return rollData @@ -1923,9 +1944,9 @@ export class PegasusActor extends Actor { processSizeBonus(rollData) { if (rollData.defenderTokenId) { let diffSize = 0 - if ( this.type == "character") { - this.system.biodata.sizenum = this.system.biodata?.sizenum?? 0 - this.system.biodata.sizebonus = this.system.biodata?.sizebonus?? 0 + if (this.type == "character") { + this.system.biodata.sizenum = this.system.biodata?.sizenum ?? 0 + this.system.biodata.sizebonus = this.system.biodata?.sizebonus ?? 0 diffSize = rollData.defenderSize - this.system.biodata.sizenum + this.system.biodata.sizebonus } else { diffSize = rollData.defenderSize - this.system.statistics.hr.size @@ -2197,7 +2218,7 @@ export class PegasusActor extends Actor { } } } - + /* -------------------------------------------- */ async computeVehicleStats() { @@ -2313,8 +2334,8 @@ export class PegasusActor extends Actor { return } - if ( item.type == "effect" && item.system.droptext && item.system.droptext.length > 0) { - ChatMessage.create( { content: `Effect ${item.name} message : ${item.system.droptext}`}) + if (item.type == "effect" && item.system.droptext && item.system.droptext.length > 0) { + ChatMessage.create({ content: `Effect ${item.name} message : ${item.system.droptext}` }) } //console.log(">>>>> item", item.type, __isVehicleUnique[item.type]) if (__isVehicleUnique[item.type]) { diff --git a/system.json b/system.json index 6db8e39..08de78a 100644 --- a/system.json +++ b/system.json @@ -253,7 +253,7 @@ ], "title": "Pegasus RPG", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", - "version": "10.1.2", - "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.1.2.zip", + "version": "10.1.3", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.1.3.zip", "background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp" } \ No newline at end of file