Compare commits

..

12 Commits

Author SHA1 Message Date
de3e16a3f0 Fix #103 size warning 2022-10-06 13:17:42 +02:00
7fcb5c36b6 Fix #103 size warning 2022-10-06 12:48:58 +02:00
be83dbd055 Fix #103 size warning 2022-10-06 12:47:17 +02:00
662804c658 Fix #103 size warning 2022-10-06 12:42:10 +02:00
4311a4762d Fix #100 effect message 2022-10-06 12:38:31 +02:00
8ddc3ad776 Fix #102 agitator neutral 2022-10-06 12:25:15 +02:00
f4a8aa7927 Fix #101 current level for rolls 2022-10-06 12:22:29 +02:00
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
6 changed files with 1963 additions and 1895 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"))
@ -809,8 +811,10 @@ checkVice(vice) {
ChatMessage.create({ content: "Effects of this type cannot be applied while Immunity is applied" }) ChatMessage.create({ content: "Effects of this type cannot be applied while Immunity is applied" })
return return
} }
if (item.system.droptext && item.system.droptext.length > 0) {
ChatMessage.create({ content: `Effect ${item.name} message : ${item.system.droptext}` })
}
} }
if (item.type == 'race') { if (item.type == 'race') {
this.applyRace(item) this.applyRace(item)
@ -910,12 +914,16 @@ syncRoll(rollData) {
getStat(statKey) { getStat(statKey) {
let stat let stat
if (this.type == "character" && statKey == 'mr') { if (this.type == "character" && statKey == 'mr') {
stat = duplicate(this.system.mr); stat = duplicate(this.system.mr)
} else { } else {
stat = duplicate(this.system.statistics[statKey]); stat = duplicate(this.system.statistics[statKey])
} }
stat.dice = PegasusUtility.getDiceFromLevel(stat.value || stat.level); if (stat.currentlevel) {
return stat; stat.dice = PegasusUtility.getDiceFromLevel(stat.currentlevel)
} else {
stat.dice = PegasusUtility.getDiceFromLevel(stat.value || stat.level)
}
return stat
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -1802,6 +1810,27 @@ addVehicleWeapons(rollData, vehicle) {
} }
} }
/* -------------------------------------------- */
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) { getCommonRollData(statKey = undefined, useShield = false, isInit = false, isPower = false, subKey = "", vehicle = undefined) {
let rollData = PegasusUtility.getBasicRollData(isInit) let rollData = PegasusUtility.getBasicRollData(isInit)
@ -1826,8 +1855,12 @@ getCommonRollData(statKey = undefined, useShield = false, isInit = false, isPowe
rollData.stat = this.getStat(statKey) rollData.stat = this.getStat(statKey)
if (rollData.stat.value != undefined) { if (rollData.stat.value != undefined) {
rollData.stat.level = rollData.stat.value // Normalize rollData.stat.level = rollData.stat.value // Normalize
}
rollData.statDicesLevel = rollData.stat.level + rollData.stat.bonuseffect rollData.statDicesLevel = rollData.stat.level + rollData.stat.bonuseffect
}
if (rollData.stat.currentlevel) {
rollData.stat.level = rollData.stat.currentlevel
rollData.statDicesLevel = rollData.stat.currentlevel
}
rollData.statMod = rollData.stat.mod rollData.statMod = rollData.stat.mod
if (vehicle) { if (vehicle) {
rollData.vehicle = duplicate(vehicle) rollData.vehicle = duplicate(vehicle)
@ -1857,8 +1890,6 @@ getCommonRollData(statKey = undefined, useShield = false, isInit = false, isPowe
vehicle.addVehicleShields(rollData) vehicle.addVehicleShields(rollData)
} }
vehicle.addEffects(rollData, false, false, false) vehicle.addEffects(rollData, false, false, false)
//this.addVehiculeHindrances(rollData.effectsList, vehicle)
//this.addVehicleBonus(rollData, vehicle)
} }
rollData.specList = this.getRelevantSpec(statKey) rollData.specList = this.getRelevantSpec(statKey)
@ -1902,6 +1933,8 @@ getCommonRollData(statKey = undefined, useShield = false, isInit = false, isPowe
this.addArmorsShields(rollData, statKey, useShield, subKey) this.addArmorsShields(rollData, statKey, useShield, subKey)
this.addWeapons(rollData, statKey, useShield) this.addWeapons(rollData, statKey, useShield)
this.addEquipments(rollData, statKey) this.addEquipments(rollData, statKey)
this.processVehicleTargetMessage(rollData)
console.log("ROLLDATA", rollData) console.log("ROLLDATA", rollData)
return rollData return rollData
@ -1910,7 +1943,14 @@ getCommonRollData(statKey = undefined, useShield = false, isInit = false, isPowe
/* -------------------------------------------- */ /* -------------------------------------------- */
processSizeBonus(rollData) { processSizeBonus(rollData) {
if (rollData.defenderTokenId) { if (rollData.defenderTokenId) {
let diffSize = rollData.defenderSize - this.system.biodata.sizenum + this.system.biodata.sizebonus 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
diffSize = rollData.defenderSize - this.system.biodata.sizenum + this.system.biodata.sizebonus
} else {
diffSize = rollData.defenderSize - this.system.statistics.hr.size
}
//console.log("Diffsize", diffSize) //console.log("Diffsize", diffSize)
if (rollData.subKey == "melee-atk" || rollData.subKey == "ranged-atk") { if (rollData.subKey == "melee-atk" || rollData.subKey == "ranged-atk") {
if (diffSize > 0) { if (diffSize > 0) {
@ -2007,7 +2047,7 @@ rollUnarmedAttack() {
/*-------------------------------------------- */ /*-------------------------------------------- */
rollStat(statKey) { rollStat(statKey) {
let stat = this.getStat(statKey); let stat = this.getStat(statKey)
if (stat) { if (stat) {
let rollData = this.getCommonRollData(statKey) let rollData = this.getCommonRollData(statKey)
rollData.mode = "stat" rollData.mode = "stat"
@ -2161,6 +2201,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 +2309,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()
} }
} }
@ -2276,6 +2334,9 @@ getTotalCost() {
return return
} }
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]) //console.log(">>>>> item", item.type, __isVehicleUnique[item.type])
if (__isVehicleUnique[item.type]) { if (__isVehicleUnique[item.type]) {
let toDelList = [] let toDelList = []

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
@ -1208,14 +1210,15 @@ export class PegasusUtility {
let agitatorTokens = canvas.tokens.placeables.filter(token => token.actor.isAgitator() && !token.document.hidden) let agitatorTokens = canvas.tokens.placeables.filter(token => token.actor.isAgitator() && !token.document.hidden)
for (let token of agitatorTokens) { for (let token of agitatorTokens) {
token.refresh() token.refresh()
if (token.document.disposition == 0) { let ennemies = []
continue 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 ))
} }
let disposition = ( token.document.disposition == -1) ? 1 : -1 if (token.document.disposition == 1) {
let ennemies = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && newToken.document.disposition == disposition) ennemies = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && (newToken.document.disposition == -1 || newToken.document.disposition == 0 ))
let neutrals = canvas.tokens.placeables.filter(newToken => newToken.actor.type == "character" && !newToken.document.hidden && newToken.document.disposition == 0) }
if (neutrals ) { if (token.document.disposition == 0) {
ennemies = ennemies.concat(neutrals) 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.3",
"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.3.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

@ -417,6 +417,7 @@
"affectstatus": false, "affectstatus": false,
"affectedstatus": "", "affectedstatus": "",
"locked": false, "locked": false,
"droptext": "",
"description": "" "description": ""
}, },
"race": { "race": {

View File

@ -85,6 +85,9 @@
<li class="flexrow"><label class="generic-label">Locked (Only GM can change/edit) ?</label> <li class="flexrow"><label class="generic-label">Locked (Only GM can change/edit) ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="system.locked" {{checked data.locked}}/></label> <label class="attribute-value checkbox"><input type="checkbox" name="system.locked" {{checked data.locked}}/></label>
</li> </li>
<li class="flexrow"><label class="generic-label">Display Text when added to Actor</label>
<input type="text" class="input-numeric-short padd-right" name="system.droptext" value="{{data.droptext}}" data-dtype="String"/>
</li>
<li class="flexrow"><label class="generic-label">Affect Status?</label> <li class="flexrow"><label class="generic-label">Affect Status?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="system.affectstatus" {{checked data.affectstatus}}/></label> <label class="attribute-value checkbox"><input type="checkbox" name="system.affectstatus" {{checked data.affectstatus}}/></label>

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