ENH: Abilities

master
U~man 2020-07-02 18:13:08 +02:00
parent 65ab877386
commit c8be217e7e
12 changed files with 145 additions and 49 deletions

View File

@ -16,6 +16,7 @@
"OSE.Alignment": "Alignment",
"OSE.Level": "Level",
"OSE.Experience": "Experience",
"OSE.ExperienceBonus": "Bonus Experience",
"OSE.Treasure": "Treasure type",
"OSE.Size": "Size",
"OSE.Morale": "Morale",
@ -109,6 +110,8 @@
"OSE.items.Melee": "Melee",
"OSE.items.Missile": "Missile",
"OSE.items.Slow": "Slow",
"OSE.items.ArmorAC": "AC",
"OSE.items.ArmorAAC": "AAC",
"OSE.spells.Memorized": "Memorized",
"OSE.spells.Cast": "Cast",
@ -117,6 +120,6 @@
"OSE.spells.Class": "Class",
"OSE.spells.Duration": "Duration",
"OSE.spells.Level": "Level",
"OSE.items.ArmorAC": "AC",
"OSE.items.ArmorAAC": "AAC"
"OSE.abilities.Requirements": "Requirements"
}

View File

@ -51,6 +51,7 @@ 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();
return data;
}

View File

@ -41,4 +41,44 @@ export class OseActor extends Actor {
title: `${label} ${game.i18n.localize('OSE.AbilityCheck')}`,
});
}
computeModifiers() {
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;
}
};
return {
str: _valueToMod(this.data.data.scores.str.value),
int: _valueToMod(this.data.data.scores.int.value),
dex: _valueToMod(this.data.data.scores.dex.value),
cha: _valueToMod(this.data.data.scores.cha.value),
wis: _valueToMod(this.data.data.scores.wis.value),
con: _valueToMod(this.data.data.scores.con.value),
}
}
}

View File

