ENH: Score modifiers display

master
U~man 2020-07-04 11:31:51 +02:00
parent db5facb2cd
commit 9a9c78f717
9 changed files with 149 additions and 51 deletions

View File

@ -8,6 +8,7 @@
"OSE.Formula": "Formula",
"OSE.SitMod": "Situational Modifier",
"OSE.Modifier": "Modifier",
"OSE.RollMode": "Roll Mode",
"OSE.RollExample": "Roll Example",
@ -53,6 +54,7 @@
"OSE.saves.breath.long": "Dragon Breath",
"OSE.saves.spell.short": "S",
"OSE.saves.spell.long": "Rod, Staff, Spell",
"OSE.saves.magic.long": "vs Magic",
"OSE.Health": "Hit Points",
"OSE.HealthMax": "Maximum Hit Points",
@ -65,6 +67,7 @@
"OSE.MovementOverland": "Overland Movement Rate",
"OSE.MovementOverlandShort": "OVE",
"OSE.MovementShort": "MV",
"OSE.ArmorClassNaked": "Naked Armor Class",
"OSE.ArmorClass": "Armor Class",
"OSE.ArmorClassShort": "AC",
"OSE.AscArmorClassShort": "AAC",
@ -80,11 +83,16 @@
"OSE.Missile": "Missile",
"OSE.MissileBonus": "Missile Bonus",
"OSE.Initiative": "Initiative",
"OSE.InitiativeBonus": "Initiative Bonus",
"OSE.InitiativeShort": "INIT",
"OSE.Attacks": "Attacks Usable per Round",
"OSE.AttacksShort": "ATT",
"OSE.Spellcaster": "Spellcaster",
"OSE.SpokenLanguages": "Spoken Languages",
"OSE.Literacy": "Literacy",
"OSE.NPCReaction": "NPC Reaction",
"OSE.RetainersMax": "#Retainers",
"OSE.category.attributes": "Attributes",
"OSE.category.inventory": "Inventory",
@ -99,7 +107,7 @@
"OSE.Setting.IndividualInitHint": "Initiative is rolled for each actor and modified by its DEX score",
"OSE.Setting.AscendingAC": "Ascending Armor Class",
"OSE.Setting.AscendingACHint": "The more the better",
"OSE.Setting.Morale": "Enable Monster Morale checks",
"OSE.Setting.Morale": "Enable monsters Morale Rating",
"OSE.Setting.MoraleHint": "Morale Rating is shown on monster sheets",
"OSE.Setting.THAC0Attacks": "Attacks with THAC0",
"OSE.Setting.THAC0AttacksHint": "Attacks are resolved using the THAC0 value, not compatible with AAC",
@ -132,5 +140,7 @@
"OSE.spells.Duration": "Duration",
"OSE.spells.Level": "Level",
"OSE.abilities.Requirements": "Requirements"
"OSE.abilities.Requirements": "Requirements",
"OSE.exploration.OpenDoors": "Open Doors"
}

View File

@ -128,6 +128,14 @@ export class OseActorSheetCharacter extends OseActorSheet {
let element = event.currentTarget;
let attack = element.parentElement.parentElement.dataset.attack;
actorObject.rollAttack(attack, { event: event });
});
html.find(".ability-score .attribute-mod a").click(ev => {
let box = $(event.currentTarget.parentElement.parentElement.parentElement);
box.children('.attribute-bonuses').slideDown(200);
})
html.find(".ability-score .attribute-bonuses a").click(ev => {
$(event.currentTarget.parentElement.parentElement).slideUp(200);
})
// Handle default listeners last so system listeners are triggered first

View File

@ -129,13 +129,26 @@ export class OseActor extends Actor {
return 0;
}
};
return {
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;
}
}

View File

