Vehicle - WIP

This commit is contained in:
sladecraven 2022-09-05 11:32:21 +02:00
parent fbb578c541
commit 1849a60194
4 changed files with 28 additions and 38 deletions

View File

@ -210,7 +210,8 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
async manageDesires(flag) {
if (flag) {
let effect = await PegasusUtility.getEffectFromCompendium("Desires")
let effect = await PegasusUtility.getEffectFromCompendium("Desire")
//console.log("EFFECT", effect)
effect.system.desires = true
this.createEmbeddedDocuments('Item', [effect])
} else {
@ -1265,24 +1266,24 @@ export class PegasusActor extends Actor {
if (ability.system.affectedstat != "notapplicable") {
let stat = duplicate(this.system.statistics[ability.system.affectedstat])
stat.mod += Number(ability.system.statmodifier)
updates[`data.statistics.${ability.system.affectedstat}`] = stat
updates[`system.statistics.${ability.system.affectedstat}`] = stat
}
// manage status bonus
if (ability.system.statusaffected != "notapplicable") {
if (ability.system.statusaffected == 'nrg') {
let nrg = duplicate(this.system.nrg)
nrg.mod += Number(ability.system.statusmodifier)
updates[`data.nrg`] = nrg
updates[`system.nrg`] = nrg
}
if (ability.system.statusaffected == 'health') {
let health = duplicate(this.system.secondary.health)
health.bonus += Number(ability.system.statusmodifier)
updates[`data.secondary.health`] = health
updates[`system.secondary.health`] = health
}
if (ability.system.statusaffected == 'delirium') {
let delirium = duplicate(this.system.secondary.delirium)
delirium.bonus += Number(ability.system.statusmodifier)
updates[`data.secondary.delirium`] = delirium
updates[`system.secondary.delirium`] = delirium
}
}
if (directUpdate) {

View File

@ -302,14 +302,16 @@ export class PegasusUtility {
/* -------------------------------------------- */
static async loadCompendiumData(compendium) {
const pack = game.packs.get(compendium);
return await pack?.getDocuments() ?? [];
const pack = game.packs.get(compendium)
console.log("PACK", pack, compendium)
return await pack?.getDocuments() ?? []
}
/* -------------------------------------------- */
static async loadCompendium(compendium, filter = item => true) {
let compendiumData = await PegasusUtility.loadCompendiumData(compendium);
return compendiumData.filter(filter);
let compendiumData = await PegasusUtility.loadCompendiumData(compendium)
//console.log("Comp data", compendiumData)
return compendiumData.filter(filter)
}
/* -------------------------------------------- */
@ -462,7 +464,7 @@ export class PegasusUtility {
effectName = effectName.toLowerCase()
let effect = game.items.contents.find(item => item.type == 'effect' && item.name.toLowerCase() == effectName)
if (!effect ) {
let effects = await this.loadCompendium('fvtt-pegasus.effect', item => item.name.toLowerCase() == effectName)
let effects = await this.loadCompendium('fvtt-pegasus-rpg.effects', item => item.name.toLowerCase() == effectName)
let objs = effects.map(i => i.toObject())
effect = objs[0]
} else {
@ -662,19 +664,6 @@ export class PegasusUtility {
return chatData;
}
/* -------------------------------------------- */
static async loadCompendiumData(compendium) {
const pack = game.packs.get(compendium);
return await pack?.getDocuments() ?? [];
}
/* -------------------------------------------- */
static async loadCompendium(compendium, filter = item => true) {
let compendiumData = await this.loadCompendiumData(compendium);
//console.log("Compendium", compendiumData);
return compendiumData.filter(filter);
}
/* -------------------------------------------- */
static async showDiceSoNice(roll, rollMode) {
if (game.modules.get("dice-so-nice")?.active) {

View File

@ -1,6 +1,6 @@
{
"description": "Pegasus RPG system for FoundryVTT",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.3.zip",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.4.zip",
"esmodules": [
"modules/pegasus-main.js"
],
@ -281,6 +281,6 @@
"templateVersion": 112,
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "10.0.3",
"background" : "./images/ui/pegasus_welcome_page.webp"
"version": "10.0.4",
"background" : "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
}

View File

@ -4,10 +4,10 @@
<ul>
{{#each effectsList as |effect idx|}}
{{#if effect.effect.data.hindrance}}
{{#if effect.effect.system.hindrance}}
<li class="flex-group-left">
<label class="attribute-value checkbox"><input type="checkbox" class="effect-clicked" id="effect-{{idx}}" data-effect-idx="{{idx}}" {{checked effect.applied}}/></label>
<label class="generic-label">Target Hindrance : {{effect.label}} ({{upperFirst effect.effect.data.type}}, {{upperFirst effect.effect.data.genre}}, {{effect.value}})</label>
<label class="generic-label">Target Hindrance : {{effect.label}} ({{upperFirst effect.effect.system.type}}, {{upperFirst effect.effect.system.genre}}, {{effect.value}})</label>
</li>
{{else}}
{{#if (eq type "hindrance")}}
@ -30,13 +30,13 @@
</li>
{{/if}}
{{#if (count effect.effect.data.specaffected)}}
{{#each effect.effect.data.specaffected as |spec idx2|}}
{{#if (count effect.effect.system.specaffected)}}
{{#each effect.effect.system.specaffected as |spec idx2|}}
{{#if (eq @root.specName spec.name)}}
<li class="flex-group-left">
<label class="attribute-value checkbox"><input type="checkbox" class="effect-clicked" id="effect-{{idx}}" data-effect-idx="{{idx}}" {{checked effect.applied}}/></label>
{{#if effect.effect}}
<label class="generic-label">{{effect.label}} ({{upperFirst effect.effect.data.type}}, {{upperFirst effect.effect.data.genre}}, {{effect.value}})</label>
<label class="generic-label">{{effect.label}} ({{upperFirst effect.effect.system.type}}, {{upperFirst effect.effect.system.genre}}, {{effect.value}})</label>
{{else}}
<label class="generic-label">{{effect.label}} ({{effect.value}})</label>
{{/if}}
@ -44,31 +44,31 @@
{{/if}}
{{/each}}
{{else}}
{{#if (eq @root.statKey effect.effect.data.stataffected)}}
{{#if (eq @root.statKey effect.effect.system.stataffected)}}
<li class="flex-group-left">
<label class="attribute-value checkbox"><input type="checkbox" class="effect-clicked" id="effect-{{idx}}" data-effect-idx="{{idx}}" {{checked effect.applied}}/></label>
{{#if effect.effect}}
<label class="generic-label">{{effect.label}} ({{upperFirst effect.effect.data.type}}, {{upperFirst effect.effect.data.genre}}, {{effect.value}})</label>
<label class="generic-label">{{effect.label}} ({{upperFirst effect.effect.system.type}}, {{upperFirst effect.effect.system.genre}}, {{effect.value}})</label>
{{else}}
<label class="generic-label">{{effect.label}} ({{effect.value}})</label>
{{/if}}
</li>
{{else}}
{{#if (eq @root.subKey effect.effect.data.stataffected)}}
{{#if (eq @root.subKey effect.effect.system.stataffected)}}
<li class="flex-group-left">
<label class="attribute-value checkbox"><input type="checkbox" class="effect-clicked" id="effect-{{idx}}" data-effect-idx="{{idx}}" {{checked effect.applied}}/></label>
{{#if effect.effect}}
<label class="generic-label">{{effect.label}} ({{upperFirst effect.effect.data.type}}, {{upperFirst effect.effect.data.genre}}, {{effect.value}})</label>
<label class="generic-label">{{effect.label}} ({{upperFirst effect.effect.system.type}}, {{upperFirst effect.effect.system.genre}}, {{effect.value}})</label>
{{else}}
<label class="generic-label">{{effect.label}} ({{effect.value}})</label>
{{/if}}
</li>
{{else}}
{{#if (eq effect.effect.data.stataffected "all")}}
{{#if (eq effect.effect.system.stataffected "all")}}
<li class="flex-group-left">
<label class="attribute-value checkbox"><input type="checkbox" class="effect-clicked" id="effect-{{idx}}" data-effect-idx="{{idx}}" {{checked effect.applied}}/></label>
{{#if effect.effect}}
<label class="generic-label">{{effect.label}} ({{upperFirst effect.effect.data.type}}, {{upperFirst effect.effect.data.genre}}, {{effect.value}})</label>
<label class="generic-label">{{effect.label}} ({{upperFirst effect.effect.system.type}}, {{upperFirst effect.effect.system.genre}}, {{effect.value}})</label>
{{else}}
<label class="generic-label">{{effect.label}} ({{effect.value}})</label>
{{/if}}