@ -95,6 +95,7 @@
margin: 0;
padding: 0;
.attribute {
position: relative;
margin: 10px 2px;
border: 1px solid $colorTan;
.attribute-name {
@ -109,6 +110,13 @@
display: flex;
flex-direction: row;
}
.attribute-mod {
position: absolute;
color: $colorTan;
right: 5px;
top: 0;
font-size: 13px;
}
}
}
.attribute-group {

View File

@ -12,6 +12,13 @@
/* ----------------------------------------- */
.sheet-header {
.xp-bonus {
top: -15px;
right: 3px;
color: $colorTan;
font-size: 10px;
position: absolute;
}
}
/* ----------------------------------------- */
@ -20,7 +27,6 @@
.sheet-body {
.inventory {
overflow: auto;
height: 520px;
.header-spells {
line-height: 30px;
}
@ -60,7 +66,9 @@
}
.item-entry {
&:nth-child(even) {
background: rgba(0, 0, 0, 0.1);
.item {
background: rgba(0, 0, 0, 0.1);
}
}
}
.item {

View File

@ -1,6 +1,8 @@
.ose.sheet.item {
.profile-img {
border: none;
flex: 0 0 84px;
height: 84px;
}
.sheet-body {
.stats {
@ -26,10 +28,10 @@
}
}
.editor {
height: 255px;
height: 240px;
}
.weapon-editor .editor {
height: 230px;
height: 215px;
}
}
}

View File

@ -78,8 +78,11 @@
"alignment": "",
"literate": false,
"level": 1,
"xp": 0,
"xpmod": 0
"xp": {
"next": 0,
"value": 0,
"bonus": 0
}
},
"scores": {
"str": {

View File

@ -23,6 +23,19 @@
/>
</div>
</div>
{{#if (eq this.type 'character')}}
<div class="form-group">
<label>{{localize "OSE.ExperienceBonus"}} (%)</label>
<div class="form-fields">
<input
type="text"
name="data.details.xp.bonus"
id="experience"
value="{{data.details.xp.bonus}}"
/>
</div>
</div>
{{/if}}
<footer class="sheet-footer">
<button type="submit">
<i class="fas fa-save"></i>{{localize "Save Changes"}}

View File

@ -1,46 +1,36 @@
<div class="flex3 panel abilities resizable" data-base-size="250">
<div class="panel-title">
<h4>{{localize 'OSE.panel.abilities'}}</h4>
<div class="inventory abilities">
<div class="item-titles flexrow">
<div class="item-name">{{localize 'OSE.panel.abilities'}}</div>
<div class="item-controls">
{{#if owner}}
<a
class="item-control item-create"
title='{{localize "OSE.Add"}}'
data-type="ability"
><i class="fas fa-plus"></i
></a>
<a class="item-control item-create" title='{{localize "OSE.Add"}}' data-type="ability"><i
class="fas fa-plus"></i></a>
{{/if}}
</div>
</div>
<ul class="panel-content inventory resizable" data-base-size="225">
<div class="">
{{#each abilities as |item|}}
<li class="item-entry">
<div class="item flexrow" data-item-id="{{item._id}}">
<div class="item-name flexrow">
<div
class="item-image"
style="background-image: url({{item.img}})"
></div>
<ol class="item-list resizable" data-base-size="310">
{{#each abilities as |item|}}
<li class="item-entry">
<div class="item flexrow" data-item-id="{{item._id}}">
<div class="item-name flexrow">
<div class="item-image" style="background-image: url({{item.img}})"></div>
<a>
<h4 title="{{item.name}}">
{{item.name~}}
</h4>
</div>
<div class="item-controls">
{{#if ../owner}}
<a class="item-control item-edit" title='{{localize "Ose.Edit"}}'
><i class="fas fa-edit"></i
></a>
<a
class="item-control item-delete"
title='{{localize "Ose.Delete"}}'
><i class="fas fa-trash"></i
></a>
{{/if}}
</div>
</a>
</div>
</li>
{{/each}}
</div>
</ul>
</div>
<div class="field-long">
{{item.roll}}
</div>
<div class="item-controls">
{{#if ../owner}}
<a class="item-control item-edit" title='{{localize "Ose.Edit"}}'><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title='{{localize "Ose.Delete"}}'><i class="fas fa-trash"></i></a>
{{/if}}
</div>
</div>
</li>
{{/each}}
</ol>
</div>

View File

@ -1,5 +1,12 @@
<section class="flexrow">
<ul class="attributes flexrow">
<li class="attribute">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.HitDice' }}">{{ localize "OSE.HitDiceShort" }}</h4>
<div class="attribute-value">
<input name="data.hp.hd" type="text" value="{{data.hp.hd}}" placeholder="0"
data-dtype="String" />
</div>
</li>
<li class="attribute health">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.Health' }}">{{ localize "OSE.HealthShort" }}
</h4>
@ -73,6 +80,7 @@
<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>
</li>
<li class="attribute ability-score" data-score="int">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.int.long' }}">
@ -80,6 +88,7 @@
<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>
</li>
<li class="attribute ability-score" data-score="wis">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.wis.long' }}">
@ -87,6 +96,7 @@
<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>
</li>
<li class="attribute ability-score" data-score="dex">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.dex.long' }}">
@ -94,6 +104,7 @@
<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>
</li>
<li class="attribute ability-score" data-score="con">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.con.long' }}">
@ -101,6 +112,7 @@
<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>
</li>
<li class="attribute ability-score" data-score="cha">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.cha.long' }}">
@ -108,6 +120,7 @@
<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>
</li>
</ul>
</div>

View File

@ -27,9 +27,12 @@
<label>{{localize 'OSE.Level'}}</label>
</li>
<li class="flex2">
<input type="text" name="data.details.xp" value="{{data.details.xp}}"
<input type="text" name="data.details.xp.value" value="{{data.details.xp.value}}"
placeholder="{{ localize 'OSE.Experience' }}" />
<label>{{localize 'OSE.Experience'}}</label>
{{#if data.details.xp.bonus}}
<span class="xp-bonus">+{{data.details.xp.bonus}}%</span>
{{/if}}
</li>
</ul>
</section>

View File

@ -9,9 +9,21 @@
</header>
<section class="sheet-body">
<div class="flexrow">
<input name="data.requirements" type="text" value="{{data.requirements}}" placeholder="Requirements" />
</div>
<div class="description weapon-editor">
<div class="stats">
<div class="form-group block-input">
<label>{{localize 'OSE.abilities.Requirements'}}</label>
<div class="form-fields">
<input type="text" name="data.requirements" value="{{data.requirements}}" data-dtype="String" />
</div>
</div>
<div class="form-group block-input">
<label>{{localize 'OSE.items.Roll'}}</label>
<div class="form-fields">
<input type="text" name="data.roll" value="{{data.roll}}" data-dtype="String" />
</div>
</div>
</div>
<div class="description">
{{editor content=data.description target="data.description" button=true
owner=owner editable=editable}}
</div>