Encumbrance & Movement

+ Added encumbrance
+ Added movement decrease by encumbrance (only when sheet is reloaded)
+ Prepared load capacity
This commit is contained in:
LeFrique 2024-01-09 23:16:32 +01:00
parent 71b04063e7
commit b026a81a9f
6 changed files with 49 additions and 2 deletions

View File

@ -43,6 +43,7 @@
"midgard5.item-onbody": "Am Körper", "midgard5.item-onbody": "Am Körper",
"midgard5.item-ismagic": "Ist Magisch", "midgard5.item-ismagic": "Ist Magisch",
"midgard5.item-wealth": "Vermögenswert", "midgard5.item-wealth": "Vermögenswert",
"midgard5.item-weight": "Gewicht",
"midgard5.actor-lp": "Lebenspunkte", "midgard5.actor-lp": "Lebenspunkte",
"midgard5.actor-lp-short": "LP", "midgard5.actor-lp-short": "LP",
@ -112,6 +113,7 @@
"midgard5.heavy-load": "Schwere Last", "midgard5.heavy-load": "Schwere Last",
"midgard5.thrust-load": "Schublast", "midgard5.thrust-load": "Schublast",
"midgard5.load-max": "Höchstlast", "midgard5.load-max": "Höchstlast",
"midgard5.load-capacity": "Tragkraft",
"midgard5.exp-overall": "Erfahrungsschatz", "midgard5.exp-overall": "Erfahrungsschatz",
"midgard5.exp-available": "Erfahrungspunkte", "midgard5.exp-available": "Erfahrungspunkte",

View File

