ENH: Wage and Party

- Fixed AC value on party sheet
- Merges wage and upkeep
master
U~man 2020-07-14 17:19:25 +02:00
parent 71f6c9fda3
commit a14bd9fd42
7 changed files with 40 additions and 28 deletions

View File

@ -85,21 +85,6 @@ export class OseActorSheetCharacter extends OseActorSheet {
this._calculateMovement(data, totalWeight);
}
// Compute AC
let baseAc = 9;
let baseAac = 10;
let shield = 0;
data.owned.armors.forEach((a) => {
if (a.data.equipped && a.data.type != "shield") {
baseAc = a.data.ac.value;
baseAac = a.data.aac.value;
} else if (a.data.equipped && a.data.type == "shield") {
shield = a.data.ac.value;
}
});
data.data.aac.value = baseAac + data.data.scores.dex.mod + shield;
data.data.ac.value = baseAc - data.data.scores.dex.mod - shield;
data.data.shield = shield;
return data;
}

View File

@ -12,6 +12,7 @@ export class OseActor extends Actor {
// Compute modifiers from actor scores
this.computeModifiers();
this._isSlow();
this.computeAC();
// Determine Initiative
if (game.settings.get("ose", "individualInit")) {
@ -23,6 +24,7 @@ export class OseActor extends Actor {
data.initiative.value = 0;
}
data.movement.encounter = data.movement.base / 3;
}
/* -------------------------------------------- */
/* Socket Listeners and Handlers
@ -448,6 +450,31 @@ export class OseActor extends Actor {
});
}
computeAC() {
if (this.data.type != "character") {
return;
}
// Compute AC
let baseAc = 9;
let baseAac = 10;
let shield = 0;
const data = this.data.data;
data.aac.naked = baseAc + data.scores.dex.mod;
data.ac.naked = baseAc - data.scores.dex.mod;
const armors = this.data.items.filter(i => i.type == 'armor');
armors.forEach((a) => {
if (a.data.equipped && a.data.type != "shield") {
baseAc = a.data.ac.value;
baseAac = a.data.aac.value;
} else if (a.data.equipped && a.data.type == "shield") {
shield = a.data.ac.value;
}
});
data.aac.value = baseAac + data.scores.dex.mod + shield;
data.ac.value = baseAc - data.scores.dex.mod - shield;
data.shield = shield;
}
computeModifiers() {
if (this.data.type != "character") {
return;
@ -489,6 +516,9 @@ export class OseActor extends Actor {
data.scores.con.value
);
data.ac.naked = 9 + data.scores.dex.mod;
data.aac.naked = 10 - data.scores.dex.mod;
const capped = {
0: -2,
3: -2,

View File

@ -104,7 +104,7 @@ export class OsePartySheet extends FormApplication {
},
},
},
}).render(true);
}, {height: "auto"}).render(true);
}
/** @override */

View File

@ -6,8 +6,7 @@
"retainer": {
"enabled": false,
"loyalty": 0,
"wage": 0,
"upkeep": 0
"wage": ""
},
"hp": {
"hd": "1d8",

View File

@ -81,11 +81,11 @@
{{#if config.ascendingAC}}
<div class="health-value health-top" title="{{localize 'OSE.ArmorClass'}}">{{data.aac.value}}</div>
<div class="health-value health-bottom" title="{{localize 'OSE.ArmorClassNaked'}}">
{{add 10 data.scores.dex.mod}}</div>
{{data.aac.naked}}</div>
{{else}}
<div class="health-value health-top" title="{{localize 'OSE.ArmorClass'}}">{{data.ac.value}}</div>
<div class="health-value health-bottom" title="{{localize 'OSE.ArmorClassNaked'}}">
{{subtract data.scores.dex.mod 9}}</div>
{{data.ac.naked}}</div>
{{/if}}
{{#if data.shield}}<div class="shield" title="{{localize 'OSE.items.hasShield'}} ({{data.shield}})"><i
class="fas fa-shield-alt"></i></div>{{/if}}

View File

@ -6,15 +6,10 @@
<ul class="summary flexrow">
{{#if data.retainer.enabled}}
<li>
<input type="text" name="data.retainer.wage" value="{{data.retainer.wage}}" data-dtype="Number"
<input type="text" name="data.retainer.wage" value="{{data.retainer.wage}}" data-dtype="String"
/>
<label>{{localize 'OSE.RetainerWage'}}</label>
</li>
<li>
<input type="text" name="data.retainer.upkeep" value="{{data.retainer.upkeep}}" data-dtype="Number"
/>
<label>{{localize 'OSE.RetainerUpkeep'}}</label>
</li>
{{else}}
<li>
<input type="text" name="data.details.title" value="{{data.details.title}}" data-dtype="String"

View File

@ -35,14 +35,17 @@
<div class="field-name">
{{e.name}}
</div>
<div class="item-controls field-long">
<div class="item-control reaction-roll" title="Reaction Roll"><a><i class="fas fa-user"></i></a></div>
</div>
<div class="field-long">
{{e.data.data.hp.value}}/{{e.data.data.hp.max}}
</div>
<div class="field-short">
{{e.data.data.ac.value}}
<strong>{{e.data.data.ac.value}}</strong> <sub>{{e.data.data.ac.naked}}</sub>
</div>
<div class="field-short">
{{e.data.data.thac0.value}}
<sub>{{e.data.data.thac0.mod.melee}}</sub> <strong>{{e.data.data.thac0.value}}</strong> <sub>{{e.data.data.thac0.mod.missile}}</sub>
</div>
<div class="field-short">
{{e.data.data.movement.encounter}}