0.0.5 - Item Values, Creature Settings

-Added Item Value to the item and cargo tab.
-Reworked the creature hit/health
-Added creature options for new stats.
This commit is contained in:
Martin Jencka
2020-11-21 10:55:30 -07:00
parent 74602d01b4
commit 35666a0faa
10 changed files with 344 additions and 49 deletions
+20 -8
View File
@@ -557,6 +557,14 @@
width: 100%;
}
.mothership .creature-mainstat {
position: relative;
display: grid;
grid-template-columns: 1fr 3em;
align-items: center;
gap: 0;
width: 100%;
}
.mothership .mainstatlabel {
border-top-left-radius: 2em;
border-bottom-left-radius: 2em;
@@ -658,25 +666,21 @@
.mothership .creature-header-grid {
display: grid;
grid-template-areas:
'header header header'
'name header header'
'line line line';
grid-gap: 10px;
background: #111;
}
.mothership .creature-header {
display: grid;
grid-template-columns: 1fr 7em 7em 5.6em 3em 5em;
grid-template-rows: 1fr 1fr;
display: flex ;
flex-direction: row-reverse;
align-items: center;
grid-column: 1/-1;
color: white;
font-family: "Montserrat", "Arial Black", sans-serif;
font-weight: bold;
text-transform: uppercase;
height: 27px;
grid-area: header;
padding: 8px;
}
@@ -722,13 +726,14 @@
}
.mothership .creaturename {
margin: -0.15em;
height: auto;
width: 100%;
padding-left: 13px;
font-size: 1.3rem;
font-weight: bold;
color:white;
text-transform: uppercase;
font-family: "Century Gothic", "Diadact Gothic", sans-serif;
}
.mothership .creaturestat {
@@ -743,6 +748,13 @@
.mothership .creaturedescription {
height: 400px;
padding: 10px;
overflow-y: auto;
}
.mothership .creaturedescription .editor-content{
overflow-y: visible;
}
.mothership .creaturedescription .editor{
overflow: visible;
}
.mothership .creature-ability-container {
+48 -10
View File
@@ -2,6 +2,10 @@
* Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet}
*/
import {
DLCreatureSettings
} from "../settings/creature-settings.js";
export class MothershipCreatureSheet extends ActorSheet {
/** @override */
@@ -15,6 +19,42 @@ export class MothershipCreatureSheet extends ActorSheet {
});
}
/**
* Extend and override the sheet header buttons
* @override
*/
_getHeaderButtons() {
let buttons = super._getHeaderButtons();
const canConfigure = game.user.isGM || this.actor.owner;
if (this.options.editable && canConfigure) {
buttons = [{
label: 'Creature Settings',
class: 'configure-actor',
icon: 'fas fa-tasks',
onclick: (ev) => this._onConfigureCreature(ev),
},].concat(buttons);
}
return buttons;
}
/* -------------------------------------------- */
_onConfigureCreature(event) {
event.preventDefault();
new DLCreatureSettings(this.actor, {
top: this.position.top + 40,
left: this.position.left + (this.position.width - 400) / 2
}).render(true);
}
async _updateObject(event, formData) {
const actor = this.object;
const updateData = expandObject(formData);
await actor.update(updateData, {
diff: false
});
}
/* -------------------------------------------- */
/** @override */
@@ -153,16 +193,14 @@ export class MothershipCreatureSheet extends ActorSheet {
}
this.actor.updateEmbeddedEntity('OwnedItem', item);
let actor = this.actor;
let speaker = ChatMessage.getSpeaker({ actor });
ChatMessage.create({
speaker,
content: `Reloading ` + item.name + "...",
type: CHAT_MESSAGE_TYPES.EMOTE
},
{ chatBubble: true });
// let actor = this.actor;
// let speaker = ChatMessage.getSpeaker({ actor });
// ChatMessage.create({
// speaker,
// content: `Reloading ` + item.name + "...",
// type: CHAT_MESSAGE_TYPES.EMOTE
// },
// { chatBubble: true });
});
// Rollable Item/Anything with a description that we want to click on.
+130
View File
@@ -0,0 +1,130 @@
export class DLCreatureSettings extends FormApplication {
static get defaultOptions() {
const options = super.defaultOptions;
options.id = 'sheet-modifiers';
options.classes = ["mothership", "sheet", "actor", "creature"];
options.template = 'systems/mothership/templates/dialogs/creature-settings-dialog.html';
options.width = 320;
options.height = 150;
return options;
}
/* -------------------------------------------- */
/**
* Add the Entity name into the window title
* @type {String}
*/
get title() {
return `${this.object.name}: Creature Settings`;
}
/* -------------------------------------------- */
/**
* Construct and return the data object used to render the HTML template for this form application.
* @return {Object}
*/
getData() {
const actor = this.object.data;
return {
actor
};
}
/* -------------------------------------------- */
/** @override */
activateListeners(html) {
super.activateListeners(html);
html.find(`input[type=checkbox][id="data.stats.combat.enabled"]`).click(ev => {
if (ev.currentTarget.checked) {
const combat = html.find(`input[type=checkbox][id="data.stats.combat.enabled"]`).prop('checked', true);
}
this.object.update({
"data.stats.combat.enabled": ev.currentTarget.checked
});
});
html.find(`input[type=checkbox][id="data.stats.instinct.enabled"]`).click(ev => {
if (ev.currentTarget.checked) {
const instinct = html.find(`input[type=checkbox][id="data.stats.instinct.enabled"]`).prop('checked', true);
}
this.object.update({
"data.stats.instinct.enabled": ev.currentTarget.checked
});
});
html.find(`input[type=checkbox][id="data.stats.loyalty.enabled"]`).click(ev => {
if (ev.currentTarget.checked) {
const loyalty = html.find(`input[type=checkbox][id="data.stats.loyalty.enabled"]`).prop('checked', true);
}
this.object.update({
"data.stats.loyalty.enabled": ev.currentTarget.checked
});
});
html.find(`input[type=checkbox][id="data.stats.speed.enabled"]`).click(ev => {
if (ev.currentTarget.checked) {
const speed = html.find(`input[type=checkbox][id="data.stats.speed.enabled"]`).prop('checked', true);
}
this.object.update({
"data.stats.speed.enabled": ev.currentTarget.checked
});
});
html.find(`input[type=checkbox][id="data.stats.armor.enabled"]`).click(ev => {
if (ev.currentTarget.checked) {
const armor = html.find(`input[type=checkbox][id="data.stats.armor.enabled"]`).prop('checked', true);
}
this.object.update({
"data.stats.armor.enabled": ev.currentTarget.checked
});
});
html.find(`input[type=checkbox][id="data.stats.sanity.enabled"]`).click(ev => {
if (ev.currentTarget.checked) {
const sanity = html.find(`input[type=checkbox][id="data.stats.sanity.enabled"]`).prop('checked', true);
}
this.object.update({
"data.stats.sanity.enabled": ev.currentTarget.checked
});
});
}
/**
* This method is called upon form submission after form data is validated
* @param event {Event} The initial triggering submission event
* @param formData {Object} The object of validated form data with which to update the object
* @private
*/
async _updateObject(event, formData) {
console.log("Updating Object");
// Loyalty
if (this.object.data.data.stats.loyalty.enabled) {
await this.object.update({
"data.stats.loyalty.enabled": true
});
}
// Speed
if (this.object.data.data.stats.speed.enabled) {
await this.object.update({
"data.stats.speed.enabled": true
});
}
// Armor
if (this.object.data.data.stats.armor.enabled) {
await this.object.update({
"data.stats.armor.enabled": true
});
}
await this.object.updateEmbeddedEntity("OwnedItem", update);
this.object.update({
formData
});
this.object.sheet.render(true);
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "mothership",
"title": "Mothership",
"description": "The Mothership system for FoundryVTT!",
"version": "0.0.4",
"version": "0.0.5",
"minimumCoreVersion": "0.5.5",
"compatibleCoreVersion": "0.5.5",
"templateVersion": 2,
+25 -8
View File
@@ -10,9 +10,7 @@
"health": {
"value": 10,
"min": 0,
"max": 10,
"pool": 1,
"maxpools": 1
"max": 10
},
"hits": {
"value" : 2,
@@ -99,15 +97,33 @@
"stats": {
"combat": {
"value": 10,
"label": "Combat"
"label": "Combat",
"enabled" : true
},
"instinct": {
"value": 10,
"label": "Instinct"
"label": "Instinct",
"enabled" : true
},
"move": {
"speed": {
"value": 10,
"label": "Move"
"label": "Speed",
"enabled" : true
},
"loyalty": {
"value": 10,
"label": "Loyalty",
"enabled" : false
},
"armor": {
"value": 10,
"label": "Armor",
"enabled" : false
},
"sanity": {
"value": 10,
"label": "Sanity",
"enabled" : false
}
}
},
@@ -179,7 +195,8 @@
"base"
],
"quantity": 1,
"weight": 0
"weight": 0,
"cost" : 0
},
"skill": {
"templates": [
+2
View File
@@ -311,6 +311,7 @@
<div class="skill-stat">Item Name</div>
<div class="skill-stat">Quantity</div>
<div class="skill-stat">Weight</div>
<div class="skill-stat">Value</div>
<div class="item-controls">
<a class="item-control item-create" title="Create Item" data-type="item"><i class="fas fa-plus"></i> Add
Item</a>
@@ -322,6 +323,7 @@
<h4 class="skill-name list-roll description-roll">{{item.name}}</h4>
<div class="skill-stat list-roll item-quantity">{{item.data.quantity}}</div>
<div class="skill-stat">{{item.data.weight}}</div>
<div class="skill-stat">{{item.data.cost}}</div>
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
+79 -21
View File
@@ -2,50 +2,75 @@
{{!-- Sheet Header --}}
<header class="creature-header-grid">
<!-- Creature NAME -->
<input name="name" class="noborder creaturename" style="grid-area:'name';" type="text" value="{{actor.name}}" placeholder="Name" />
<div class="creature-header">
<!-- Creature NAME -->
<input name="name" class="noborder creaturename" type="text" value="{{actor.name}}" placeholder="Name" />
{{#if data.stats.combat.enabled}}
<!-- Combat -->
<div class="mainstatwrapper">
<div class="resource mainstat">
<div class="resource creature-mainstat">
<span class="ability-mod stat-roll rollable creaturestat" data-key="combat" data-roll="d100"
data-label="Combat">COMBAT</span>
<input class="creaturestat noborder" style="width: 30px;" type="text" name="data.stats.combat.value"
value="{{data.stats.combat.value}}" data-dtype="Number" />
</div>
</div>
{{/if}}
{{#if data.stats.instinct.enabled}}
<!-- Instinct -->
<div class="mainstatwrapper">
<div class="resource mainstat">
<div class="resource creature-mainstat">
<span class="ability-mod stat-roll rollable creaturestat" data-key="instinct" data-roll="d100"
data-label="Instinct">Instinct</span>
<input class="creaturestat noborder" style="width: 30px;" type="text" name="data.stats.instinct.value"
value="{{data.stats.instinct.value}}" data-dtype="Number" />
</div>
</div>
<!-- Move -->
{{/if}}
{{#if data.stats.speed.enabled}}
<!-- Speed -->
<div class="mainstatwrapper">
<div class="resource mainstat">
<span class="creaturestat" data-key="move" data-roll="d100" data-label="Move">Move</span>
<input class="creaturestat noborder" style="width: 30px;" type="text" name="data.stats.move.value"
value="{{data.stats.move.value}}" data-dtype="Number" />
<div class="resource creature-mainstat">
<span class="ability-mod stat-roll rollable creaturestat" data-key="speed" data-roll="d100"
data-label="Speed">Speed</span>
<input class="creaturestat noborder" style="width: 30px;" type="text" name="data.stats.speed.value"
value="{{data.stats.speed.value}}" data-dtype="Number" />
</div>
</div>
<!-- Health / Hits -->
{{/if}}
{{#if data.stats.loyalty.enabled}}
<!-- Loyalty -->
<div class="mainstatwrapper">
<div class="resource mainstat">
<span class="creaturestat" data-key="move" data-roll="d100" data-label="Move">Hits</span>
<div style="grid-template-columns: 2em 2em; display: flex;">
<input class="creaturestat noborder" style="width: 24px;" type="text" name="data.health.maxpools"
value="{{data.health.maxpools}}" data-dtype="Number" />
<div>
(<input class="creaturestat noborder" style="width: 26px;" type="text" name="data.health.max"
value="{{data.health.max}}" data-dtype="Number" />)
</div>
</div>
<div class="resource creature-mainstat">
<span class="ability-mod stat-roll rollable creaturestat" data-key="loyalty" data-roll="d100"
data-label="Speed">Loyalty</span>
<input class="creaturestat noborder" style="width: 30px;" type="text" name="data.stats.loyalty.value"
value="{{data.stats.loyalty.value}}" data-dtype="Number" />
</div>
</div>
{{/if}}
{{#if data.stats.armor.enabled}}
<!-- Armor -->
<div class="mainstatwrapper">
<div class="resource creature-mainstat">
<span class="ability-mod stat-roll rollable creaturestat" data-key="armor" data-roll="d100"
data-label="Speed">Armor</span>
<input class="creaturestat noborder" style="width: 30px;" type="text" name="data.stats.armor.value"
value="{{data.stats.armor.value}}" data-dtype="Number" />
</div>
</div>
{{/if}}
{{#if data.stats.sanity.enabled}}
<!-- Sanity -->
<div class="mainstatwrapper">
<div class="resource creature-mainstat">
<span class="ability-mod stat-roll rollable creaturestat" data-key="sanity" data-roll="d100"
data-label="Speed">Sanity</span>
<input class="creaturestat noborder" style="width: 30px;" type="text" name="data.stats.sanity.value"
value="{{data.stats.sanity.value}}" data-dtype="Number" />
</div>
</div>
{{/if}}
<!-- <div class="health grid grid-1col">
<div class="resource healthspread minmaxtopstat">
<label for="data.health.value" class="resource-label minmaxtext">Health</label>
@@ -66,6 +91,39 @@
</header>
<div class="creature-description-grid">
<div class="creaturedescription">
<div class="grid">
<!-- Health -->
<div class="resource healthspread minmaxtopstat">
<label for="data.health.value" class="resource-label minmaxtext">Health</label>
<div class="minmaxwrapper">
<input class="maxhealth-input darkGreyText" type="text" name="data.health.value" value="{{data.health.value}}"
data-dtype="Number" />
<div class="slant"></div>
<input class="maxhealth-input darkGreyText" type="text" name="data.health.max" value="{{data.health.max}}"
data-dtype="Number" />
</div>
<div class="healthmaxtext">Current</div>
<div class="healthmaxtext">Maximum</div>
</div>
<!-- Hits -->
<div class="resource healthspread minmaxtopstat">
<label for="data.hits.value" class="resource-label minmaxtext">Hits</label>
<div class="minmaxwrapper">
<input class="maxhealth-input darkGreyText" type="text" name="data.hits.value" value="{{data.hits.value}}"
data-dtype="Number" />
<div class="slant"></div>
<input class="maxhealth-input darkGreyText" type="text" name="data.hits.max" value="{{data.hits.max}}"
data-dtype="Number" />
</div>
<div class="healthmaxtext">Current</div>
<div class="healthmaxtext">Maximum</div>
</div>
</div>
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
<div class="creature-abilities">
+2
View File
@@ -288,6 +288,7 @@
<div class="skill-stat">Item Name</div>
<div class="skill-stat">Quantity</div>
<div class="skill-stat">Weight</div>
<div class="skill-stat">Value</div>
<div class="item-controls">
<a class="item-control item-create" title="Create Item" data-type="item"><i
class="fas fa-plus"></i> Add</a>
@@ -300,6 +301,7 @@
<h4 class="skill-name list-roll description-roll">{{item.name}}</h4>
<div class="skill-stat list-roll item-quantity">{{item.data.quantity}}</div>
<div class="skill-stat">{{item.data.weight}}</div>
<div class="skill-stat">{{item.data.cost}}</div>
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
@@ -0,0 +1,32 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<div class="header-fields">
<div class="grid grid-3col">
<div class="resource">
<label class="resource-label">Combat</label>
<input type="checkbox" name="actor.data.stats.combat.enabled" id="data.stats.combat.enabled" value="{{data.stats.combat.enabled}}" {{#if actor.data.stats.combat.enabled}}checked{{/if}} data-dtype="Boolean" />
</div>
<div class="resource">
<label class="resource-label">Instinct</label>
<input type="checkbox" name="actor.data.stats.instinct.enabled" id="data.stats.instinct.enabled" value="{{data.stats.instinct.enabled}}" {{#if actor.data.stats.instinct.enabled}}checked{{/if}} data-dtype="Boolean" />
</div>
<div class="resource">
<label class="resource-label">Loyalty</label>
<input type="checkbox" name="actor.data.stats.loyalty.enabled" id="data.stats.loyalty.enabled" value="{{data.stats.loyalty.enabled}}" {{#if actor.data.stats.loyalty.enabled}}checked{{/if}} data-dtype="Boolean" />
</div>
<div class="resource">
<label class="resource-label">Speed</label>
<input type="checkbox" name="actor.data.stats.speed.enabled" id="data.stats.speed.enabled" value="{{data.stats.speed.enabled}}" {{#if actor.data.stats.speed.enabled}}checked{{/if}} data-dtype="Boolean" />
</div>
<div class="resource">
<label class="resource-label">Armor</label>
<input type="checkbox" name="actor.data.stats.armor.enabled" id="data.stats.armor.enabled" value="{{data.stats.armor.enabled}}" {{#if actor.data.stats.armor.enabled}}checked{{/if}} data-dtype="Boolean" />
</div>
<div class="resource">
<label class="resource-label">Sanity</label>
<input type="checkbox" name="actor.data.stats.sanity.enabled" id="data.stats.sanity.enabled" value="{{data.stats.sanity.enabled}}" {{#if actor.data.stats.sanity.enabled}}checked{{/if}} data-dtype="Boolean" />
</div>
</div>
</div>
</header>
</form>
+5 -1
View File
@@ -3,7 +3,7 @@
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
<div class="grid grid-2col">
<div class="grid grid-3col">
<div class="resource">
<label class="resource-label">Quantity</label>
<input type="text" name="data.quantity" value="{{data.quantity}}" data-dtype="Number"/>
@@ -12,6 +12,10 @@
<label class="resource-label">Weight</label>
<input type="text" name="data.weight" value="{{data.weight}}" data-dtype="Number"/>
</div>
<div class="resource">
<label class="resource-label">Value</label>
<input type="text" name="data.cost" value="{{data.cost}}" data-dtype="Number"/>
</div>
</div>
</div>
</header>