diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js
index d6d0f19..ec606f7 100644
--- a/modules/pegasus-actor.js
+++ b/modules/pegasus-actor.js
@@ -297,13 +297,13 @@ export class PegasusActor extends Actor {
/* ------------------------------------------- */
async buildContainerTree() {
- let equipments = duplicate(this.data.items.filter(item => item.type == "equipment") || [] )
+ let equipments = duplicate(this.data.items.filter(item => item.type == "equipment") || [])
for (let equip1 of equipments) {
- if ( equip1.data.iscontainer) {
+ if (equip1.data.iscontainer) {
equip1.data.contents = []
equip1.data.contentsEnc = 0
for (let equip2 of equipments) {
- if ( equip1._id != equip2._id && equip2.data.containerid == equip1._id ) {
+ if (equip1._id != equip2._id && equip2.data.containerid == equip1._id) {
equip1.data.contents.push(equip2)
equip1.data.contentsEnc += equip2.data.weight
}
@@ -311,27 +311,35 @@ export class PegasusActor extends Actor {
}
}
+ // Compute whole enc
let enc = 0
- for( let item of equipments) {
+ for (let item of equipments) {
if (item.data.equipped) {
- if ( item.data.iscontainer) {
+ if (item.data.iscontainer) {
enc += item.data.contentsEnc
} else {
enc += item.data.weight
}
}
}
+ for (let item of this.data.items) { // Process items/shields/armors
+ if ((item.type == "weapon" || item.type == "shield" || item.type == "armor") && item.data.data.equipped) {
+ enc += item.data.data.weight
+ }
+ }
+
+ // Store local values
this.encCurrent = enc
- this.containersTree = equipments.filter( item => item.data.containerid == "") // Returns the root of equipements without container
+ this.containersTree = equipments.filter(item => item.data.containerid == "") // Returns the root of equipements without container
// Manages slow effect
- let overCapacity = Math.floor(this.encCurrent / this.getEncumbranceCapacity() )
- this.encHindrance = Math.floor(this.encCurrent / this.getEncumbranceCapacity() )
-
+ let overCapacity = Math.floor(this.encCurrent / this.getEncumbranceCapacity())
+ this.encHindrance = Math.floor(this.encCurrent / this.getEncumbranceCapacity())
+
//console.log("Capacity", overCapacity, this.encCurrent / this.getEncumbranceCapacity() )
let effect = this.data.items.find(item => item.type == "effect" && item.data.data.slow)
- if (overCapacity >= 4 ) {
- if ( !effect) {
+ if (overCapacity >= 4) {
+ if (!effect) {
effect = await PegasusUtility.getEffectFromCompendium("Slowed")
effect.data.slow = true
this.createEmbeddedDocuments('Item', [effect])
@@ -344,14 +352,27 @@ export class PegasusActor extends Actor {
}
/* -------------------------------------------- */
- modifyMomentum( incDec) {
+ modifyMomentum(incDec) {
let momentum = duplicate(this.data.data.momentum)
momentum.value += incDec
- if ( momentum.value >= 0 && momentum.value <= momentum.max ){
- this.update( { 'data.momentum': momentum})
+ if (momentum.value >= 0 ) {
+ this.update({ 'data.momentum': momentum })
+ let chatData = {
+ user: game.user.id,
+ rollMode: game.settings.get("core", "rollMode"),
+ whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM'))
+ }
+ if (incDec > 0) {
+ chatData.content = `
${this.name} has gained a Momentum
${this.name} has used a Momentum true) {
let array = Array.from(this.getEmbeddedCollection("ActiveEffect").values());
@@ -372,25 +393,25 @@ export class PegasusActor extends Actor {
}
/* -------------------------------------------- */
- async addObjectToContainer( itemId, containerId ) {
- let container = this.data.items.find( item => item.id == containerId && item.data.data.iscontainer)
- let object = this.data.items.find( item => item.id == itemId )
+ async addObjectToContainer(itemId, containerId) {
+ let container = this.data.items.find(item => item.id == containerId && item.data.data.iscontainer)
+ let object = this.data.items.find(item => item.id == itemId)
console.log("Found", container, object)
- if ( container ) {
- if ( object.data.data.iscontainer) {
+ if (container) {
+ if (object.data.data.iscontainer) {
ui.notifications.warn("Only 1 level of container allowed")
return
}
- let alreadyInside = this.data.items.filter( item => item.data.data.containerid && item.data.data.containerid == containerId);
- if ( alreadyInside.length >= container.data.data.containercapacity ) {
+ let alreadyInside = this.data.items.filter(item => item.data.data.containerid && item.data.data.containerid == containerId);
+ if (alreadyInside.length >= container.data.data.containercapacity) {
ui.notifications.warn("Container is already full !")
return
- } else {
- await this.updateEmbeddedDocuments( "Item", [{ _id: object.id, 'data.containerid':containerId }] )
+ } else {
+ await this.updateEmbeddedDocuments("Item", [{ _id: object.id, 'data.containerid': containerId }])
}
- } else if ( object && object.data.data.containerid) { // remove from container
+ } else if (object && object.data.data.containerid) { // remove from container
console.log("Removeing: ", object)
- await this.updateEmbeddedDocuments( "Item", [{ _id: object.id, 'data.containerid':"" }]);
+ await this.updateEmbeddedDocuments("Item", [{ _id: object.id, 'data.containerid': "" }]);
}
}
@@ -414,7 +435,7 @@ export class PegasusActor extends Actor {
let dropID = $(event.target).parents(".item").attr("data-item-id") // Only relevant if container drop
let objectID = item.id || item._id
- this.addObjectToContainer( objectID, dropID )
+ this.addObjectToContainer(objectID, dropID)
}
/* -------------------------------------------- */
@@ -438,7 +459,7 @@ export class PegasusActor extends Actor {
getSubActors() {
let subActors = [];
for (let id of this.data.data.subactors) {
- subActors.push( duplicate(game.actors.get(id)) )
+ subActors.push(duplicate(game.actors.get(id)))
}
return subActors;
}
@@ -531,7 +552,7 @@ export class PegasusActor extends Actor {
effects.push(effect)
}
if (effects.length > 0) {
- this.createEmbeddedDocuments('Item', effects )
+ this.createEmbeddedDocuments('Item', effects)
}
this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'data.activated': true }])
}
@@ -735,7 +756,7 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
async computeNRGHealth() {
if (this.isToken) return
-
+
if (this.isOwner || game.user.isGM) {
let updates = {}
let phyDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value) + this.data.data.secondary.health.bonus + this.data.data.statistics.phy.mod;
@@ -974,8 +995,8 @@ export class PegasusActor extends Actor {
if (this.data.data.combat.hindrancedice > 0) {
effectsList.push({ label: "Health/Delirium Hindrance", type: "hindrance", applied: false, value: this.data.data.combat.hindrancedice })
}
- let overCapacity = Math.floor(this.encCurrent / this.getEncumbranceCapacity() )
- if (overCapacity > 0 ) {
+ let overCapacity = Math.floor(this.encCurrent / this.getEncumbranceCapacity())
+ if (overCapacity > 0) {
effectsList.push({ label: "Encumbrance Hindrance", type: "hindrance", applied: false, value: overCapacity })
}
let effects = this.data.items.filter(item => item.type == 'effect')
@@ -1083,14 +1104,14 @@ export class PegasusActor extends Actor {
}
/* -------------------------------------------- */
- powerDmgRoll( itemId) {
+ powerDmgRoll(itemId) {
let power = this.data.items.get(itemId)
- if (power ) {
+ if (power) {
power = duplicate(power)
- this.rollPool( power.data.dmgstatistic )
+ this.rollPool(power.data.dmgstatistic)
}
}
-
+
/* -------------------------------------------- */
rollPool(statKey, useShield = false) {
let stat = this.getStat(statKey)
diff --git a/styles/simple.css b/styles/simple.css
index 7c3d130..06ff1d1 100644
--- a/styles/simple.css
+++ b/styles/simple.css
@@ -217,9 +217,10 @@ table {border: 1px solid #7a7971;}
-webkit-box-flex: 0;
-ms-flex: 0 0 128px;
flex: 0 0 128px;
- width: 128px;
+ width: 196px;
height: auto;
max-height:260px;
+ margin-top: 0px;
margin-right: 10px;
object-fit: cover;
object-position: 50% 0;
@@ -1253,11 +1254,18 @@ Stealth STL: #505050
Perception PER: #f9c801 Also Used for Ranged Damage
Focus FOC: #ff0084
*/
+.color-class-black {
+ background-color: black;
+ background: black;
+}
.color-class-agi,
.color-class-range {
background-color: #02a41d;
background: #02a41d;
}
+.color-class-pool {
+ background-color:#c5c3c3;
+}
.color-class-mnd {
background-color: #a100fe;
}
@@ -1272,6 +1280,9 @@ Focus FOC: #ff0084
.color-class-dmgres {
background-color: #990304;
}
+.color-class-mr {
+ background-color: #050505;
+}
.color-class-com,
.color-class-melee {
background-color: #0136ff;
@@ -1306,10 +1317,10 @@ Focus FOC: #ff0084
max-width: 24px;
}
.status-col-name {
- max-width: 48px;
+ max-width: 62px;
}
.status-block {
- max-width: 128px;
+ max-width: 216px;
}
.momentum-block {
max-width: 128px;
@@ -1325,7 +1336,7 @@ Focus FOC: #ff0084
}
.stat-margin {
margin-left: 4px;
- margin-top: 6px;
+ margin-top: 5px;
}
.combat-margin {
margin-left: 4px;
@@ -1336,6 +1347,7 @@ Focus FOC: #ff0084
}
.item-stat-roll {
max-height: 42px;
+ min-height: 36px;
}
.item-stat-roll select, .item-stat-roll input {
margin-top: 4px;
@@ -1349,4 +1361,17 @@ Focus FOC: #ff0084
max-width: 48px;
max-height: 48px;
border: 0;
+}
+.items-title-bg {
+ margin-top: 6px;
+ background: black;
+ color: white;
+}
+.lock-icon {
+ width:16px;
+ height: 16px;
+}
+.item-sheet-img {
+ width: 64px;
+ height: auto;
}
\ No newline at end of file
diff --git a/system.json b/system.json
index 2a7a74d..255e5e9 100644
--- a/system.json
+++ b/system.json
@@ -183,6 +183,6 @@
"templateVersion": 86,
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
- "version": "0.5.2",
+ "version": "0.5.3",
"background" : "./images/ui/pegasus_welcome_page.webp"
}
diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html
index 93ad6f7..19e631a 100644
--- a/templates/actor-sheet.html
+++ b/templates/actor-sheet.html
@@ -3,12 +3,11 @@
{{!-- Sheet Header --}}