@ -26,15 +26,6 @@ export const registerSettings = function () {
config: true
});
game.settings.register('ose', 'thac0Attacks', {
name: game.i18n.localize('OSE.Setting.THAC0Attacks'),
hint: game.i18n.localize('OSE.Setting.THAC0AttacksHint'),
default: false,
scope: 'world',
type: Boolean,
config: true
});
game.settings.register('ose', 'variableWeaponDamage', {
name: game.i18n.localize('OSE.Setting.VariableWeaponDamage'),
hint: game.i18n.localize('OSE.Setting.VariableWeaponDamageHint'),

View File

@ -138,9 +138,20 @@
.attribute-mod {
position: absolute;
color: $colorTan;
right: 5px;
top: -5px;
font-size: 13px;
right: 1px;
top: 1px;
line-height: 10px;
font-size: 10px;
}
.attribute-bonuses {
display: none;
position: absolute;
background: #222;
padding: 2px;
font-size: 10px;
color: whitesmoke;
width: 100%;
height: 100%;
}
}
}
@ -159,9 +170,14 @@
margin: auto;
}
}
&.saving-throw .attribute-name {
line-height: 16px;
width: 80px;
&.saving-throw {
.attribute-name {
line-height: 16px;
width: 80px;
}
.attribute-value {
line-height: 29px;
}
}
.attribute-value {
width: 45px;

View File

@ -64,6 +64,11 @@
background-position: bottom;
}
}
.saving-throw {
.attribute-value.flat {
line-height: 30px;
}
}
}
/* ----------------------------------------- */
/* Item Controls */

View File

@ -59,6 +59,18 @@
/>
</div>
</div>
<div class="form-group">
<label>{{localize "OSE.InitiativeBonus"}}</label>
<div class="form-fields">
<input
type="text"
name="data.initiative.mod"
id="initiative"
value="{{data.initiative.mod}}"
data-dtype="Number"
/>
</div>
</div>
{{/if}}
<footer class="sheet-footer">
<button type="submit">

View File

