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

View File

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

View File

@ -1,6 +1,6 @@
{ {
"description": "Pegasus RPG system for FoundryVTT", "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": [ "esmodules": [
"modules/pegasus-main.js" "modules/pegasus-main.js"
], ],
@ -281,6 +281,6 @@
"templateVersion": 112, "templateVersion": 112,
"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.3", "version": "10.0.4",
"background" : "./images/ui/pegasus_welcome_page.webp" "background" : "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
} }

View File

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