Skip to content

Commit

Permalink
Rudimentary skill checks implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
constant-null committed Mar 29, 2024
1 parent d8c2c54 commit 9eb7517
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 3 deletions.
26 changes: 26 additions & 0 deletions efs.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
margin-left: 30px;
}

.clickable.regular {
font-weight: normal !important;
}

.skill {
margin: 12px 0;
}

.photo .picture {
object-fit: cover;
object-position: top;
Expand Down Expand Up @@ -132,11 +140,29 @@

.efs .editor {
height: 100%;
width: 100%;
}

.efs .editor .editor-content {
min-height: 200px;
}

.efs .editor .skill-desc.editor-content {
min-height: 100px;
min-width: 360px;
width: 360px;
position: relative;
}

.skills .editor-edit {
font-size: 18px;
z-index: 1;
}

.skills .editor-menu .text, .skills .editor-menu .source-code-edit {
display: none;
}

.efs.columns {
display: flex;
flex-direction: row;
Expand Down
5 changes: 4 additions & 1 deletion lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"Rank": "Ранг",
"Class": "Класс",
"Credits": "Кредиты",
"Skills": "Навыки",
"DP": "ОП"
},
"Item": {
Expand Down Expand Up @@ -43,7 +44,9 @@
},
"Message": {
"Uses": "Использует",
"InHeroicMoment": "В свой <b>Героический Момент</b>"
"InHeroicMoment": "В свой <b>Героический Момент</b>",
"SkillCheck": "Совершает проверку навыка",
"DifficultyX": "Сложность {diff}"
},
"HeroicMoment": "Героический Момент",
"Sheets": {
Expand Down
36 changes: 36 additions & 0 deletions module/sheets/efs-character-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,42 @@ export default class EFSCharacterSheet extends ActorSheet {
html.find(".clickable.approach").click(this._approachClicked.bind(this));
html.find(".heroic-mode").click(this._heroicModeClicked.bind(this));
html.find(".clickable#extra").click(this._showExtra.bind(this));
html.find(".skill-4").click(this._skill4Click.bind(this));
html.find(".skill-8").click(this._skill8Click.bind(this));
html.find(".skill-12").click(this._skill12Click.bind(this));
html.find(".skill-16").click(this._skill16Click.bind(this));
}

async _skill4Click(event) {
await this._skillCheck(4)
}
async _skill8Click(event) {
await this._skillCheck(8)
}
async _skill12Click(event) {
await this._skillCheck(12)
}
async _skill16Click(event) {
await this._skillCheck(16)
}

async _skillCheck(diff) {
let diffHint = game.i18n.localize("EFS.Message.DifficultyX").replace("{diff}", diff)
let r = await new Roll(`d20[${diffHint}]`).evaluate({async: true});
let skillLvls = {
4: "four",
8: "eight",
12: "twelve",
16: "sixteen"
}
let skillName = this.actor._system.skills[skillLvls[diff]]
let skillMessage = "<b>"+game.i18n.localize("EFS.Message.SkillCheck") +
`</b><div>${skillName}</div>`

await r.toMessage({
flavor: skillMessage,
speaker: ChatMessage.getSpeaker({actor: this.actor})
});
}

async _showExtra(event) {
Expand Down
6 changes: 6 additions & 0 deletions template.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
"smart": 0,
"charismatic": 0
},
"skills": {
"four": "",
"eight": "",
"twelve": "",
"sixteen": ""
},
"extra": {
"description": ""
}
Expand Down
27 changes: 25 additions & 2 deletions templates/sheets/efs-character-sheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@
<span class="label">{{ localize 'EFS.Character.Credits' }}</span>
<input name="data.credits" class="text-input" value="{{data.credits}}"/>
</div>
<br/>
<div class="flex skills">
<span class="label">{{ localize 'EFS.Character.Skills' }}</span>
<div class="flex row">
<span class="skill skill-4 clickable">4:</span>
{{editor data.skills.four target="system.skills.four" class="skill-4 clickable regular skill-desc" button=true editable=true engine="prosemirror"}}
</div>
<div class="flex row">
<span class="skill skill-8 clickable">8:</span>
{{editor data.skills.eight target="system.skills.eight" class="skill-8 clickable regular skill-desc" button=true editable=true engine="prosemirror"}}
</div>
<div class="flex row">
<span class="skill skill-12 clickable">12:</span>
{{editor data.skills.twelve target="system.skills.twelve" class="skill-12 clickable regular skill-desc" button=true editable=true engine="prosemirror"}}
</div>
<div class="flex row">
<span class="skill skill-16 clickable">16:</span>
{{editor data.skills.sixteen target="system.skills.sixteen" class="skill-16 clickable regular skill-desc" button=true editable=true engine="prosemirror"}}
</div>
</div>
</div>
<div class="flex photo">
<div class="flex">
Expand All @@ -38,7 +58,9 @@
<div class="photo-info">
<div class="dp">
<span class="label">
{{ localize 'EFS.Character.DP' }} ({{ localize 'EFS.Max' }}<input name="data.dp.max" class="text-input short" value="{{data.dp.max}}"/>)
{{ localize 'EFS.Character.DP' }} ({{ localize 'EFS.Max' }}<input name="data.dp.max"
class="text-input short"
value="{{data.dp.max}}"/>)
</span>
<input name="data.defeatPoints" class="text-input short" value="{{data.defeatPoints}}"/>
</div>
Expand Down Expand Up @@ -102,6 +124,7 @@
</div>
</div>
<br/>
<span id="extra" class="label clickable">{{ localize 'EFS.Extra' }} <span class="fa fa-caret-right"></span></span>
<span id="extra" class="label clickable">{{ localize 'EFS.Extra' }} <span
class="fa fa-caret-right"></span></span>
</section>
</form>

0 comments on commit 9eb7517

Please sign in to comment.