@ -8,7 +8,13 @@
<div class="attribute-value">
<input name="data.scores.str.value" type="text" value="{{data.scores.str.value}}" placeholder="0"
data-dtype="Number" />
<span class="attribute-mod">{{mods.str}}</span>
<span class="attribute-mod"><a><i class="fas fa-plus"></i></a></span>
</div>
<div class="attribute-bonuses">
{{localize 'OSE.Melee'}} ({{mods.str}})<br/>
{{localize 'OSE.exploration.OpenDoors'}}
<span class="attribute-mod"><a><i class="fas fa-minus"></i></a></span>
</div>
</li>
<li class="attribute ability-score" data-score="int">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.int.long' }}">
@ -16,7 +22,13 @@
<div class="attribute-value">
<input name="data.scores.int.value" type="text" value="{{data.scores.int.value}}" placeholder="0"
data-dtype="Number" />
<span class="attribute-mod">{{mods.int}}</span>
<span class="attribute-mod"><a><i class="fas fa-plus"></i></a></span>
</div>
<div class="attribute-bonuses">
{{localize 'OSE.SpokenLanguages'}}<br/>
{{localize 'OSE.Literacy'}}
<span class="attribute-mod"><a><i class="fas fa-minus"></i></a></span>
</div>
</li>
<li class="attribute ability-score" data-score="wis">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.wis.long' }}">
@ -24,7 +36,12 @@
<div class="attribute-value">
<input name="data.scores.wis.value" type="text" value="{{data.scores.wis.value}}" placeholder="0"
data-dtype="Number" />
<span class="attribute-mod">{{mods.wis}}</span>
<span class="attribute-mod"><a><i class="fas fa-plus"></i></a></span>
</div>
<div class="attribute-bonuses">
{{localize 'OSE.saves.magic.long'}}({{mods.wis}})
<span class="attribute-mod"><a><i class="fas fa-minus"></i></a></span>
</div>
</li>
<li class="attribute ability-score" data-score="dex">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.dex.long' }}">
@ -32,7 +49,14 @@
<div class="attribute-value">
<input name="data.scores.dex.value" type="text" value="{{data.scores.dex.value}}" placeholder="0"
data-dtype="Number" />
<span class="attribute-mod">{{mods.dex}}</span>
<span class="attribute-mod"><a><i class="fas fa-plus"></i></a></span>
</div>
<div class="attribute-bonuses">
{{localize 'OSE.Missile'}} ({{mods.dex}})<br/>
{{localize 'OSE.Initiative'}} ({{mods.init}})<br/>
{{localize 'OSE.ArmorClass'}} ({{mods.dex}})
<span class="attribute-mod"><a><i class="fas fa-minus"></i></a></span>
</div>
</li>
<li class="attribute ability-score" data-score="con">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.con.long' }}">
@ -40,7 +64,12 @@
<div class="attribute-value">
<input name="data.scores.con.value" type="text" value="{{data.scores.con.value}}" placeholder="0"
data-dtype="Number" />
<span class="attribute-mod">{{mods.con}}</span>
<span class="attribute-mod"><a><i class="fas fa-plus"></i></a></span>
</div>
<div class="attribute-bonuses">
{{localize 'OSE.Health'}} ({{mods.con}})
<span class="attribute-mod"><a><i class="fas fa-minus"></i></a></span>
</div>
</li>
<li class="attribute ability-score" data-score="cha">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.cha.long' }}">
@ -48,7 +77,14 @@
<div class="attribute-value">
<input name="data.scores.cha.value" type="text" value="{{data.scores.cha.value}}" placeholder="0"
data-dtype="Number" />
<span class="attribute-mod">{{mods.cha}}</span>
<span class="attribute-mod"><a><i class="fas fa-plus"></i></a></span>
</div>
<div class="attribute-bonuses">
{{localize 'OSE.NPCReaction'}} ({{mods.npc}})<br/>
{{localize 'OSE.RetainersMax'}} ({{add mods.cha 4}})<br/>
{{localize 'OSE.Loyalty'}} ({{add mods.cha 7}})
<span class="attribute-mod"><a><i class="fas fa-minus"></i></a></span>
</div>
</li>
{{#if data.retainer.enabled}}
<li class="attribute">
@ -79,7 +115,7 @@
<input class="health-top" name="data.aac.value" type="text" value="{{data.aac.value}}"
data-dtype="Number" placeholder="0" title="{{localize 'OSE.ArmorClass'}}" />
<input class="health-bottom" type="text" value="{{add 10 mods.dex}}"
title="{{localize 'OSE.ArmorClass'}}" disabled />
title="{{localize 'OSE.ArmorClassNaked'}}" disabled />
{{else}}
<input class="health-top" name="data.ac.value" type="text" value="{{data.ac.value}}" data-dtype="Number"
placeholder="0" title="{{localize 'OSE.ArmorClass'}}" />
@ -103,9 +139,9 @@
<li class="attribute">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.Initiative' }}">
{{ localize "OSE.InitiativeShort" }}</h4>
<div class="attribute-value">
<input name="data.initiative.value" type="text" value="{{data.initiative.value}}"
placeholder="0" data-dtype="Number" />
<div class="attribute-value"
title="{{localize 'OSE.scores.dex.long'}}({{mods.init}}) + {{localize 'OSE.Modifier'}}({{data.initiative.mod}})">
{{add mods.init data.initiative.mod}}
</div>
</li>
{{/if}}
@ -117,13 +153,17 @@
<h4 class="attribute-name box-title" title="{{localize 'OSE.Melee'}}">
<a>{{localize 'OSE.MeleeShort'}}</a></h4>
<div class="flexrow">
<div class="attribute-value">
{{#if config.ascendingAC}}
{{#if config.ascendingAC}}
<div class="attribute-value"
title="{{localize 'OSE.AB'}}({{data.thac0.bba}}) + {{localize 'OSE.scores.str.long'}}({{mods.str}}) + {{localize 'OSE.Modifier'}}({{data.thac0.mod.melee}})">
{{add data.thac0.mod.melee (add mods.str data.thac0.bba)}}
{{else}}
{{subtract data.thac0.mod.melee (subtract mods.str data.thac0.value)}}
{{/if}}
</div>
{{else}}
<div class="attribute-value"
title="{{localize 'OSE.Thac0'}}({{data.thac0.value}}) - {{localize 'OSE.scores.str.long'}}({{mods.str}}) - {{localize 'OSE.Modifier'}}({{data.thac0.mod.melee}})">
{{subtract data.thac0.mod.melee (subtract mods.str data.thac0.value)}}
</div>
{{/if}}
</div>
</li>
{{#if config.ascendingAC}}
@ -153,13 +193,17 @@
<h4 class="attribute-name box-title" title="{{localize 'OSE.Missile'}}">
<a>{{localize 'OSE.MissileShort'}}</a></h4>
<div class="flexrow">
<div class="attribute-value">
{{#if config.ascendingAC}}
{{#if config.ascendingAC}}
<div class="attribute-value"
title="{{localize 'OSE.AB'}}({{data.thac0.bba}}) + {{localize 'OSE.scores.dex.long'}}({{mods.dex}}) + {{localize 'OSE.Modifier'}}({{data.thac0.mod.missile}})">
{{add data.thac0.mod.missile (add mods.dex data.thac0.bba)}}
{{else}}
{{subtract data.thac0.mod.missile (subtract mods.dex data.thac0.value)}}
{{/if}}
</div>
{{else}}
<div class="attribute-value"
title="{{localize 'OSE.Thac0'}}({{data.thac0.value}}) - {{localize 'OSE.scores.dex.long'}}({{mods.dex}}) - {{localize 'OSE.Modifier'}}({{data.thac0.mod.missile}})">
{{subtract data.thac0.mod.missile (subtract mods.dex data.thac0.value)}}
</div>
{{/if}}
</div>
</li>
</ul>
@ -199,40 +243,47 @@
<div class="attribute-group">
<ul class="attributes">
<li class="attribute saving-throw" data-save="death">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.saves.death.long' }}">
<h4 class="attribute-name box-title">
<a>{{ localize "OSE.saves.death.long" }}</a></h4>
<div class="attribute-value">
<input name="data.saves.death.value" type="text" value="{{data.saves.death.value}}" placeholder="0"
data-dtype="Number" />
</li>
<li class="attribute saving-throw" data-save="wand">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.saves.wand.long' }}">
<h4 class="attribute-name box-title">
<a>{{ localize "OSE.saves.wand.long" }}</a></h4>
<div class="attribute-value">
<input name="data.saves.wand.value" type="text" value="{{data.saves.wand.value}}" placeholder="0"
data-dtype="Number" />
</li>
<li class="attribute saving-throw" data-save="paralysis">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.saves.paralysis.long' }}">
<h4 class="attribute-name box-title">
<a>{{ localize "OSE.saves.paralysis.long" }}</a></h4>
<div class="attribute-value">
<input name="data.saves.paralysis.value" type="text" value="{{data.saves.paralysis.value}}"
placeholder="0" data-dtype="Number" />
</li>
<li class="attribute saving-throw" data-save="breath">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.saves.breath.long' }}">
<h4 class="attribute-name box-title">
<a>{{ localize "OSE.saves.breath.long" }}</a></h4>
<div class="attribute-value">
<input name="data.saves.breath.value" type="text" value="{{data.saves.breath.value}}"
placeholder="0" data-dtype="Number" />
</li>
<li class="attribute saving-throw" data-save="spell">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.saves.spell.long' }}">
<h4 class="attribute-name box-title">
<a>{{ localize "OSE.saves.spell.long" }}</a></h4>
<div class="attribute-value">
<input name="data.saves.spell.value" type="text" value="{{data.saves.spell.value}}"
placeholder="0" />
</li>
<li class="attribute saving-throw">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.saves.magic.long' }}">
{{ localize "OSE.saves.magic.long"}}</h4>
<div class="attribute-value flat" title="{{localize 'OSE.scores.wis.long'}}({{mods.wis}})">
{{mods.wis}}
</div>
</li>
</ul>
</div>
</section>

View File

@ -2,9 +2,6 @@
<div>
<li class="item-titles flexrow">
<div class="item-name">{{localize "OSE.items.Weapons"}}</div>
{{#if config.variableWeaponDamage}}
<div class="field-short">{{localize "OSE.items.Damage"}}</div>
{{/if}}
<div class="field-longer">{{localize "OSE.items.Qualities"}}</div>
<div class="field-short">{{localize "OSE.items.Weight"}}</div>
<div class="item-controls">
@ -23,11 +20,6 @@
</h4>
</a>
</div>
{{#if config.variableWeaponDamage}}
<div class="field-short">
{{item.data.damage}}
</div>
{{/if}}
<div class="field-longer" title="{{item.data.qualities}}">
{{item.data.qualities}}
</div>