diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js index 2f1733c..6c8ab36 100644 --- a/modules/pegasus-actor.js +++ b/modules/pegasus-actor.js @@ -132,12 +132,12 @@ export class PegasusActor extends Actor { return comp; } /* -------------------------------------------- */ - getVehicleModules() { + getVehicleModules() { let comp = this.items.filter(item => item.type == 'vehiclemodule'); return comp; } /* -------------------------------------------- */ - getVehicleWeaponModules() { + getVehicleWeaponModules() { let comp = this.items.filter(item => item.type == 'vehicleweaponmodule'); return comp; } @@ -660,7 +660,7 @@ export class PegasusActor extends Actor { return false } } - if (item.type == "power" && item.system.purchasedtext.length > 0 ) { + if (item.type == "power" && item.system.purchasedtext.length > 0) { ChatMessage.create({ content: `Power ${item.name} puchased : ${item.system.purchasedtext}` }) } let dropID = $(event.target).parents(".item").attr("data-item-id") // Only relevant if container drop @@ -749,8 +749,8 @@ export class PegasusActor extends Actor { if (spec) { let powers = [] for (let power of spec.system.powers) { - if ( power.data ) { - power.system = power.data + if (power.data) { + power.system = power.data } power.system.specId = specId powers.push(power) @@ -968,7 +968,7 @@ export class PegasusActor extends Actor { if (status == "activated") { // Add effects linked to the perk let effects = [] - for (let effect of item.system.effectsgained) { + for (let effect of item.system.effectsgained) { if (effect.data) { effect.system = effect.data } @@ -1730,4 +1730,34 @@ export class PegasusActor extends Actor { ui.notifications.warn("Power not found !", powerId); } } + + /* -------------------------------------------- */ + /* VEHICLE STUFF */ + manageCurrentSpeed(speed) { + if (speed == "fullstop") { + this.update({ 'system.secondary.moverange': "nomovement" }) + } + if (speed == "crawling") { + this.update({ 'system.secondary.moverange': "threatzone" }) + } + if (speed == "slow") { + this.update({ 'system.secondary.moverange': "close" }) + } + if (speed == "average") { + this.update({ 'system.secondary.moverange': "medium" }) + } + if (speed == "fast") { + this.update({ 'system.secondary.moverange': "long" }) + } + if (speed == "extfast") { + this.update({ 'system.secondary.moverange': "extreme" }) + } + } + + /* -------------------------------------------- */ + modifyVehicleStun(incDec) { + let stun = this.system.stun.value + incDec + this.update({ 'stun.value': stun }) + } + } diff --git a/modules/pegasus-vehicle-sheet.js b/modules/pegasus-vehicle-sheet.js index dfce82f..786f490 100644 --- a/modules/pegasus-vehicle-sheet.js +++ b/modules/pegasus-vehicle-sheet.js @@ -113,15 +113,9 @@ export class PegasusVehicleSheet extends ActorSheet { this.actor.createEmbeddedDocuments('Item', [{ name: "NewItem", type: dataType }], { renderSheet: true }) }) - html.find('.spec-group-activate').click(ev => { - const li = $(ev.currentTarget).parents(".item"); - let itemId = li.data("item-id"); - this.actor.specPowerActivate( itemId) - }); - html.find('.spec-group-deactivate').click(ev => { - const li = $(ev.currentTarget).parents(".item"); - let itemId = li.data("item-id"); - this.actor.specPowerDeactivate( itemId) + html.find('.current-speed-change').click(ev => { + let speed = ev.currentTarget.value + this.actor.manageCurrentSpeed(speed) }); html.find('.equip-activate').click(ev => { @@ -140,32 +134,6 @@ export class PegasusVehicleSheet extends ActorSheet { let itemId = li.data("item-id"); this.actor.perkEffectUsed( itemId) }); - - html.find('.perk-status').change(ev => { - const li = $(ev.currentTarget).parents(".item"); - let itemId = li.data("item-id"); - this.actor.updatePerkStatus( itemId, ev.currentTarget.value) - this.render() - }); - - html.find('.power-cost-spent').change(ev => { - const li = $(ev.currentTarget).parents(".item"); - let itemId = li.data("item-id"); - this.actor.updatePowerSpentCost( itemId, ev.currentTarget.value) - }); - - html.find('.power-dmg-roll').click(ev => { - const li = $(ev.currentTarget).parents(".item") - let itemId = li.data("item-id") - this.actor.powerDmgRoll( itemId ) - }) - - html.find('.perk-used').change(ev => { - const li = $(ev.currentTarget).parents(".item") - let itemId = li.data("item-id") - let index = Number($(ev.currentTarget).data("use-index") ) - this.actor.updatePerkUsed( itemId, index, ev.currentTarget.checked ) - }); html.find('.subactor-edit').click(ev => { const li = $(ev.currentTarget).parents(".item"); @@ -204,11 +172,11 @@ export class PegasusVehicleSheet extends ActorSheet { this.actor.incDecAmmo( li.data("item-id"), +1 ) } ); - html.find('.stun-minus').click(event => { - this.actor.modifyStun( -1 ) + html.find('.vehicle-stun-minus').click(event => { + this.actor.modifyVehicleStun( -1 ) } ) - html.find('.stun-plus').click(event => { - this.actor.modifyStun( 1 ) + html.find('.vehicle-stun-plus').click(event => { + this.actor.modifyVehicleStun( 1 ) } ) @@ -257,16 +225,6 @@ export class PegasusVehicleSheet extends ActorSheet { this.rollIDR( li.data("item-id"), diceValue) }) - html.find('.roll-spec').click((event) => { - const li = $(event.currentTarget).parents(".item"); - const specId = li.data("item-id"); - this.actor.rollSpec(specId); - }); - html.find('.power-roll').click((event) => { - const li = $(event.currentTarget).parents(".item"); - const powerId = li.data("item-id"); - this.actor.rollPower(powerId); - }); html.find('.weapon-roll').click((event) => { const li = $(event.currentTarget).parents(".item"); const weaponId = li.data("item-id"); @@ -304,35 +262,12 @@ export class PegasusVehicleSheet extends ActorSheet { this.actor.equipItem( li.data("item-id") ); this.render(true); }); - html.find('.power-activate').click(ev => { - const li = $(ev.currentTarget).parents(".item"); - this.actor.activatePower( li.data("item-id") ); - this.render(true); - }); - html.find('.vice-virtue-activate').click(ev => { - const li = $(ev.currentTarget).parents(".item") - this.actor.activateViceOrVirtue( li.data("item-id") ) - this.render(true); - }) - - html.find('.change-worstfear').change(ev => { - this.actor.manageWorstFear( ev.currentTarget.checked ) - }); - html.find('.change-desires').change(ev => { - this.actor.manageDesires( ev.currentTarget.checked ) - }); html.find('.update-field').change(ev => { const fieldName = $(ev.currentTarget).data("field-name"); let value = Number(ev.currentTarget.value); this.actor.update( { [`${fieldName}`]: value } ); }); - html.find('.perk-active').click(ev => { - const li = $(ev.currentTarget).parents(".item"); - this.actor.activatePerk( li.data("item-id") ); - this.render(true); - }); - } /* -------------------------------------------- */ diff --git a/system.json b/system.json index 919d2c4..b326e5c 100644 --- a/system.json +++ b/system.json @@ -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.5.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.6.zip", "esmodules": [ "modules/pegasus-main.js" ], @@ -254,6 +254,6 @@ ], "title": "Pegasus RPG", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", - "version": "10.0.5", + "version": "10.0.6", "background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp" } \ No newline at end of file diff --git a/templates/partial-options-vehicle-speed.html b/templates/partial-options-vehicle-speed.html index 5547e1d..a9a7309 100644 --- a/templates/partial-options-vehicle-speed.html +++ b/templates/partial-options-vehicle-speed.html @@ -1,4 +1,4 @@ - + diff --git a/templates/partial-vehicle-stat-block.html b/templates/partial-vehicle-stat-block.html index 8ddb632..8736122 100644 --- a/templates/partial-vehicle-stat-block.html +++ b/templates/partial-vehicle-stat-block.html @@ -36,7 +36,7 @@ {{/if}} - {{#if (eq key "size")}} + {{#if (eq key "hr")}}