WIP for vehicle sheets

This commit is contained in:
sladecraven 2022-09-09 08:33:28 +02:00
parent ecf5a38eb0
commit ae697b0bb8
6 changed files with 50 additions and 85 deletions

View File

@ -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 })
}
}

View File

@ -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);
});
}
/* -------------------------------------------- */

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.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"
}

View File

@ -1,4 +1,4 @@
<option value="none">None</option>
<option value="fullstop">Full stop</option>
<option value="crawling">Crawling</option>
<option value="slow">Slow</option>
<option value="average">Average</option>

View File

@ -36,7 +36,7 @@
</div>
{{/if}}
{{#if (eq key "size")}}
{{#if (eq key "hr")}}
<div class="flexrow stat-text-white">
<span class="stat-label stat-margin" name="{{key}}">Size</span>
<input type="text" class="input-numeric-short" name="system.statistics.{{key}}.size" value="{{stat.size}}" data-dtype="Number" />
@ -63,7 +63,7 @@
{{/select}}
</select>
<span class="stat-label stat-margin" name="{{key}}">Curr. speed</span>
<select class="status-small-label color-class-common" type="text" name="system.statistics.{{key}}.currentspeed"
<select class="status-small-label color-class-common current-speed-change" type="text" name="system.statistics.{{key}}.currentspeed"
value="{{stat.currentspeed}}" data-dtype="String" {{#unless @root.editScore}}disabled{{/unless}}>
{{#select stat.currentspeed}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-vehicle-speed.html}}

View File

@ -124,8 +124,8 @@
<span class="flexrow">
<h3>Stun</h3>
<span class="status-small-label no-grow">
<a class="stun-plus plus-minus-button">+</a>
<a class="stun-minus plus-minus-button">&nbsp;-</a>
<a class="vehicle-stun-plus plus-minus-button">+</a>
<a class="vehicle-stun-minus plus-minus-button">&nbsp;-</a>
</span>
</span>
<ul class="stat-list alternate-list">