@ -184,7 +184,7 @@ export class M5Character extends Actor {
ret.stats.damageBonus = this.modResult(Math.floor(ret.attributes.st.value / 20) + Math.floor(ret.attributes.gs.value / 30) - 3); ret.stats.damageBonus = this.modResult(Math.floor(ret.attributes.st.value / 20) + Math.floor(ret.attributes.gs.value / 30) - 3);
ret.stats.attackBonus = this.modResult(ret.attributes.gs.bonus); ret.stats.attackBonus = this.modResult(ret.attributes.gs.bonus);
ret.stats.defenseBonus = this.modResult(ret.attributes.gw.bonus); ret.stats.defenseBonus = this.modResult(ret.attributes.gw.bonus);
ret.stats.movement = this.modResult(data.movement); ret.stats.movement = this.modResult(data.info.encumbrance > data.info.heavyLoad ? data.movement / 2 : data.movement);
ret.stats.resistanceMind = this.modResult( ret.stats.resistanceMind = this.modResult(
(data.info.magicUsing ? 2 : 0) + ret.stats.defense.value + (data.info.race === "Mensch" ? ret.attributes.in.bonus : this.raceBonus(data.info.race)) (data.info.magicUsing ? 2 : 0) + ret.stats.defense.value + (data.info.race === "Mensch" ? ret.attributes.in.bonus : this.raceBonus(data.info.race))
); );
@ -209,8 +209,8 @@ export class M5Character extends Actor {
ret.stats.loadMax = M5Character.maxLoadValue(data.attributes.st); ret.stats.loadMax = M5Character.maxLoadValue(data.attributes.st);
ret.stats.thrustLoad = M5Character.thrustLoadValue(data.attributes.st); ret.stats.thrustLoad = M5Character.thrustLoadValue(data.attributes.st);
ret.stats.encumbrance = 0; ret.stats.encumbrance = 0;
if (!skip?.mods) { if (!skip?.mods) {
const aggregate = new M5ModAggregate(data, ret); const aggregate = new M5ModAggregate(data, ret);
@ -243,6 +243,9 @@ export class M5Character extends Actor {
}; };
if (item.system.hoarded) { if (item.system.hoarded) {
ret.stats.hoard += item.system.value || 0; ret.stats.hoard += item.system.value || 0;
};
if (item.system.equipped) {
ret.stats.encumbrance += item.system.weight || 0;
} }
let icon = item.img; let icon = item.img;
@ -372,6 +375,9 @@ export class M5Character extends Actor {
}; };
if (item.system.hoarded) { if (item.system.hoarded) {
ret.stats.hoard += item.system.value || 0; ret.stats.hoard += item.system.value || 0;
};
if (item.system.equipped) {
ret.stats.encumbrance += item.system.weight || 0;
} }
ret.gear.weapons[item.id] = { ret.gear.weapons[item.id] = {
@ -401,6 +407,9 @@ export class M5Character extends Actor {
}; };
if (item.system.hoarded) { if (item.system.hoarded) {
ret.stats.hoard += item.system.value || 0; ret.stats.hoard += item.system.value || 0;
};
if (item.system.equipped) {
ret.stats.encumbrance += item.system.weight || 0;
} }
ret.gear.defensiveWeapons[item.id] = { ret.gear.defensiveWeapons[item.id] = {

View File

@ -39,6 +39,7 @@
<th class="title center">{{localize "midgard5.equipped"}}</th> <th class="title center">{{localize "midgard5.equipped"}}</th>
<th class="title center">{{localize "midgard5.item-quantity"}}</th> <th class="title center">{{localize "midgard5.item-quantity"}}</th>
<th class="title center">{{localize "midgard5.item-value"}}</th> <th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title center">{{localize "midgard5.item-weight"}}</th>
<th class="title"></th> <th class="title"></th>
<th class="title"></th> <th class="title"></th>
</tr> </tr>
@ -66,6 +67,11 @@
<span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span> <span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span>
{{/unless}} {{/unless}}
</td> </td>
<td style="text-align: start">
{{#unless (or (eq item.weight "") (eq item.equipped?))}}
<span class="spell-process">{{item.weight}} kg</span>
{{/unless}}
</td>
<td class="fixed-value">{{#if item.rollExist}}<button class="roll-button roll-consumable-item"></button>{{/if}}</td> <td class="fixed-value">{{#if item.rollExist}}<button class="roll-button roll-consumable-item"></button>{{/if}}</td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td> <td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr> </tr>
@ -85,6 +91,7 @@
<th class="title">{{localize "TYPES.Item.container"}}</th> <th class="title">{{localize "TYPES.Item.container"}}</th>
<th class="title center">{{localize "midgard5.equipped"}}</th> <th class="title center">{{localize "midgard5.equipped"}}</th>
<th class="title center">{{localize "midgard5.item-value"}}</th> <th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title center">{{localize "midgard5.item-weight"}}</th>
<th class="title"></th> <th class="title"></th>
<th class="title"></th> <th class="title"></th>
</tr> </tr>
@ -107,6 +114,11 @@
<span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span> <span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span>
{{/unless}} {{/unless}}
</td> </td>
<td style="text-align: start">
{{#unless (or (eq item.weight "") (eq item.equipped?))}}
<span class="spell-process">{{item.weight}} kg</span>
{{/unless}}
</td>
<td class="fixed-value">{{#if item.rollExist}}<button class="roll-button roll-consumable-item"></button>{{/if}}</td> <td class="fixed-value">{{#if item.rollExist}}<button class="roll-button roll-consumable-item"></button>{{/if}}</td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td> <td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr> </tr>
@ -126,6 +138,7 @@
<th class="title center">{{localize "TYPES.Item.container"}}</th> <th class="title center">{{localize "TYPES.Item.container"}}</th>
<th class="title center">{{localize "midgard5.item-quantity"}}</th> <th class="title center">{{localize "midgard5.item-quantity"}}</th>
<th class="title center">{{localize "midgard5.item-value"}}</th> <th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title center">{{localize "midgard5.item-weight"}}</th>
<th class="title"></th> <th class="title"></th>
<th class="title"></th> <th class="title"></th>
</tr> </tr>
@ -157,6 +170,11 @@
<span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span> <span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span>
{{/unless}} {{/unless}}
</td> </td>
<td style="text-align: start">
{{#unless (or (eq item.weight "") (eq item.equipped?))}}
<span class="spell-process">{{item.weight}} kg</span>
{{/unless}}
</td>
<td class="fixed-value">{{#if item.rollExist}}<button class="roll-button roll-consumable-item"></button>{{/if}}</td> <td class="fixed-value">{{#if item.rollExist}}<button class="roll-button roll-consumable-item"></button>{{/if}}</td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td> <td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr> </tr>

View File

@ -48,6 +48,12 @@
</select> </select>
</div> </div>
</td> </td>
<td>
<div class="flexrow">
<span>{{localize "midgard5.item-weight"}}</span>
<input id="data.weight" type="number" name="data.weight" value="{{data.weight}}">
</div>
</td>
</tr> </tr>
<tr> <tr>
<td>{{localize "midgard5.defenseBonus"}}</td> <td>{{localize "midgard5.defenseBonus"}}</td>

View File

@ -73,6 +73,12 @@
{{/if}} {{/if}}
</div> </div>
</td> </td>
<td>
<div class="flexrow">
<span>{{localize "midgard5.item-weight"}}</span>
<input id="data.weight" type="number" name="data.weight" value="{{data.weight}}">
</div>
</td>
</tr> </tr>
</table> </table>

View File

@ -53,6 +53,12 @@
</select> </select>
</div> </div>
</td> </td>
<td>
<div class="flexrow">
<span>{{localize "midgard5.item-weight"}}</span>
<input id="data.weight" type="number" name="data.weight" value="{{data.weight}}">
</div>
</td>
</tr> </tr>
<tr> <tr>
<td>{{localize "midgard5.base-damage"}}</td> <td>{{localize "midgard5.base-damage"}}</td>