Better rolls + perks

This commit is contained in:
LeRatierBretonnien 2023-01-02 14:54:59 +01:00
parent 7ceada98fb
commit 2da3d19dbe
6 changed files with 55 additions and 13 deletions

View File

@ -38,6 +38,7 @@ export class DarkStarsActorSheet extends ActorSheet {
system: actorData, system: actorData,
limited: this.object.limited, limited: this.object.limited,
skills: this.actor.getSkills( ), skills: this.actor.getSkills( ),
perks: this.actor.getPerks( ),
weapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getWeapons()) ), weapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getWeapons()) ),
armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())), armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())),
shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields())), shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields())),

View File

@ -202,6 +202,13 @@ export class DarkStarsActor extends Actor {
DarkStarsUtility.sortArrayObjectsByName(comp) DarkStarsUtility.sortArrayObjectsByName(comp)
return comp return comp
} }
/* -------------------------------------------- */
getPerks() {
let comp = duplicate(this.items.filter(item => item.type == 'perk') || [])
DarkStarsUtility.sortArrayObjectsByName(comp)
return comp
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async equipItem(itemId) { async equipItem(itemId) {
@ -567,10 +574,6 @@ export class DarkStarsActor extends Actor {
rollSkill(skillId) { rollSkill(skillId) {
let skill = this.items.get(skillId) let skill = this.items.get(skillId)
if (skill) { if (skill) {
if (skill.system.islore && skill.system.level == 0) {
ui.notifications.warn("You can't use Lore Skills with a SL of 0.")
return
}
skill = duplicate(skill) skill = duplicate(skill)
this.updateSkill(skill) this.updateSkill(skill)
let rollData = this.getCommonRollData() let rollData = this.getCommonRollData()

View File

@ -271,8 +271,11 @@ export class DarkStarsUtility {
} }
rollData.roll = myRoll rollData.roll = myRoll
rollData.diceResult = myRoll.total rollData.diceResult = myRoll.total
rollData.isSuccess = rollData.diceResult <= rollData.percentValue rollData.isCriticalSuccess = rollData.diceResult <= rollData.skill.derivated.value
rollData.isFailure = rollData.diceResult > rollData.percentValue rollData.isCriticalFailure = rollData.diceResult == 100
rollData.isSuccess = rollData.diceResult == 1 || rollData.diceResult <= rollData.percentValue
rollData.isFailure = rollData.diceResult == 100 || rollData.diceResult > rollData.percentValue
rollData.degrees = Math.floor(rollData.percentValue/10) - Math.floor(rollData.diceResult/10)
let msg = await this.createChatWithRollMode(rollData.alias, { let msg = await this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-dark-stars/templates/chat/chat-generic-result.hbs`, rollData) content: await renderTemplate(`systems/fvtt-dark-stars/templates/chat/chat-generic-result.hbs`, rollData)

View File

@ -100,7 +100,7 @@
"styles": [ "styles": [
"styles/simple.css" "styles/simple.css"
], ],
"version": "10.0.13", "version": "10.0.14",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",
"verified": "10", "verified": "10",
@ -108,7 +108,7 @@
}, },
"title": "Dark Stars RPG", "title": "Dark Stars RPG",
"manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-dark-stars/raw/branch/main/system.json", "manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-dark-stars/raw/branch/main/system.json",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-dark-stars/archive/fvtt-dark-stars-v10.0.13.zip", "download": "https://www.uberwald.me/gitea/uberwald/fvtt-dark-stars/archive/fvtt-dark-stars-v10.0.14.zip",
"url": "https://www.uberwald.me/gitea/uberwald/", "url": "https://www.uberwald.me/gitea/uberwald/",
"background": "images/ui/dark_stars_welcome_page.webp", "background": "images/ui/dark_stars_welcome_page.webp",
"id": "fvtt-dark-stars" "id": "fvtt-dark-stars"

View File

@ -16,6 +16,7 @@
<nav class="sheet-tabs tabs" data-group="primary"> <nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="main">Main</a> <a class="item" data-tab="main">Main</a>
<a class="item" data-tab="skills">Skills</a> <a class="item" data-tab="skills">Skills</a>
<a class="item" data-tab="perks">Perks</a>
<a class="item" data-tab="combat">Combat</a> <a class="item" data-tab="combat">Combat</a>
<a class="item" data-tab="equipment">Equipment</a> <a class="item" data-tab="equipment">Equipment</a>
<a class="item" data-tab="biodata">Biography</a> <a class="item" data-tab="biodata">Biography</a>
@ -112,6 +113,32 @@
</div> </div>
{{!-- Perks Tab --}}
<div class="tab perks" data-group="primary" data-tab="perks">
<ul class="alternate-list item-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header-long2">
<h3><label class="items-title-text">Perks</label></h3>
</span>
<span class="item-field-label-medium">
<label class="short-label">&nbsp;</label>
</span>
</li>
{{#each perks as |perk key|}}
<li class="item flexrow list-item list-item-shadow" data-item-id="{{perk._id}}">
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img" src="{{perk.img}}" />
</a>
<span class="item-field-label-vlong2">{{perk.name}}</span>
<div class="item-controls item-controls-fixed">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</div>
{{!-- Combat Tab --}} {{!-- Combat Tab --}}
<div class="tab combat" data-group="primary" data-tab="combat"> <div class="tab combat" data-group="primary" data-tab="combat">
<div class="flexcol"> <div class="flexcol">

View File

@ -27,14 +27,22 @@
</li> </li>
<li> Result: {{diceResult}} <li> Result: {{diceResult}}
</li> </li>
<li> Degrees: {{degrees}}
</li>
{{#if isSuccess}} {{#if isCriticalSuccess}}
<li><strong>Success !</strong></li> <li><strong>Critical Success !</strong></li>
{{else}} {{else}}
<li><strong>Failure ...</strong></li> {{#if isSuccess}}
<li><strong>Success !</strong></li>
{{else}}
{{#if isCriticalFailure}}
<li><strong>Critical Failure !</strong></li>
{{else}}
<li><strong>Failure ...</strong></li>
{{/if}}
{{/if}}
{{/if}} {{/if}}
<!-- <button class="chat-card-button reroll-level-remaining" data-roll-id="{{rollId}}">Reroll</button> -->
</ul> </ul>
</div> </div>