Compare commits

...

8 Commits

Author SHA1 Message Date
3c893e9be5 Fix #116 2022-11-01 15:12:18 +01:00
e288344bf5 Fix #115 fix negative effect 2022-10-07 17:50:42 +02:00
aa5b13ae07 Fix #115 fix negative effect 2022-10-07 17:50:28 +02:00
b2dd8edab2 Fix #115 fix negative effect 2022-10-07 17:45:53 +02:00
8fac4dcb36 Managev9/v10 + search button 2022-10-07 16:51:44 +02:00
2c015d8f8f Managev9/v10 + search button 2022-10-07 16:51:03 +02:00
fdbfbf0350 Fix #113 weapon modules 2022-10-07 11:25:43 +02:00
37d27104fc Fix #113 weapon modules 2022-10-07 10:48:44 +02:00
5 changed files with 55 additions and 19 deletions

View File

@ -15,7 +15,7 @@ const __statBuild = [
//{ modules: ["vehiclehull"], field: "pc", itemfield: "vms", subfield: "avgnrg" }, //{ modules: ["vehiclehull"], field: "pc", itemfield: "vms", subfield: "avgnrg" },
//{ modules: ["powercoremodule"], field: "pc", itemfield: "nrg", subfield: "avgnrg" }, //{ modules: ["powercoremodule"], field: "pc", itemfield: "nrg", subfield: "avgnrg" },
{ modules: ["vehiclehull", "mobilitymodule"], itemfield: "man", field: "man", additionnal1: "turningarc45" }, { modules: ["vehiclehull", "mobilitymodule"], itemfield: "man", field: "man", additionnal1: "turningarc45" },
{ modules: ["powercoremodule"], field: "pc", itemfield: "pc", additionnal1: "curnrg", additionnal2: "maxnrg" }, { modules: ["powercoremodule"], field: "pc", itemfield: "pc" },
{ modules: ["mobilitymodule"], field: "mr", itemfield: "mr" }, { modules: ["mobilitymodule"], field: "mr", itemfield: "mr" },
{ modules: ["propulsionmodule"], field: "ad", itemfield: "ad" }, { modules: ["propulsionmodule"], field: "ad", itemfield: "ad" },
{ modules: ["combatmodule"], field: "fc", itemfield: "fc" }, { modules: ["combatmodule"], field: "fc", itemfield: "fc" },
@ -194,8 +194,13 @@ export class PegasusActor extends Actor {
let comp = this.items.filter(item => item.type == 'vehiclemodule'); let comp = this.items.filter(item => item.type == 'vehiclemodule');
return comp; return comp;
} }
getVehicleWeaponModules() { getVehicleWeaponModules( activated = false ) {
let comp = this.items.filter(item => item.type == 'vehicleweaponmodule' && item.system.activated); let comp = []
if (activated ) {
comp = this.items.filter(item => item.type == 'vehicleweaponmodule' && item.system.activated)
} else {
comp = this.items.filter(item => item.type == 'vehicleweaponmodule' )
}
return comp; return comp;
} }
@ -1344,21 +1349,21 @@ export class PegasusActor extends Actor {
if (this.isOwner || game.user.isGM) { if (this.isOwner || game.user.isGM) {
let updates = {} let updates = {}
let phyDiceValue = PegasusUtility.getDiceValue(this.system.statistics.phy.value) + this.system.secondary.health.bonus + this.system.statistics.phy.mod; let phyDiceValue = PegasusUtility.getDiceValue(this.system.statistics.phy.value) + this.system.secondary.health.bonus + this.system.statistics.phy.mod + PegasusUtility.getDiceValue(this.system.phy.bonuseffect);
if (phyDiceValue != this.system.secondary.health.max) { if (phyDiceValue != this.system.secondary.health.max) {
updates['system.secondary.health.max'] = phyDiceValue updates['system.secondary.health.max'] = phyDiceValue
} }
if (this.computeValue) { if (this.computeValue) {
updates['system.secondary.health.value'] = phyDiceValue updates['system.secondary.health.value'] = phyDiceValue
} }
let mndDiceValue = PegasusUtility.getDiceValue(this.system.statistics.mnd.value) + this.system.secondary.delirium.bonus + this.system.statistics.mnd.mod; let mndDiceValue = PegasusUtility.getDiceValue(this.system.statistics.mnd.value) + this.system.secondary.delirium.bonus + this.system.statistics.mnd.mod + PegasusUtility.getDiceValue(this.system.mnd.bonuseffect);
if (mndDiceValue != this.system.secondary.delirium.max) { if (mndDiceValue != this.system.secondary.delirium.max) {
updates['system.secondary.delirium.max'] = mndDiceValue updates['system.secondary.delirium.max'] = mndDiceValue
} }
if (this.computeValue) { if (this.computeValue) {
updates['system.secondary.delirium.value'] = mndDiceValue updates['system.secondary.delirium.value'] = mndDiceValue
} }
let stlDiceValue = PegasusUtility.getDiceValue(this.system.statistics.stl.value) + this.system.secondary.stealthhealth.bonus + this.system.statistics.stl.mod; let stlDiceValue = PegasusUtility.getDiceValue(this.system.statistics.stl.value) + this.system.secondary.stealthhealth.bonus + this.system.statistics.stl.mod + PegasusUtility.getDiceValue(this.system.stl.bonuseffect);
if (stlDiceValue != this.system.secondary.stealthhealth.max) { if (stlDiceValue != this.system.secondary.stealthhealth.max) {
updates['system.secondary.stealthhealth.max'] = stlDiceValue updates['system.secondary.stealthhealth.max'] = stlDiceValue
} }
@ -1366,7 +1371,7 @@ export class PegasusActor extends Actor {
updates['system.secondary.stealthhealth.value'] = stlDiceValue updates['system.secondary.stealthhealth.value'] = stlDiceValue
} }
let socDiceValue = PegasusUtility.getDiceValue(this.system.statistics.soc.value) + this.system.secondary.socialhealth.bonus + this.system.statistics.soc.mod; let socDiceValue = PegasusUtility.getDiceValue(this.system.statistics.soc.value) + this.system.secondary.socialhealth.bonus + this.system.statistics.soc.mod + PegasusUtility.getDiceValue(this.system.soc.bonuseffect);
if (socDiceValue != this.system.secondary.socialhealth.max) { if (socDiceValue != this.system.secondary.socialhealth.max) {
updates['system.secondary.socialhealth.max'] = socDiceValue updates['system.secondary.socialhealth.max'] = socDiceValue
} }
@ -1374,7 +1379,7 @@ export class PegasusActor extends Actor {
updates['system.secondary.socialhealth.value'] = socDiceValue updates['system.secondary.socialhealth.value'] = socDiceValue
} }
let nrgValue = PegasusUtility.getDiceValue(this.system.statistics.foc.value) + this.system.nrg.mod + this.system.statistics.foc.mod let nrgValue = PegasusUtility.getDiceValue(this.system.statistics.foc.value) + this.system.nrg.mod + this.system.statistics.foc.mod + PegasusUtility.getDiceValue(this.system.foc.bonuseffect)
if (nrgValue != this.system.nrg.absolutemax) { if (nrgValue != this.system.nrg.absolutemax) {
updates['system.nrg.absolutemax'] = nrgValue updates['system.nrg.absolutemax'] = nrgValue
} }
@ -1454,17 +1459,27 @@ export class PegasusActor extends Actor {
if (this.system.biodata.noautobonus) { // If we are in "no-bonus mode if (this.system.biodata.noautobonus) { // If we are in "no-bonus mode
return return
} }
let effects = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice) let effectsPlus = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice)
let effectsMinus = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "negative" && effect.system.reducedicevalue)
for (let statKey in this.system.statistics) { for (let statKey in this.system.statistics) {
let stat = duplicate(this.system.statistics[statKey]) let stat = duplicate(this.system.statistics[statKey])
let bonus = 0 let bonus = 0
for (let effect of effects) { for (let effect of effectsPlus) {
if (effect.system.stataffected == statKey) { if (effect.system.stataffected == statKey) {
bonus += Number(effect.system.effectlevel) bonus += Number(effect.system.effectlevel)
} }
} }
for (let effect of effectsMinus) {
if (effect.system.stataffected == statKey) {
bonus -= Number(effect.system.effectlevel)
}
}
if (bonus != stat.bonuseffect) { if (bonus != stat.bonuseffect) {
stat.bonuseffect = bonus stat.bonuseffect = bonus
if ( stat.bonuseffect + stat.value < 1) {
stat.value = 1
stat.bonuseffect = 0
}
this.update({ [`system.statistics.${statKey}`]: stat }) this.update({ [`system.statistics.${statKey}`]: stat })
} }
} }
@ -1739,7 +1754,7 @@ export class PegasusActor extends Actor {
let effects = this.items.filter(item => item.type == 'effect') let effects = this.items.filter(item => item.type == 'effect')
for (let effect of effects) { for (let effect of effects) {
effect = duplicate(effect) effect = duplicate(effect)
if (!effect.system.hindrance && !effect.system.statdice if (!effect.system.hindrance && !effect.system.statdice && !effect.system.reducedicevalue
&& (effect.system.stataffected != "notapplicable" || effect.system.specaffected.length > 0) && (effect.system.stataffected != "notapplicable" || effect.system.specaffected.length > 0)
&& effect.system.stataffected != "special" && effect.system.stataffected != "special"
&& effect.system.stataffected != "powerroll" && effect.system.stataffected != "powerroll"
@ -1801,7 +1816,7 @@ export class PegasusActor extends Actor {
} }
addVehicleWeapons(rollData, vehicle) { addVehicleWeapons(rollData, vehicle) {
if (vehicle) { if (vehicle) {
let modules = vehicle.items.filter(vehicle => vehicle.type == "vehicleweaponmodule") let modules = vehicle.items.filter(item => item.type == "vehicleweaponmodule" && item.system.activated)
if (modules && modules.length > 0) { if (modules && modules.length > 0) {
for (let module of modules) { for (let module of modules) {
rollData.vehicleWeapons.push({ label: `Weapon ${module.name}`, type: "item", applied: false, weapon: module, value: module.system.damagedicevalue }) rollData.vehicleWeapons.push({ label: `Weapon ${module.name}`, type: "item", applied: false, weapon: module, value: module.system.damagedicevalue })
@ -2209,19 +2224,32 @@ export class PegasusActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
processVehicleStatEffects() { processVehicleStatEffects() {
let effects = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice) let effectsPlus = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice)
let effectsMinus = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "negative" && effect.system.reducedicevalue)
for (let statKey in this.system.statistics) { for (let statKey in this.system.statistics) {
let stat = duplicate(this.system.statistics[statKey]) let stat = duplicate(this.system.statistics[statKey])
let bonus = 0 let bonus = 0
for (let effect of effects) { for (let effect of effectsPlus) {
if (effect.system.stataffected == statKey) { if (effect.system.stataffected == statKey) {
bonus += Number(effect.system.effectlevel) bonus += Number(effect.system.effectlevel)
} }
} }
for (let effect of effectsMinus) {
if (effect.system.stataffected == statKey) {
bonus -= Number(effect.system.effectlevel)
}
}
if (bonus != stat.bonuseffect) { if (bonus != stat.bonuseffect) {
stat.bonuseffect = bonus stat.bonuseffect = bonus
if ( stat.bonuseffect + stat.level < 1) {
stat.level = 1
stat.bonuseffect = 0
}
if (stat.currentlevel > stat.bonuseffect+stat.level) {
stat.currentlevel = stat.bonuseffect+stat.level
}
this.update({ [`system.statistics.${statKey}`]: stat }) this.update({ [`system.statistics.${statKey}`]: stat })
} }
} }
} }
@ -2364,6 +2392,13 @@ export class PegasusActor extends Actor {
return false return false
} }
} }
// NRG max management
if (item.type == "powercoremodule" ) {
if (this.system.statistics.pc.maxnrg != item.system.nrg ) {
this.update( {'system.statistics.pc.maxnrg': item.system.nrg })
}
}
// Cargo management // Cargo management
if (__isVehicleCargo[item.type]) { if (__isVehicleCargo[item.type]) {
let capacity = this.getCurrentCargoCapacity() let capacity = this.getCurrentCargoCapacity()

View File

@ -544,7 +544,7 @@ export class PegasusUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getDiceFromLevel(level = 0) { static getDiceFromLevel(level = 0) {
level = Number(level) level = Math.max( Number(level), 0)
return this.diceList[level]; return this.diceList[level];
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -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.5", "version": "10.1.10",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.1.5.zip", "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.1.10.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

@ -5,6 +5,7 @@
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name"/></h1> <h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name"/></h1>
</div> </div>
</header> </header>
{{> systems/fvtt-pegasus-rpg/templates/partial-item-nav.html}} {{> systems/fvtt-pegasus-rpg/templates/partial-item-nav.html}}
{{!-- Sheet Body --}} {{!-- Sheet Body --}}

View File

@ -540,7 +540,7 @@
<span class="item-field-label-medium">{{weapon.system.location}}</span> <span class="item-field-label-medium">{{weapon.system.location}}</span>
<span class="item-field-label-short">{{weapon.system.dmg}}</span> <span class="item-field-label-short">{{weapon.system.dmg}}</span>
<span class="item-field-label-medium">{{weapon.system.aoe}}</span> <span class="item-field-label-medium">{{weapon.system.aoe}}</span>
<span class="item-field-label-medium">{{weapon.system.turrent}}</span> <span class="item-field-label-medium">{{weapon.system.turret}}</span>
<span class="item-field-label-short">{{weapon.system.nrg}}</span> <span class="item-field-label-short">{{weapon.system.nrg}}</span>
<span class="item-field-label-short"> <span class="item-field-label-short">