diff --git a/src/module/actor/character-sheet.js b/src/module/actor/character-sheet.js
index 2865fa2..3b34a94 100644
--- a/src/module/actor/character-sheet.js
+++ b/src/module/actor/character-sheet.js
@@ -51,8 +51,6 @@ export class OseActorSheetCharacter extends OseActorSheet {
data.config.ascendingAC = game.settings.get("ose", "ascendingAC");
data.config.individualInit = game.settings.get("ose", "individualInit");
- data.mods = this.actor.computeModifiers();
-
// Compute treasure
let total = 0;
data.owned.items.forEach(item => {
diff --git a/src/module/actor/entity.js b/src/module/actor/entity.js
index 7c88118..6bb15cf 100644
--- a/src/module/actor/entity.js
+++ b/src/module/actor/entity.js
@@ -9,12 +9,14 @@ export class OseActor extends Actor {
super.prepareData();
const data = this.data.data;
+ // Compute modifiers from actor scores
+ this.computeModifiers();
+
// Determine Initiative
if (game.settings.get("ose", "individualInit")) {
data.initiative.value = data.initiative.mod;
if (this.data.type == "character") {
- const mods = this.computeModifiers();
- data.initiative.value += mods.dex;
+ data.initiative.value += data.scores.dex.mod;
}
} else {
data.initiative.value = 0;
@@ -105,111 +107,101 @@ export class OseActor extends Actor {
rollAttack(attack, options = {}) {
const label = game.i18n.localize(`OSE.${attack}`);
const rollParts = ["1d20"];
+ const data = this.data.data;
- const mods = this.computeModifiers();
if (attack == "Missile") {
rollParts.push(
"+",
- mods.dex.toString(),
+ data.scores.dex.mod.toString(),
"+",
- this.data.data.thac0.mod.missile.toString()
+ data.thac0.mod.missile.toString()
);
} else if (attack == "Melee") {
rollParts.push(
"+",
- mods.str.toString(),
+ data.scores.str.mod.toString(),
"+",
- this.data.data.thac0.mod.melee.toString()
+ data.thac0.mod.melee.toString()
);
}
if (game.settings.get("ose", "ascendingAC")) {
rollParts.push("+", this.data.data.thac0.bba.toString());
}
- const data = {
+ const rollData = {
...this.data,
...{
rollData: {
type: "Attack",
stat: attack,
- mods: mods,
+ scores: data.scores,
},
},
};
-
// Roll and return
return OseDice.Roll({
event: options.event,
parts: rollParts,
- data: data,
+ data: rollData,
speaker: ChatMessage.getSpeaker({ actor: this }),
flavor: `${label} ${game.i18n.localize("OSE.Attack")}`,
title: `${label} ${game.i18n.localize("OSE.Attack")}`,
});
}
+ static _valueToMod(val) {
+ switch (val) {
+ case 3:
+ return -3;
+ case 4:
+ case 5:
+ return -2;
+ case 6:
+ case 7:
+ case 8:
+ return -1;
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ return 0;
+ case 13:
+ case 14:
+ case 15:
+ return 1;
+ case 16:
+ case 17:
+ return 2;
+ case 18:
+ return 3;
+ default:
+ return 0;
+ }
+ }
+
+ static _cappedMod(val) {
+ let mod = OseActor._valueToMod(val);
+ if (mod > 1) {
+ mod -= 1;
+ } else if (mod < -1) {
+ mod += 1;
+ }
+ return mod;
+ }
+
computeModifiers() {
if (this.data.type != "character") {
- return {
- str: 0,
- dex: 0,
- int: 0,
- con: 0,
- wis: 0,
- cha: 0,
- npc: 0,
- init: 0,
- };
+ return;
}
- let _valueToMod = (val) => {
- switch (val) {
- case 3:
- return -3;
- case 4:
- case 5:
- return -2;
- case 6:
- case 7:
- case 8:
- return -1;
- case 9:
- case 10:
- case 11:
- case 12:
- return 0;
- case 13:
- case 14:
- case 15:
- return 1;
- case 16:
- case 17:
- return 2;
- case 18:
- return 3;
- default:
- return 0;
- }
- };
- let mods = {
- str: _valueToMod(this.data.data.scores.str.value),
- int: _valueToMod(this.data.data.scores.int.value),
- dex: _valueToMod(this.data.data.scores.dex.value),
- init: _valueToMod(this.data.data.scores.dex.value),
- cha: _valueToMod(this.data.data.scores.cha.value),
- npc: _valueToMod(this.data.data.scores.cha.value),
- wis: _valueToMod(this.data.data.scores.wis.value),
- con: _valueToMod(this.data.data.scores.con.value),
- };
- if (mods.init > 1) {
- mods.init -= 1;
- } else if (mods.init < -1) {
- mods.init += 1;
- }
- if (mods.npc > 1) {
- mods.npc -= 1;
- } else if (mods.npc < -1) {
- mods.npc += 1;
- }
- return mods;
+ const data = this.data.data;
+ data.scores.str.mod = OseActor._valueToMod(this.data.data.scores.str.value);
+ data.scores.int.mod = OseActor._valueToMod(this.data.data.scores.int.value);
+ data.scores.dex.mod = OseActor._valueToMod(this.data.data.scores.dex.value);
+ data.scores.cha.mod = OseActor._valueToMod(this.data.data.scores.cha.value);
+ data.scores.wis.mod = OseActor._valueToMod(this.data.data.scores.wis.value);
+ data.scores.con.mod = OseActor._valueToMod(this.data.data.scores.con.value);
+
+ data.scores.dex.init = OseActor._cappedMod(this.data.data.scores.dex.value);
+ data.scores.cha.npc = OseActor._cappedMod(this.data.data.scores.cha.value);
}
}
diff --git a/src/module/dice.js b/src/module/dice.js
index 25dc5fc..c463de4 100644
--- a/src/module/dice.js
+++ b/src/module/dice.js
@@ -1,16 +1,17 @@
export class OseDice {
static digestResult(data, roll) {
let details = "";
-
// ATTACKS
let die = roll.parts[0].total;
if (data.rollData.type == "Attack") {
if (game.settings.get("ose", "ascendingAC")) {
let bba = data.data.thac0.bba;
- bba +=
- data.rollData.stat == "Melee"
- ? data.data.thac0.mod.melee + data.rollData.mods.str
- : data.data.thac0.mod.missile + data.rollData.mods.dex;
+ if (data.rollData.stat == "Melee") {
+ bba += data.data.thac0.mod.melee + data.rollData.scores.str.mod;
+ } else if (data.rollData.stat == "Missile") {
+ bba += data.data.thac0.mod.missile + data.rollData.scores.dex.mod;
+ }
+
details = `
Failure (${bba})
`;
if (die == 1) {
return details;
@@ -19,11 +20,11 @@ export class OseDice {
} else {
// B/X Historic THAC0 Calculation
let thac = data.data.thac0.value;
- thac -=
- data.rollData.stat == "Melee"
- ? data.data.thac0.mod.melee + data.rollData.mods.str
- : data.data.thac0.mod.missile + data.rollData.mods.dex;
-
+ if (data.rollData.stat == "Melee") {
+ thac -= data.data.thac0.mod.melee + data.rollData.scores.str.mod;
+ } else if (data.rollData.stat == "Missile") {
+ thac -= data.data.thac0.mod.missile + data.rollData.scores.dex.mod;
+ }
details = `Failure (${thac})
`;
if (thac - roll.total > 9) {
return details;
diff --git a/src/module/item/entity.js b/src/module/item/entity.js
index 9c62396..b0d395b 100644
--- a/src/module/item/entity.js
+++ b/src/module/item/entity.js
@@ -54,6 +54,8 @@ export class OseItem extends Item {
} else if (this.data.data.melee) {
this.actor.rollAttack('Melee');
return true;
+ } else {
+ this.actor.rollAttack();
}
return false;
}
@@ -84,6 +86,7 @@ export class OseItem extends Item {
* @return {Promise}
*/
async roll({ configureDialog = true } = {}) {
+ console.log(this.data);
if (this.data.type == 'weapon') {
if (this.rollWeapon()) return;
}
diff --git a/src/scss/actor-base.scss b/src/scss/actor-base.scss
index ecf4fb7..3eaa83d 100644
--- a/src/scss/actor-base.scss
+++ b/src/scss/actor-base.scss
@@ -72,8 +72,7 @@
position: absolute;
transform: rotate(90deg);
top: 365px;
- right: -168px;
- border-bottom: 1px solid black;
+ right: -169px;
width: 320px;
z-index: -1;
.item {
diff --git a/src/template.json b/src/template.json
index 778fcaa..f36c6ed 100644
--- a/src/template.json
+++ b/src/template.json
@@ -97,27 +97,27 @@
"scores": {
"str": {
"value": 0,
- "mod": 0
+ "bonus": 0
},
"int": {
"value": 0,
- "mod": 0
+ "bonus": 0
},
"wis": {
"value": 0,
- "mod": 0
+ "bonus": 0
},
"dex": {
"value": 0,
- "mod": 0
+ "bonus": 0
},
"con": {
"value": 0,
- "mod": 0
+ "bonus": 0
},
"cha": {
"value": 0,
- "mod": 0
+ "bonus": 0
}
},
"encumbrance": {
diff --git a/src/templates/actors/partials/character-attributes-tab.html b/src/templates/actors/partials/character-attributes-tab.html
index 51bf2f6..831f4c9 100644
--- a/src/templates/actors/partials/character-attributes-tab.html
+++ b/src/templates/actors/partials/character-attributes-tab.html
@@ -11,7 +11,7 @@
- {{localize 'OSE.Melee'}} ({{mods.str}})
+ {{localize 'OSE.Melee'}} ({{data.scores.str.mod}})
{{localize 'OSE.exploration.od.long'}}
@@ -39,7 +39,7 @@
- {{localize 'OSE.saves.magic.long'}}({{mods.wis}})
+ {{localize 'OSE.saves.magic.long'}}({{data.scores.wis.mod}})
@@ -52,9 +52,9 @@
- {{localize 'OSE.Missile'}} ({{mods.dex}})
- {{localize 'OSE.Initiative'}} ({{mods.init}})
- {{localize 'OSE.ArmorClass'}} ({{mods.dex}})
+ {{localize 'OSE.Missile'}} ({{data.scores.dex.mod}})
+ {{localize 'OSE.Initiative'}} ({{data.scores.dex.init}})
+ {{localize 'OSE.ArmorClass'}} ({{data.scores.dex.mod}})
@@ -67,7 +67,7 @@
- {{localize 'OSE.Health'}} ({{mods.con}})
+ {{localize 'OSE.Health'}} ({{data.scores.con.mod}})
@@ -80,9 +80,9 @@
- {{localize 'OSE.NPCReaction'}} ({{mods.npc}})
- {{localize 'OSE.RetainersMax'}} ({{add mods.cha 4}})
- {{localize 'OSE.Loyalty'}} ({{add mods.cha 7}})
+ {{localize 'OSE.NPCReaction'}} ({{data.scores.cha.npc}})
+ {{localize 'OSE.RetainersMax'}} ({{add data.scores.cha.mod 4}})
+ {{localize 'OSE.Loyalty'}} ({{add data.scores.cha.mod 7}})
@@ -114,12 +114,12 @@
{{#if config.ascendingAC}}
-
{{else}}
-
{{/if}}
@@ -140,8 +140,8 @@
{{ localize "OSE.InitiativeShort" }}
- {{add mods.init data.initiative.mod}}
+ title="{{localize 'OSE.scores.dex.long'}}({{data.scores.dex.init}}) + {{localize 'OSE.Modifier'}}({{data.initiative.mod}})">
+ {{add data.scores.dex.init data.initiative.mod}}
{{/if}}
@@ -155,13 +155,13 @@
{{#if config.ascendingAC}}
- {{add data.thac0.mod.melee (add mods.str data.thac0.bba)}}
+ title="{{localize 'OSE.AB'}}({{data.thac0.bba}}) + {{localize 'OSE.scores.str.long'}}({{data.scores.str.mod}}) + {{localize 'OSE.Modifier'}}({{data.thac0.mod.melee}})">
+ {{add data.thac0.mod.melee (add data.scores.str.mod data.thac0.bba)}}
{{else}}
- {{subtract data.thac0.mod.melee (subtract mods.str data.thac0.value)}}
+ title="{{localize 'OSE.Thac0'}}({{data.thac0.value}}) - {{localize 'OSE.scores.str.long'}}({{data.scores.str.mod}}) - {{localize 'OSE.Modifier'}}({{data.thac0.mod.melee}})">
+ {{subtract data.thac0.mod.melee (subtract data.scores.str.mod data.thac0.value)}}
{{/if}}
@@ -195,13 +195,13 @@
{{#if config.ascendingAC}}
- {{add data.thac0.mod.missile (add mods.dex data.thac0.bba)}}
+ title="{{localize 'OSE.AB'}}({{data.thac0.bba}}) + {{localize 'OSE.scores.dex.long'}}({{data.scores.dex.mod}}) + {{localize 'OSE.Modifier'}}({{data.thac0.mod.missile}})">
+ {{add data.thac0.mod.missile (add data.scores.dex.mod data.thac0.bba)}}
{{else}}
- {{subtract data.thac0.mod.missile (subtract mods.dex data.thac0.value)}}
+ title="{{localize 'OSE.Thac0'}}({{data.thac0.value}}) - {{localize 'OSE.scores.dex.long'}}({{data.scores.dex.mod}}) - {{localize 'OSE.Modifier'}}({{data.thac0.mod.missile}})">
+ {{subtract data.thac0.mod.missile (subtract data.scores.dex.mod data.thac0.value)}}
{{/if}}
@@ -280,8 +280,8 @@
{{ localize "OSE.saves.magic.long"}}
-
- {{mods.wis}}
+
+ {{data.scores.wis.mod}}
diff --git a/src/templates/actors/partials/monster-attributes-tab.html b/src/templates/actors/partials/monster-attributes-tab.html
index 74db243..2db39ea 100644
--- a/src/templates/actors/partials/monster-attributes-tab.html
+++ b/src/templates/actors/partials/monster-attributes-tab.html
@@ -32,7 +32,7 @@
{{/if}}
-
+
{{#if config.ascendingAC}}