Vehicles enhancements
This commit is contained in:
parent
7a9ed39d02
commit
5709ac0073
@ -246,7 +246,7 @@ export class PegasusActorSheet extends ActorSheet {
|
|||||||
this.actor.rollPool( 'agi', false, "ranged-atk");
|
this.actor.rollPool( 'agi', false, "ranged-atk");
|
||||||
});
|
});
|
||||||
html.find('.defense-roll').click((event) => {
|
html.find('.defense-roll').click((event) => {
|
||||||
this.actor.rollPool( 'def', true);
|
this.actor.rollPool( 'def', true, "defence");
|
||||||
});
|
});
|
||||||
html.find('.damage-melee').click((event) => {
|
html.find('.damage-melee').click((event) => {
|
||||||
this.actor.rollPool( 'str', false, "melee-dmg");
|
this.actor.rollPool( 'str', false, "melee-dmg");
|
||||||
@ -365,7 +365,10 @@ export class PegasusActorSheet extends ActorSheet {
|
|||||||
if (item == undefined) {
|
if (item == undefined) {
|
||||||
item = this.actor.items.get( dragData.uuid )
|
item = this.actor.items.get( dragData.uuid )
|
||||||
}
|
}
|
||||||
let ret = await this.actor.preprocessItem( event, item, true )
|
console.log("Dropped", item)
|
||||||
|
|
||||||
|
let itemFull = await PegasusUtility.searchItem( item )
|
||||||
|
let ret = await this.actor.preprocessItem( event, itemFull, true )
|
||||||
if ( ret ) {
|
if ( ret ) {
|
||||||
super._onDropItem(event, dragData)
|
super._onDropItem(event, dragData)
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ const coverBonusTable = { "nocover": 0, "lightcover": 2, "heavycover": 4, "entre
|
|||||||
const statThreatLevel = ["agi", "str", "phy", "com", "def", "per"]
|
const statThreatLevel = ["agi", "str", "phy", "com", "def", "per"]
|
||||||
const __subkey2title = {
|
const __subkey2title = {
|
||||||
"melee-dmg": "Melee Damage", "melee-atk": "Melee Attack", "ranged-atk": "Ranged Attack",
|
"melee-dmg": "Melee Damage", "melee-atk": "Melee Attack", "ranged-atk": "Ranged Attack",
|
||||||
"ranged-dmg": "Ranged Damage", "dmg-res": "Damare Resistance"
|
"ranged-dmg": "Ranged Damage", "defence": "Defence", "dmg-res": "Damare Resistance"
|
||||||
}
|
}
|
||||||
const __statBuild = [
|
const __statBuild = [
|
||||||
{ modules: ["vehiclehull"], field: "hr", itemfield: "hr" },
|
{ modules: ["vehiclehull"], field: "hr", itemfield: "hr" },
|
||||||
@ -24,7 +24,38 @@ const __isVehicleUnique = { vehiclehull:1, powercoremodule:1, mobilitymodule: 1,
|
|||||||
const __speed2Num = { fullstop: 0, crawling: 1, slow: 2, average: 3, fast: 4, extfast: 5 }
|
const __speed2Num = { fullstop: 0, crawling: 1, slow: 2, average: 3, fast: 4, extfast: 5 }
|
||||||
const __num2speed = ["fullstop", "crawling", "slow", "average", "fast", "extfast"]
|
const __num2speed = ["fullstop", "crawling", "slow", "average", "fast", "extfast"]
|
||||||
const __isVehicle = { vehiclehull: 1, powercoremodule: 1, mobilitymodule: 1, combatmodule: 1, propulsionmodule: 1, vehiclemodule: 1, vehicleweaponmodule: 1, effect: 1 }
|
const __isVehicle = { vehiclehull: 1, powercoremodule: 1, mobilitymodule: 1, combatmodule: 1, propulsionmodule: 1, vehiclemodule: 1, vehicleweaponmodule: 1, effect: 1 }
|
||||||
|
const __bonusEffect = {
|
||||||
|
name: "Crawling MAN Bonus", type: "effect", img: "systems/fvtt-pegasus-rpg/images/icons/icon_effect.webp",
|
||||||
|
system: {
|
||||||
|
type: "physical",
|
||||||
|
genre: "positive",
|
||||||
|
effectlevel: 3,
|
||||||
|
reducedicevalue: false,
|
||||||
|
stataffected: "man",
|
||||||
|
specaffected: [],
|
||||||
|
statdice: false,
|
||||||
|
bonusdice: true,
|
||||||
|
weapondamage: false,
|
||||||
|
hindrance: false,
|
||||||
|
resistedby: "notapplicable",
|
||||||
|
recoveryroll: false,
|
||||||
|
recoveryrollstat: "",
|
||||||
|
recoveryrollspec: [],
|
||||||
|
effectstatlevel: false,
|
||||||
|
effectstat: "",
|
||||||
|
oneuse: false,
|
||||||
|
ignorehealthpenalty: false,
|
||||||
|
isthispossible: "",
|
||||||
|
mentaldisruption: false,
|
||||||
|
physicaldisruption: false,
|
||||||
|
mentalimmunity: false,
|
||||||
|
physicalimmunity: false,
|
||||||
|
nobonusdice: false,
|
||||||
|
noperksallowed: false,
|
||||||
|
description: "",
|
||||||
|
otherdice: false
|
||||||
|
}
|
||||||
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/**
|
/**
|
||||||
* Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system.
|
* Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system.
|
||||||
@ -338,7 +369,7 @@ export class PegasusActor extends Actor {
|
|||||||
nrg.activated += item.system.costspent
|
nrg.activated += item.system.costspent
|
||||||
nrg.value -= item.system.costspent
|
nrg.value -= item.system.costspent
|
||||||
nrg.max -= item.system.costspent
|
nrg.max -= item.system.costspent
|
||||||
await this.update({ 'data.nrg': nrg })
|
await this.update({ 'system.nrg': nrg })
|
||||||
|
|
||||||
let effects = []
|
let effects = []
|
||||||
for (let effect of item.system.effectsgained) {
|
for (let effect of item.system.effectsgained) {
|
||||||
@ -354,7 +385,7 @@ export class PegasusActor extends Actor {
|
|||||||
} else {
|
} else {
|
||||||
nrg.activated -= item.system.costspent
|
nrg.activated -= item.system.costspent
|
||||||
nrg.max += item.system.costspent
|
nrg.max += item.system.costspent
|
||||||
await this.update({ 'data.nrg': nrg })
|
await this.update({ 'system.nrg': nrg })
|
||||||
|
|
||||||
let toRem = []
|
let toRem = []
|
||||||
for (let item of this.items) {
|
for (let item of this.items) {
|
||||||
@ -443,7 +474,7 @@ export class PegasusActor extends Actor {
|
|||||||
tl += equip.system.threatlevel
|
tl += equip.system.threatlevel
|
||||||
}
|
}
|
||||||
if (tl != this.system.biodata.threatlevel) {
|
if (tl != this.system.biodata.threatlevel) {
|
||||||
this.update({ 'data.biodata.threatlevel': tl })
|
this.update({ 'system.biodata.threatlevel': tl })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,7 +543,7 @@ export class PegasusActor extends Actor {
|
|||||||
let combat = duplicate(this.system.combat)
|
let combat = duplicate(this.system.combat)
|
||||||
combat.stunlevel += incDec
|
combat.stunlevel += incDec
|
||||||
if (combat.stunlevel >= 0) {
|
if (combat.stunlevel >= 0) {
|
||||||
this.update({ 'data.combat': combat })
|
this.update({ 'system.combat': combat })
|
||||||
let chatData = {
|
let chatData = {
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
rollMode: game.settings.get("core", "rollMode"),
|
rollMode: game.settings.get("core", "rollMode"),
|
||||||
@ -534,7 +565,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (incDec > 0 && stunAbove > 0) {
|
if (incDec > 0 && stunAbove > 0) {
|
||||||
let delirium = duplicate(this.system.secondary.delirium)
|
let delirium = duplicate(this.system.secondary.delirium)
|
||||||
delirium.value -= incDec
|
delirium.value -= incDec
|
||||||
this.update({ 'data.secondary.delirium': delirium })
|
this.update({ 'system.secondary.delirium': delirium })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,7 +573,7 @@ export class PegasusActor extends Actor {
|
|||||||
modifyMomentum(incDec) {
|
modifyMomentum(incDec) {
|
||||||
let momentum = duplicate(this.system.momentum)
|
let momentum = duplicate(this.system.momentum)
|
||||||
momentum.value += incDec
|
momentum.value += incDec
|
||||||
this.update({ 'data.momentum': momentum })
|
this.update({ 'system.momentum': momentum })
|
||||||
let chatData = {
|
let chatData = {
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
rollMode: game.settings.get("core", "rollMode"),
|
rollMode: game.settings.get("core", "rollMode"),
|
||||||
@ -592,11 +623,11 @@ export class PegasusActor extends Actor {
|
|||||||
ui.notifications.warn("Container is already full !")
|
ui.notifications.warn("Container is already full !")
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
await this.updateEmbeddedDocuments("Item", [{ _id: object.id, 'data.containerid': containerId }])
|
await this.updateEmbeddedDocuments("Item", [{ _id: object.id, 'system.containerid': containerId }])
|
||||||
}
|
}
|
||||||
} else if (object && object.system.containerid) { // remove from container
|
} else if (object && object.system.containerid) { // remove from container
|
||||||
console.log("Removeing: ", object)
|
console.log("Removeing: ", object)
|
||||||
await this.updateEmbeddedDocuments("Item", [{ _id: object.id, 'data.containerid': "" }]);
|
await this.updateEmbeddedDocuments("Item", [{ _id: object.id, 'system.containerid': "" }]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -629,6 +660,7 @@ export class PegasusActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async preprocessItem(event, item, onDrop = false) {
|
async preprocessItem(event, item, onDrop = false) {
|
||||||
|
|
||||||
|
console.log("Pre-process", item)
|
||||||
if (item.type != "effect" && __isVehicle[item.type]) {
|
if (item.type != "effect" && __isVehicle[item.type]) {
|
||||||
ui.notifications.warn("You can't drop Vehicles item over a character sheet.")
|
ui.notifications.warn("You can't drop Vehicles item over a character sheet.")
|
||||||
return
|
return
|
||||||
@ -656,11 +688,11 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
|
|
||||||
if (item.type == 'race') {
|
if (item.type == 'race') {
|
||||||
this.applyRace(item.system)
|
this.applyRace(item)
|
||||||
} else if (item.type == 'role') {
|
} else if (item.type == 'role') {
|
||||||
this.applyRole(item.system)
|
this.applyRole(item)
|
||||||
} else if (item.type == 'ability') {
|
} else if (item.type == 'ability') {
|
||||||
this.applyAbility(item.system, [], true)
|
this.applyAbility(item, [], true)
|
||||||
if (!onDrop) {
|
if (!onDrop) {
|
||||||
await this.createEmbeddedDocuments('Item', [item])
|
await this.createEmbeddedDocuments('Item', [item])
|
||||||
}
|
}
|
||||||
@ -720,7 +752,7 @@ export class PegasusActor extends Actor {
|
|||||||
async addSubActor(subActorId) {
|
async addSubActor(subActorId) {
|
||||||
let subActors = duplicate(this.system.subactors);
|
let subActors = duplicate(this.system.subactors);
|
||||||
subActors.push(subActorId);
|
subActors.push(subActorId);
|
||||||
await this.update({ 'data.subactors': subActors });
|
await this.update({ 'system.subactors': subActors });
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async delSubActor(subActorId) {
|
async delSubActor(subActorId) {
|
||||||
@ -730,7 +762,7 @@ export class PegasusActor extends Actor {
|
|||||||
newArray.push(id);
|
newArray.push(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.update({ 'data.subactors': newArray });
|
await this.update({ 'system.subactors': newArray });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -780,7 +812,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (powers.length > 0) {
|
if (powers.length > 0) {
|
||||||
this.createEmbeddedDocuments('Item', powers)
|
this.createEmbeddedDocuments('Item', powers)
|
||||||
}
|
}
|
||||||
this.updateEmbeddedDocuments('Item', [{ _id: specId, 'data.powersactivated': true }])
|
this.updateEmbeddedDocuments('Item', [{ _id: specId, 'system.powersactivated': true }])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -795,7 +827,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (toRem.length > 0) {
|
if (toRem.length > 0) {
|
||||||
this.deleteEmbeddedDocuments('Item', toRem)
|
this.deleteEmbeddedDocuments('Item', toRem)
|
||||||
}
|
}
|
||||||
this.updateEmbeddedDocuments('Item', [{ _id: specId, 'data.powersactivated': false }])
|
this.updateEmbeddedDocuments('Item', [{ _id: specId, 'system.powersactivated': false }])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -810,7 +842,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (effects.length > 0) {
|
if (effects.length > 0) {
|
||||||
this.createEmbeddedDocuments('Item', effects)
|
this.createEmbeddedDocuments('Item', effects)
|
||||||
}
|
}
|
||||||
this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'data.activated': true }])
|
this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'system.activated': true }])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,7 +857,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (toRem.length > 0) {
|
if (toRem.length > 0) {
|
||||||
this.deleteEmbeddedDocuments('Item', toRem)
|
this.deleteEmbeddedDocuments('Item', toRem)
|
||||||
}
|
}
|
||||||
this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'data.activated': false }])
|
this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'system.activated': false }])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -900,7 +932,7 @@ export class PegasusActor extends Actor {
|
|||||||
let item = this.items.get(itemId)
|
let item = this.items.get(itemId)
|
||||||
if (item && value) {
|
if (item && value) {
|
||||||
value = Number(value) || 0
|
value = Number(value) || 0
|
||||||
await this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'data.costspent': value }])
|
await this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'system.costspent': value }])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -910,7 +942,7 @@ export class PegasusActor extends Actor {
|
|||||||
for (let perk of this.items) {
|
for (let perk of this.items) {
|
||||||
if (perk.type == "perk") {
|
if (perk.type == "perk") {
|
||||||
this.cleanPerkEffects(perk.id)
|
this.cleanPerkEffects(perk.id)
|
||||||
this.updateEmbeddedDocuments('Item', [{ _id: perk.id, 'data.status': "ready", 'data.used1': false, 'data.used2': false, 'data.used3': false }])
|
this.updateEmbeddedDocuments('Item', [{ _id: perk.id, 'system.status': "ready", 'system.used1': false, 'system.used2': false, 'system.used3': false }])
|
||||||
ChatMessage.create({ content: `Perk ${perk.name} has been deactivated due to Severe Trauma state !` })
|
ChatMessage.create({ content: `Perk ${perk.name} has been deactivated due to Severe Trauma state !` })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -923,7 +955,7 @@ export class PegasusActor extends Actor {
|
|||||||
let nrg = duplicate(this.system.nrg)
|
let nrg = duplicate(this.system.nrg)
|
||||||
nrg.value += value
|
nrg.value += value
|
||||||
if (nrg.value >= 0 && nrg.value <= nrg.max) {
|
if (nrg.value >= 0 && nrg.value <= nrg.max) {
|
||||||
this.update({ 'data.nrg': nrg })
|
this.update({ 'system.nrg': nrg })
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let pc = duplicate(this.system.statistics.pc)
|
let pc = duplicate(this.system.statistics.pc)
|
||||||
@ -1175,64 +1207,64 @@ export class PegasusActor extends Actor {
|
|||||||
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;
|
||||||
if (phyDiceValue != this.system.secondary.health.max) {
|
if (phyDiceValue != this.system.secondary.health.max) {
|
||||||
updates['data.secondary.health.max'] = phyDiceValue
|
updates['system.secondary.health.max'] = phyDiceValue
|
||||||
}
|
}
|
||||||
if (this.computeValue) {
|
if (this.computeValue) {
|
||||||
updates['data.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;
|
||||||
if (mndDiceValue != this.system.secondary.delirium.max) {
|
if (mndDiceValue != this.system.secondary.delirium.max) {
|
||||||
updates['data.secondary.delirium.max'] = mndDiceValue
|
updates['system.secondary.delirium.max'] = mndDiceValue
|
||||||
}
|
}
|
||||||
if (this.computeValue) {
|
if (this.computeValue) {
|
||||||
updates['data.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;
|
||||||
if (stlDiceValue != this.system.secondary.stealthhealth.max) {
|
if (stlDiceValue != this.system.secondary.stealthhealth.max) {
|
||||||
updates['data.secondary.stealthhealth.max'] = stlDiceValue
|
updates['system.secondary.stealthhealth.max'] = stlDiceValue
|
||||||
}
|
}
|
||||||
if (this.computeValue) {
|
if (this.computeValue) {
|
||||||
updates['data.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;
|
||||||
if (socDiceValue != this.system.secondary.socialhealth.max) {
|
if (socDiceValue != this.system.secondary.socialhealth.max) {
|
||||||
updates['data.secondary.socialhealth.max'] = socDiceValue
|
updates['system.secondary.socialhealth.max'] = socDiceValue
|
||||||
}
|
}
|
||||||
if (this.computeValue) {
|
if (this.computeValue) {
|
||||||
updates['data.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
|
||||||
if (nrgValue != this.system.nrg.absolutemax) {
|
if (nrgValue != this.system.nrg.absolutemax) {
|
||||||
updates['data.nrg.absolutemax'] = nrgValue
|
updates['system.nrg.absolutemax'] = nrgValue
|
||||||
}
|
}
|
||||||
if (this.computeValue) {
|
if (this.computeValue) {
|
||||||
updates['data.nrg.max'] = nrgValue
|
updates['system.nrg.max'] = nrgValue
|
||||||
updates['data.nrg.value'] = nrgValue
|
updates['system.nrg.value'] = nrgValue
|
||||||
}
|
}
|
||||||
|
|
||||||
let stunth = PegasusUtility.getDiceValue(this.system.statistics.phy.value) + PegasusUtility.getDiceValue(this.system.statistics.mnd.value) + PegasusUtility.getDiceValue(this.system.statistics.foc.value)
|
let stunth = PegasusUtility.getDiceValue(this.system.statistics.phy.value) + PegasusUtility.getDiceValue(this.system.statistics.mnd.value) + PegasusUtility.getDiceValue(this.system.statistics.foc.value)
|
||||||
+ this.system.statistics.mnd.mod + this.system.statistics.phy.mod + this.system.statistics.foc.mod
|
+ this.system.statistics.mnd.mod + this.system.statistics.phy.mod + this.system.statistics.foc.mod
|
||||||
if (stunth != this.system.combat.stunthreshold) {
|
if (stunth != this.system.combat.stunthreshold) {
|
||||||
updates['data.combat.stunthreshold'] = stunth
|
updates['system.combat.stunthreshold'] = stunth
|
||||||
}
|
}
|
||||||
|
|
||||||
let momentum = this.system.statistics.foc.value + this.system.statistics.foc.mod
|
let momentum = this.system.statistics.foc.value + this.system.statistics.foc.mod
|
||||||
if (momentum != this.system.momentum.max) {
|
if (momentum != this.system.momentum.max) {
|
||||||
updates['data.momentum.value'] = 0
|
updates['system.momentum.value'] = 0
|
||||||
updates['data.momentum.max'] = momentum
|
updates['system.momentum.max'] = momentum
|
||||||
}
|
}
|
||||||
|
|
||||||
let mrLevel = (this.system.statistics.agi.value + this.system.statistics.str.value) - this.system.statistics.phy.value
|
let mrLevel = (this.system.statistics.agi.value + this.system.statistics.str.value) - this.system.statistics.phy.value
|
||||||
mrLevel = (mrLevel < 1) ? 1 : mrLevel;
|
mrLevel = (mrLevel < 1) ? 1 : mrLevel;
|
||||||
if (mrLevel != this.system.mr.value) {
|
if (mrLevel != this.system.mr.value) {
|
||||||
updates['data.mr.value'] = mrLevel
|
updates['system.mr.value'] = mrLevel
|
||||||
}
|
}
|
||||||
|
|
||||||
let moralitythreshold = - (Number(PegasusUtility.getDiceValue(this.system.statistics.foc.value)) + Number(this.system.statistics.foc.mod))
|
let moralitythreshold = - (Number(PegasusUtility.getDiceValue(this.system.statistics.foc.value)) + Number(this.system.statistics.foc.mod))
|
||||||
if (moralitythreshold != this.system.biodata.moralitythreshold) {
|
if (moralitythreshold != this.system.biodata.moralitythreshold) {
|
||||||
updates['data.biodata.moralitythreshold'] = moralitythreshold
|
updates['system.biodata.moralitythreshold'] = moralitythreshold
|
||||||
}
|
}
|
||||||
if (!this.isToken) {
|
if (!this.isToken) {
|
||||||
if (this.warnMorality != this.system.biodata.morality && this.system.biodata.morality < 0) {
|
if (this.warnMorality != this.system.biodata.morality && this.system.biodata.morality < 0) {
|
||||||
@ -1246,11 +1278,11 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
let race = this.getRace()
|
let race = this.getRace()
|
||||||
if (race && race.name && (race.name != this.system.biodata.racename)) {
|
if (race && race.name && (race.name != this.system.biodata.racename)) {
|
||||||
updates['data.biodata.racename'] = race.name
|
updates['system.biodata.racename'] = race.name
|
||||||
}
|
}
|
||||||
let role = this.getRole()
|
let role = this.getRole()
|
||||||
if (role && role.name && (role.name != this.system.biodata.rolename)) {
|
if (role && role.name && (role.name != this.system.biodata.rolename)) {
|
||||||
updates['data.biodata.rolename'] = role.name
|
updates['system.biodata.rolename'] = role.name
|
||||||
}
|
}
|
||||||
if (Object.entries(updates).length > 0) {
|
if (Object.entries(updates).length > 0) {
|
||||||
await this.update(updates)
|
await this.update(updates)
|
||||||
@ -1312,7 +1344,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (objetQ) {
|
if (objetQ) {
|
||||||
let newQ = objetQ.system.quantity + incDec
|
let newQ = objetQ.system.quantity + incDec
|
||||||
if (newQ >= 0) {
|
if (newQ >= 0) {
|
||||||
const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'data.quantity': newQ }]) // pdates one EmbeddedEntity
|
const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'system.quantity': newQ }]) // pdates one EmbeddedEntity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1322,7 +1354,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (objetQ) {
|
if (objetQ) {
|
||||||
let newQ = objetQ.system.ammocurrent + incDec;
|
let newQ = objetQ.system.ammocurrent + incDec;
|
||||||
if (newQ >= 0 && newQ <= objetQ.system.ammomax) {
|
if (newQ >= 0 && newQ <= objetQ.system.ammomax) {
|
||||||
const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'data.ammocurrent': newQ }]); // pdates one EmbeddedEntity
|
const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'system.ammocurrent': newQ }]); // pdates one EmbeddedEntity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1388,11 +1420,12 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async applyRace(race) {
|
async applyRace(race) {
|
||||||
let updates = { 'data.biodata.racename': race.name }
|
let updates = { 'system.biodata.racename': race.name }
|
||||||
let newItems = []
|
let newItems = []
|
||||||
await this.deleteAllItemsByType('race')
|
await this.deleteAllItemsByType('race')
|
||||||
newItems.push(race);
|
newItems.push(race);
|
||||||
|
|
||||||
|
console.log("DROPPED RACE", race)
|
||||||
for (let ability of race.system.abilities) {
|
for (let ability of race.system.abilities) {
|
||||||
newItems.push(ability)
|
newItems.push(ability)
|
||||||
this.applyAbility(ability, updates)
|
this.applyAbility(ability, updates)
|
||||||
@ -1420,7 +1453,7 @@ export class PegasusActor extends Actor {
|
|||||||
async applyRole(role) {
|
async applyRole(role) {
|
||||||
console.log("ROLE", role)
|
console.log("ROLE", role)
|
||||||
|
|
||||||
let updates = { 'data.biodata.rolename': role.name }
|
let updates = { 'system.biodata.rolename': role.name }
|
||||||
let newItems = []
|
let newItems = []
|
||||||
await this.deleteAllItemsByType('role')
|
await this.deleteAllItemsByType('role')
|
||||||
newItems.push(role)
|
newItems.push(role)
|
||||||
@ -1441,8 +1474,9 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
addHindrancesList(effectsList) {
|
addHindrancesList(effectsList) {
|
||||||
|
if (this.type == "character") {
|
||||||
if (this.system.combat.stunlevel > 0) {
|
if (this.system.combat.stunlevel > 0) {
|
||||||
effectsList.push({ label: "Stun Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: this.system.combat.stunlevel })
|
effectsList.push({ label: "Stun Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 2 })
|
||||||
}
|
}
|
||||||
if (this.system.combat.hindrancedice > 0) {
|
if (this.system.combat.hindrancedice > 0) {
|
||||||
effectsList.push({ label: "Wounds Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: this.system.combat.hindrancedice })
|
effectsList.push({ label: "Wounds Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: this.system.combat.hindrancedice })
|
||||||
@ -1462,11 +1496,31 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.type == "vehicle") {
|
||||||
|
if (this.system.stun.value > 0) {
|
||||||
|
effectsList.push({ label: "Stun Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 2 })
|
||||||
|
}
|
||||||
|
if (this.isVehicleCrawling()) {
|
||||||
|
effectsList.push({ label: "Crawling Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 3 })
|
||||||
|
}
|
||||||
|
if (this.isVehicleSlow()) {
|
||||||
|
effectsList.push({ label: "Slow Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 1 })
|
||||||
|
}
|
||||||
|
if (this.isVehicleAverage()) {
|
||||||
|
effectsList.push({ label: "Average Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 1 })
|
||||||
|
}
|
||||||
|
if (this.isVehicleFast()) {
|
||||||
|
effectsList.push({ label: "Fast Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 3 })
|
||||||
|
}
|
||||||
|
if (this.isVehicleExFast()) {
|
||||||
|
effectsList.push({ label: "Ext. Fast Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 5 })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* ROLL SECTION
|
/* ROLL SECTION
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
pushEffect(rollData, effect) {
|
pushEffect(rollData, effect) {
|
||||||
if (this.getTraumaState() == "none" && !this.checkNoBonusDice()) {
|
if (this.getTraumaState() == "none" && !this.checkNoBonusDice()) {
|
||||||
rollData.effectsList.push({ label: effect.name, type: "effect", applied: false, effect: effect, value: effect.system.effectlevel })
|
rollData.effectsList.push({ label: effect.name, type: "effect", applied: false, effect: effect, value: effect.system.effectlevel })
|
||||||
@ -1579,22 +1633,30 @@ export class PegasusActor extends Actor {
|
|||||||
if (vehicle) {
|
if (vehicle) {
|
||||||
rollData.vehicle = duplicate(vehicle)
|
rollData.vehicle = duplicate(vehicle)
|
||||||
if (subKey == "melee-dmg") {
|
if (subKey == "melee-dmg") {
|
||||||
|
if (vehicle.isVehicleFullStop()) {
|
||||||
|
ui.notifications.warn("MR not added to Melee Damage due to Full Stop.")
|
||||||
|
} else {
|
||||||
rollData.statVehicle = vehicle.system.statistics.mr
|
rollData.statVehicle = vehicle.system.statistics.mr
|
||||||
rollData.statDicesLevel += vehicle.system.statistics.mr.currentlevel
|
}
|
||||||
this.addVehicleWeapons(rollData, vehicle)
|
this.addVehicleWeapons(rollData, vehicle)
|
||||||
}
|
}
|
||||||
if (subKey == "ranged-atk") {
|
if (subKey == "ranged-atk") {
|
||||||
rollData.statVehicle = vehicle.system.statistics.fc
|
rollData.statVehicle = vehicle.system.statistics.fc
|
||||||
rollData.statDicesLevel += vehicle.system.statistics.fc.currentlevel
|
|
||||||
}
|
}
|
||||||
if (subKey == "ranged-dmg") {
|
if (subKey == "ranged-dmg") {
|
||||||
this.addVehicleWeapons(rollData, vehicle)
|
this.addVehicleWeapons(rollData, vehicle)
|
||||||
}
|
}
|
||||||
if (subKey == "defense") {
|
if (subKey == "defense") {
|
||||||
|
if (vehicle.isVehicleFullStop()) {
|
||||||
|
ui.notifications.warn("MAN not added to Defense due to Full Stop.")
|
||||||
|
} else {
|
||||||
rollData.statVehicle = vehicle.system.statistics.man
|
rollData.statVehicle = vehicle.system.statistics.man
|
||||||
rollData.statDicesLevel += vehicle.system.statistics.man.currentlevel
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//this.addVehiculeHindrances(rollData.effectsList, vehicle)
|
||||||
|
//this.addVehicleBonus(rollData, vehicle)
|
||||||
|
}
|
||||||
|
|
||||||
rollData.specList = this.getRelevantSpec(statKey)
|
rollData.specList = this.getRelevantSpec(statKey)
|
||||||
rollData.selectedSpec = "0"
|
rollData.selectedSpec = "0"
|
||||||
if (statKey.toLowerCase() == "mr") {
|
if (statKey.toLowerCase() == "mr") {
|
||||||
@ -1602,17 +1664,9 @@ export class PegasusActor extends Actor {
|
|||||||
} else {
|
} else {
|
||||||
rollData.img = `systems/fvtt-pegasus-rpg/images/icons/${rollData.stat.abbrev}.webp`
|
rollData.img = `systems/fvtt-pegasus-rpg/images/icons/${rollData.stat.abbrev}.webp`
|
||||||
}
|
}
|
||||||
let diceKey = PegasusUtility.getDiceFromLevel(rollData.statDicesLevel)
|
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("stat", rollData.statDicesLevel, rollData.stat.mod))
|
||||||
let diceList = diceKey.split(" ")
|
if (rollData.statVehicle) {
|
||||||
let mod = rollData.stat.mod
|
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("statvehicle", rollData.statVehicle.currentlevel, 0))
|
||||||
for (let myDice of diceList) {
|
|
||||||
myDice = myDice.trim()
|
|
||||||
let newDice = {
|
|
||||||
name: "stat", key: myDice, level: PegasusUtility.getLevelFromDice(myDice), mod: mod,
|
|
||||||
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
|
||||||
}
|
|
||||||
rollData.dicePool.push(newDice)
|
|
||||||
mod = 0 // Only first dice has modifier
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1829,6 +1883,25 @@ export class PegasusActor extends Actor {
|
|||||||
return __num2speed[num]
|
return __num2speed[num]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
manageVehicleSpeedBonus(speed, name, stat, level) {
|
||||||
|
if (this.system.statistics.ad.currentspeed == speed) {
|
||||||
|
if (!this.items.find(effect => effect.system.isspeed == speed)) {
|
||||||
|
let effect = duplicate(__bonusEffect)
|
||||||
|
effect.name = name
|
||||||
|
effect.system.stataffected = stat
|
||||||
|
effect.system.effectlevel = level
|
||||||
|
effect.system.isspeed = speed
|
||||||
|
this.createEmbeddedDocuments("Item", [effect])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let effect = this.items.find(effect => effect.system.isspeed == speed)
|
||||||
|
if (effect) {
|
||||||
|
this.deleteEmbeddedDocuments("Item", [effect.id])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async computeVehicleStats() {
|
async computeVehicleStats() {
|
||||||
|
|
||||||
@ -1915,6 +1988,12 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Speed effect management
|
||||||
|
this.manageVehicleSpeedBonus("crawling", "Crawling MAN Bonus", "man", 3)
|
||||||
|
this.manageVehicleSpeedBonus("slow", "Slow MAN Bonus", "man", 1)
|
||||||
|
this.manageVehicleSpeedBonus("average", "Avoid attack Bonus", "all", 1)
|
||||||
|
this.manageVehicleSpeedBonus("fast", "Avoid attack Bonus", "all", 3)
|
||||||
|
this.manageVehicleSpeedBonus("extfast", "Avoid attack Bonus", "all", 5)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1988,20 +2067,77 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
rollPoolFromVehicle(statKey, useShield = false, subKey = "none") {
|
isVehicleFullStop() {
|
||||||
|
return this.system.statistics.ad.currentspeed == "fullstop"
|
||||||
|
}
|
||||||
|
isVehicleCrawling() {
|
||||||
|
return this.system.statistics.ad.currentspeed == "crawling"
|
||||||
|
}
|
||||||
|
isVehicleSlow() {
|
||||||
|
return this.system.statistics.ad.currentspeed == "slow"
|
||||||
|
}
|
||||||
|
isVehicleAverage() {
|
||||||
|
return this.system.statistics.ad.currentspeed == "average"
|
||||||
|
}
|
||||||
|
isVehicleFast() {
|
||||||
|
return this.system.statistics.ad.currentspeed == "fast"
|
||||||
|
}
|
||||||
|
isVehicleExFast() {
|
||||||
|
return this.system.statistics.ad.currentspeed == "extfast"
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
isValidActor() {
|
||||||
// Find relevant actor
|
// Find relevant actor
|
||||||
let actor
|
let actor
|
||||||
for (let actorDef of this.system.crew) {
|
for (let actorDef of this.system.crew) {
|
||||||
let actorTest = game.actors.get(actorDef.id)
|
let actorTest = game.actors.get(actorDef.id)
|
||||||
if (actorTest.testUserPermission(game.user, "OWNER")) {
|
if (actorTest.testUserPermission(game.user, "OWNER")) {
|
||||||
actor = actorTest
|
return actorTest
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!actor) {
|
if (!actor) {
|
||||||
ui.notifications.warn("You do no own any actors in the crew of this vehicle.")
|
ui.notifications.warn("You do no own any actors in the crew of this vehicle.")
|
||||||
return
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
rollPoolFromVehicle(statKey, useShield = false, subKey = "none") {
|
||||||
|
let actor = this.isValidActor()
|
||||||
|
if (actor) {
|
||||||
actor.rollPool(statKey, useShield, subKey, this)
|
actor.rollPool(statKey, useShield, subKey, this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
addVehicleShields(rollData) {
|
||||||
|
let shields = this.items.filter( shield => shield.type == "vehiclemodule" && shield.system.activated && shield.system.shielddicevalue > 0) || []
|
||||||
|
for (let shield of shields) {
|
||||||
|
rollData.vehicleShieldList.push({ label: `${shield.name} (${shield.system.arccoverage})`, type: "vehicleshield", applied: false, value: shield.system.shielddicevalue })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
rollVehicleDamageResistance() {
|
||||||
|
let actor = this.isValidActor()
|
||||||
|
if (actor) {
|
||||||
|
let stat = this.getStat("hr")
|
||||||
|
let rollData = this.getCommonRollData("hr")
|
||||||
|
rollData.mode = "stat"
|
||||||
|
rollData.title = `Stat ${stat.label}`;
|
||||||
|
|
||||||
|
this.addVehicleShields(rollData)
|
||||||
|
this.startRoll(rollData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
activateVehicleModule(itemId) {
|
||||||
|
let mod = this.items.get(itemId)
|
||||||
|
if (mod) {
|
||||||
|
this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -133,6 +133,21 @@ export class PegasusRollDialog extends Dialog {
|
|||||||
PegasusUtility.updateDamageDicePool(this.rollData)
|
PegasusUtility.updateDamageDicePool(this.rollData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
manageVehicleShield( shieldIdx, toggled) {
|
||||||
|
let shield = this.rollData.vehicleShieldList[shieldIdx]
|
||||||
|
if (shield) {
|
||||||
|
this.rollData.shield = duplicate(shield)
|
||||||
|
if (toggled) {
|
||||||
|
this.rollData.shieldName = shield.name
|
||||||
|
} else {
|
||||||
|
this.rollData.shieldName = undefined
|
||||||
|
}
|
||||||
|
shield.applied = toggled
|
||||||
|
}
|
||||||
|
PegasusUtility.updateArmorDicePool(this.rollData)
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
manageEquip(equipIdx, toggled) {
|
manageEquip(equipIdx, toggled) {
|
||||||
let equip = this.rollData.equipmentsList[equipIdx]
|
let equip = this.rollData.equipmentsList[equipIdx]
|
||||||
@ -237,6 +252,13 @@ export class PegasusRollDialog extends Dialog {
|
|||||||
this.manageVehicleWeapon(weaponIdx, toggled)
|
this.manageVehicleWeapon(weaponIdx, toggled)
|
||||||
this.refreshDialog()
|
this.refreshDialog()
|
||||||
})
|
})
|
||||||
|
html.find('.vehicle-shield-clicked').change((event) => {
|
||||||
|
let toggled = event.currentTarget.checked
|
||||||
|
let shieldIdx = $(event.currentTarget).data("vehicle-shield-idx")
|
||||||
|
this.manageVehicleShield(shieldIdx, toggled)
|
||||||
|
this.refreshDialog()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
html.find('.pool-add-dice').click(async (event) => {
|
html.find('.pool-add-dice').click(async (event) => {
|
||||||
let diceKey = $(event.currentTarget).data("dice-key")
|
let diceKey = $(event.currentTarget).data("dice-key")
|
||||||
|
@ -105,20 +105,29 @@ export class PegasusUtility {
|
|||||||
{ key: "d12", level: 5, img: "systems/fvtt-pegasus-rpg/images/dice/d12.webp" }]
|
{ key: "d12", level: 5, img: "systems/fvtt-pegasus-rpg/images/dice/d12.webp" }]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static buildDicePool(name, level, mod = 0, effectName = undefined) {
|
||||||
|
let dicePool = []
|
||||||
|
let diceKey = PegasusUtility.getDiceFromLevel(level)
|
||||||
|
let diceList = diceKey.split(" ")
|
||||||
|
for (let myDice of diceList) {
|
||||||
|
myDice = myDice.trim()
|
||||||
|
let newDice = {
|
||||||
|
name: name, key: myDice, level: PegasusUtility.getLevelFromDice(myDice), mod: mod, effect: effectName,
|
||||||
|
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
||||||
|
}
|
||||||
|
dicePool.push(newDice)
|
||||||
|
mod = 0 // Only first dice has modifier
|
||||||
|
}
|
||||||
|
return dicePool
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
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.system.bonusdice) {
|
if (effect && effect.applied && effect.type == "effect" && effect.effect.system.bonusdice) {
|
||||||
let diceKey = PegasusUtility.getDiceFromLevel(effect.effect.system.effectlevel)
|
newDicePool = newDicePool.concat( this.buildDicePool("effect-bonus-dice", effect.effect.system.effectlevel, 0, effect.effect.name ))
|
||||||
let diceList = diceKey.split(" ")
|
|
||||||
for (let myDice of diceList) {
|
|
||||||
let newDice = {
|
|
||||||
name: "effect-bonus-dice", key: myDice, level: PegasusUtility.getLevelFromDice(myDice), effect: effect.effect.name,
|
|
||||||
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
|
||||||
}
|
|
||||||
newDicePool.push(newDice)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rollData.dicePool = newDicePool
|
rollData.dicePool = newDicePool
|
||||||
@ -129,15 +138,7 @@ 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))) {
|
||||||
let diceKey = PegasusUtility.getDiceFromLevel((hindrance.value) ? hindrance.value : hindrance.effect.system.effectlevel)
|
newDicePool = newDicePool.concat( this.buildDicePool("effect-hindrance", (hindrance.value) ? hindrance.value : hindrance.effect.system.effectlevel, 0, hindrance.name ))
|
||||||
let diceList = diceKey.split(" ")
|
|
||||||
for (let myDice of diceList) {
|
|
||||||
let newDice = {
|
|
||||||
name: "effect-hindrance", key: myDice, level: PegasusUtility.getLevelFromDice(myDice), effect: hindrance.name,
|
|
||||||
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
|
||||||
}
|
|
||||||
newDicePool.push(newDice)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rollData.dicePool = newDicePool
|
rollData.dicePool = newDicePool
|
||||||
@ -148,15 +149,13 @@ export class PegasusUtility {
|
|||||||
let newDicePool = rollData.dicePool.filter(dice => dice.name != "armor-shield")
|
let newDicePool = rollData.dicePool.filter(dice => dice.name != "armor-shield")
|
||||||
for (let armor of rollData.armorsList) {
|
for (let armor of rollData.armorsList) {
|
||||||
if (armor.applied) {
|
if (armor.applied) {
|
||||||
let diceKey = PegasusUtility.getDiceFromLevel(armor.value)
|
newDicePool = newDicePool.concat( this.buildDicePool("armor-shield", armor.value, 0))
|
||||||
let diceList = diceKey.split(" ")
|
|
||||||
for (let myDice of diceList) {
|
|
||||||
let newDice = {
|
|
||||||
name: "armor-shield", key: myDice, level: PegasusUtility.getLevelFromDice(myDice),
|
|
||||||
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
|
||||||
}
|
}
|
||||||
newDicePool.push(newDice)
|
|
||||||
}
|
}
|
||||||
|
newDicePool = rollData.dicePool.filter(dice => dice.name != "vehicle-shield")
|
||||||
|
for (let shield of rollData.vehicleShieldList) {
|
||||||
|
if (shield.applied) {
|
||||||
|
newDicePool = newDicePool.concat( this.buildDicePool("vehicle-shield", shield.value, 0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rollData.dicePool = newDicePool
|
rollData.dicePool = newDicePool
|
||||||
@ -169,29 +168,13 @@ export class PegasusUtility {
|
|||||||
let newDicePool = rollData.dicePool.filter(dice => dice.name != "damage")
|
let newDicePool = rollData.dicePool.filter(dice => dice.name != "damage")
|
||||||
for (let weapon of rollData.weaponsList) {
|
for (let weapon of rollData.weaponsList) {
|
||||||
if (weapon.applied && weapon.type == "damage") {
|
if (weapon.applied && weapon.type == "damage") {
|
||||||
let diceKey = PegasusUtility.getDiceFromLevel(weapon.value)
|
newDicePool = newDicePool.concat( this.buildDicePool("damage", weapon.value, 0))
|
||||||
let diceList = diceKey.split(" ")
|
|
||||||
for (let myDice of diceList) {
|
|
||||||
let newDice = {
|
|
||||||
name: "damage", key: myDice, level: PegasusUtility.getLevelFromDice(myDice),
|
|
||||||
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
|
||||||
}
|
|
||||||
newDicePool.push(newDice)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let weapon of rollData.vehicleWeapons) {
|
for (let weapon of rollData.vehicleWeapons) {
|
||||||
if (weapon.applied) {
|
if (weapon.applied) {
|
||||||
let diceKey = PegasusUtility.getDiceFromLevel(weapon.value)
|
newDicePool = newDicePool.concat( this.buildDicePool("damage", weapon.value, 0))
|
||||||
let diceList = diceKey.split(" ")
|
|
||||||
for (let myDice of diceList) {
|
|
||||||
let newDice = {
|
|
||||||
name: "damage", key: myDice, level: PegasusUtility.getLevelFromDice(myDice),
|
|
||||||
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
|
||||||
}
|
|
||||||
newDicePool.push(newDice)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rollData.dicePool = newDicePool
|
rollData.dicePool = newDicePool
|
||||||
@ -203,36 +186,23 @@ export class PegasusUtility {
|
|||||||
let newDicePool = rollData.dicePool.filter(dice => dice.name != "stat")
|
let newDicePool = rollData.dicePool.filter(dice => dice.name != "stat")
|
||||||
let statDice = rollData.dicePool.find(dice => dice.name == "stat")
|
let statDice = rollData.dicePool.find(dice => dice.name == "stat")
|
||||||
if (statDice.level > 0) {
|
if (statDice.level > 0) {
|
||||||
let diceKey = PegasusUtility.getDiceFromLevel(rollData.statDicesLevel)
|
newDicePool = newDicePool.concat( this.buildDicePool( "stat", rollData.statDicesLevel, statDice.mod))
|
||||||
let diceList = diceKey.split(" ")
|
|
||||||
let mod = statDice.mod
|
|
||||||
for (let myDice of diceList) {
|
|
||||||
myDice = myDice.trim()
|
|
||||||
let newDice = {
|
|
||||||
name: "stat", key: myDice, level: PegasusUtility.getLevelFromDice(myDice), mod: mod,
|
|
||||||
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
|
||||||
}
|
|
||||||
mod = 0 // Only first dice has modifier
|
|
||||||
newDicePool.push(newDice)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rollData.vehicleStat) {
|
||||||
|
newDicePool = rollData.dicePool.filter(dice => dice.name != "vehiclestat")
|
||||||
|
if (rollData.vehicleStat.currentlevel > 0 ) {
|
||||||
|
newDicePool = newDicePool.concat( this.buildDicePool( "vehiclestat", rollData.vehicleStat.currentlevel, 0))
|
||||||
}
|
}
|
||||||
rollData.dicePool = newDicePool
|
rollData.dicePool = newDicePool
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static updateSpecDicePool(rollData) {
|
static updateSpecDicePool(rollData) {
|
||||||
let newDicePool = rollData.dicePool.filter(dice => dice.name != "spec")
|
let newDicePool = rollData.dicePool.filter(dice => dice.name != "spec")
|
||||||
if (rollData.specDicesLevel > 0) {
|
if (rollData.specDicesLevel > 0) {
|
||||||
let diceKey = PegasusUtility.getDiceFromLevel(rollData.specDicesLevel)
|
newDicePool = newDicePool.concat( this.buildDicePool( "spec", rollData.specDicesLevel, 0))
|
||||||
let diceList = diceKey.split(" ")
|
|
||||||
for (let myDice of diceList) {
|
|
||||||
myDice = myDice.trim()
|
|
||||||
let newDice = {
|
|
||||||
name: "spec", key: myDice, level: PegasusUtility.getLevelFromDice(myDice),
|
|
||||||
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
|
||||||
}
|
|
||||||
newDicePool.push(newDice)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
rollData.dicePool = newDicePool
|
rollData.dicePool = newDicePool
|
||||||
}
|
}
|
||||||
@ -920,7 +890,11 @@ export class PegasusUtility {
|
|||||||
static async searchItem(dataItem) {
|
static async searchItem(dataItem) {
|
||||||
let item
|
let item
|
||||||
if (dataItem.pack) {
|
if (dataItem.pack) {
|
||||||
item = await fromUuid("Compendium." + dataItem.pack + "." + dataItem.id)
|
let id = dataItem.id || dataItem._id
|
||||||
|
let items = await this.loadCompendium( dataItem.pack, item => item.id == id)
|
||||||
|
//console.log(">>>>>> PACK", items)
|
||||||
|
item = items[0] || undefined
|
||||||
|
//item = await fromUuid(dataItem.pack + "." + id)
|
||||||
} else {
|
} else {
|
||||||
item = game.items.get(dataItem.id)
|
item = game.items.get(dataItem.id)
|
||||||
}
|
}
|
||||||
@ -985,6 +959,7 @@ export class PegasusUtility {
|
|||||||
weaponsList: [],
|
weaponsList: [],
|
||||||
vehicleWeapons: [],
|
vehicleWeapons: [],
|
||||||
equipmentsList: [],
|
equipmentsList: [],
|
||||||
|
vehicleShieldList: [],
|
||||||
optionsDiceList: PegasusUtility.getOptionsDiceList()
|
optionsDiceList: PegasusUtility.getOptionsDiceList()
|
||||||
}
|
}
|
||||||
if (!isInit) { // For init, do not display target hindrances
|
if (!isInit) { // For init, do not display target hindrances
|
||||||
|
@ -120,6 +120,17 @@ export class PegasusVehicleSheet extends ActorSheet {
|
|||||||
html.find('.current-speed-change').click(ev => {
|
html.find('.current-speed-change').click(ev => {
|
||||||
let speed = ev.currentTarget.value
|
let speed = ev.currentTarget.value
|
||||||
this.actor.manageCurrentSpeed(speed)
|
this.actor.manageCurrentSpeed(speed)
|
||||||
|
})
|
||||||
|
|
||||||
|
html.find('.vehicle-module-activate').click(ev => {
|
||||||
|
const li = $(ev.currentTarget).parents(".item")
|
||||||
|
let itemId = li.data("item-id")
|
||||||
|
this.actor.activateVehicleModule( itemId)
|
||||||
|
});
|
||||||
|
html.find('.vehicle-weapon-activate').click(ev => {
|
||||||
|
const li = $(ev.currentTarget).parents(".item")
|
||||||
|
let itemId = li.data("item-id")
|
||||||
|
this.actor.activateVehicleModule( itemId)
|
||||||
});
|
});
|
||||||
|
|
||||||
html.find('.equip-activate').click(ev => {
|
html.find('.equip-activate').click(ev => {
|
||||||
@ -204,7 +215,7 @@ export class PegasusVehicleSheet extends ActorSheet {
|
|||||||
this.actor.rollPoolFromVehicle( 'per', false, "ranged-dmg");
|
this.actor.rollPoolFromVehicle( 'per', false, "ranged-dmg");
|
||||||
});
|
});
|
||||||
html.find('.defense-roll').click((event) => {
|
html.find('.defense-roll').click((event) => {
|
||||||
this.actor.rollPoolFromVehicle( 'def', true, "defense");
|
this.actor.rollPoolFromVehicle( 'def', true, "defence");
|
||||||
});
|
});
|
||||||
html.find('.damage-resistance').click((event) => {
|
html.find('.damage-resistance').click((event) => {
|
||||||
this.actor.rollVehicleDamageResistance( );
|
this.actor.rollVehicleDamageResistance( );
|
||||||
|
@ -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.0.12",
|
"version": "10.0.14",
|
||||||
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.12.zip",
|
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.14.zip",
|
||||||
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
||||||
}
|
}
|
@ -689,12 +689,15 @@
|
|||||||
"effects": [],
|
"effects": [],
|
||||||
"damagedicevalue": "",
|
"damagedicevalue": "",
|
||||||
"damagetype": "",
|
"damagetype": "",
|
||||||
|
"damagetypelevel": 0,
|
||||||
"aoe": "",
|
"aoe": "",
|
||||||
"range": "",
|
"range": "",
|
||||||
"turret": "",
|
"turret": "",
|
||||||
"linkedweapon": "",
|
"linkedweapon": "",
|
||||||
"idr": "",
|
"idr": "",
|
||||||
"cost": 0
|
"cost": 0,
|
||||||
|
"extradamage": false,
|
||||||
|
"extradamagevalue": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -839,9 +839,8 @@
|
|||||||
<div>
|
<div>
|
||||||
<ul class="item-list alternate-list">
|
<ul class="item-list alternate-list">
|
||||||
<li class="item flexrow">
|
<li class="item flexrow">
|
||||||
<label class="generic-label">Origin</label>
|
<label class="generic-label">Sex</label>
|
||||||
<input type="text" class="" name="system.biodata.origin" value="{{data.biodata.origin}}"
|
<input type="text" class="" name="system.biodata.sex" value="{{data.biodata.sex}}" data-dtype="String" />
|
||||||
data-dtype="String" />
|
|
||||||
</li>
|
</li>
|
||||||
<li class="item flexrow">
|
<li class="item flexrow">
|
||||||
<label class="generic-label">Age</label>
|
<label class="generic-label">Age</label>
|
||||||
@ -869,8 +868,9 @@
|
|||||||
data-dtype="Number" />
|
data-dtype="Number" />
|
||||||
</li>
|
</li>
|
||||||
<li class="flexrow item">
|
<li class="flexrow item">
|
||||||
<label class="generic-label">Sex</label>
|
<label class="generic-label">Origin</label>
|
||||||
<input type="text" class="" name="system.biodata.sex" value="{{data.biodata.sex}}" data-dtype="String" />
|
<input type="text" class="" name="system.biodata.origin" value="{{data.biodata.origin}}"
|
||||||
|
data-dtype="String" />
|
||||||
</li>
|
</li>
|
||||||
<li class="flexrow item">
|
<li class="flexrow item">
|
||||||
<label class="generic-label">Preferred Hand</label>
|
<label class="generic-label">Preferred Hand</label>
|
||||||
|
@ -67,6 +67,20 @@
|
|||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="flexrow"><label class="generic-label">Damage type level</label>
|
||||||
|
<input type="text" class="" name="system.damagetypelevel" value="{{data.damagetypelevel}}" data-dtype="Number"/>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="flexrow"><label class="generic-label">Extra damage ?</label>
|
||||||
|
<label class="attribute-value checkbox"><input type="checkbox" name="system.extradamage" {{checked data.extradamage}}/></label>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{{#if data.extradamage}}
|
||||||
|
<li class="flexrow"><label class="generic-label">Extra damage value (D12)</label>
|
||||||
|
<input type="text" class="" name="system.extradamagevalue" value="{{data.extradamagevalue}}" data-dtype="Number"/>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<li class="flexrow"><label class="generic-label">Optimal Range</label>
|
<li class="flexrow"><label class="generic-label">Optimal Range</label>
|
||||||
<select class="competence-base flexrow" type="text" name="system.range" value="{{data.range}}" data-dtype="String">
|
<select class="competence-base flexrow" type="text" name="system.range" value="{{data.range}}" data-dtype="String">
|
||||||
{{#select data.range}}
|
{{#select data.range}}
|
||||||
|
@ -139,3 +139,19 @@
|
|||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (notEmpty vehicleShieldList)}}
|
||||||
|
<label>Vehicle Shields</label>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
{{#each vehicleShieldList as |shield idx|}}
|
||||||
|
<li class="flex-group-left">
|
||||||
|
<label class="attribute-value checkbox"><input type="checkbox" class="vehicle-shield-clicked" id="vehicle-shield-{{idx}}" data-vehicle-shield-idx="{{idx}}" {{checked shield.applied}}/></label>
|
||||||
|
<label class="generic-label padd-right">{{shield.label}} ({{shield.value}})</label>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
<span class="roll-dialog-label">Stat ({{stat.label}} {{#if statVehicle}}+{{statVehicle.label}}{{/if}}) : </span>
|
<span class="roll-dialog-label">{{upper stat.label}} :</span>
|
||||||
<select class="roll-dialog-label" id="statDicesLevel" type="text" name="statDicesLevel"
|
<select class="roll-dialog-label" id="statDicesLevel" type="text" name="statDicesLevel"
|
||||||
value="{{statDicesLevel}}" data-dtype="Number" {{#if statKey}}disabled{{/if}}>
|
value="{{statDicesLevel}}" data-dtype="Number" {{#if statKey}}disabled{{/if}}>
|
||||||
{{#select statDicesLevel}}
|
{{#select statDicesLevel}}
|
||||||
@ -24,6 +24,19 @@
|
|||||||
<span class="small-label"> + {{statMod}}</span>
|
<span class="small-label"> + {{statMod}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if statVehicle}}
|
||||||
|
<div class="flexrow">
|
||||||
|
<span class="roll-dialog-label">{{upper statVehicle.label}} :</span>
|
||||||
|
<select class="roll-dialog-label" id="statVehicleLevel" type="text" name="statVehicleLevel"
|
||||||
|
value="{{statVehicle.currentlevel}}" data-dtype="Number" {{#if statKey}}disabled{{/if}}>
|
||||||
|
{{#select statVehicle.currentlevel}}
|
||||||
|
{{{optionsDiceList}}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
<span class="small-label"> </span>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if specList}}
|
{{#if specList}}
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
<span class="roll-dialog-label">Spec : </span>
|
<span class="roll-dialog-label">Spec : </span>
|
||||||
|
@ -491,6 +491,8 @@
|
|||||||
<span class="item-field-label-short">{{vehiclemod.system.idr}}</span>
|
<span class="item-field-label-short">{{vehiclemod.system.idr}}</span>
|
||||||
<div class="item-filler"> </div>
|
<div class="item-filler"> </div>
|
||||||
<div class="item-controls item-controls-fixed">
|
<div class="item-controls item-controls-fixed">
|
||||||
|
<a class="item-control vehicle-module-activate" title="Activated">{{#if vehiclemod.system.activated}}<i
|
||||||
|
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
|
||||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@ -538,6 +540,8 @@
|
|||||||
<span class="item-field-label-short">{{weapon.system.idr}}</span>
|
<span class="item-field-label-short">{{weapon.system.idr}}</span>
|
||||||
<div class="item-filler"> </div>
|
<div class="item-filler"> </div>
|
||||||
<div class="item-controls item-controls-fixed">
|
<div class="item-controls item-controls-fixed">
|
||||||
|
<a class="item-control vehicle-weapon-activate" title="Activated">{{#if weapon.system.activated}}<i
|
||||||
|
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
|
||||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user