Enhance sheets
This commit is contained in:
@@ -38,6 +38,10 @@ export class Hero6ActorSheet extends ActorSheet {
|
||||
characteristics: this.actor.prepareCharac(),
|
||||
limited: this.object.limited,
|
||||
skills: this.actor.getSkills( ),
|
||||
perks: this.actor.getPerks( ),
|
||||
powers: this.actor.getPowers( ),
|
||||
talents: this.actor.getTalents( ),
|
||||
complications: this.actor.getComplications( ),
|
||||
weapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getWeapons()) ),
|
||||
armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())),
|
||||
shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields())),
|
||||
@@ -50,7 +54,16 @@ export class Hero6ActorSheet extends ActorSheet {
|
||||
moneys: duplicate(this.actor.getMoneys()),
|
||||
encCapacity: this.actor.getEncumbranceCapacity(),
|
||||
description: await TextEditor.enrichHTML(this.object.system.biodata.description, {async: true}),
|
||||
notes: await TextEditor.enrichHTML(this.object.system.biodata.notes, {async: true}),
|
||||
motivation: await TextEditor.enrichHTML(this.object.system.biodata.motivation, {async: true}),
|
||||
quote: await TextEditor.enrichHTML(this.object.system.biodata.quote, {async: true}),
|
||||
tactics: await TextEditor.enrichHTML(this.object.system.biodata.tactics, {async: true}),
|
||||
campaignuse: await TextEditor.enrichHTML(this.object.system.biodata.campaignuse, {async: true}),
|
||||
appearance: await TextEditor.enrichHTML(this.object.system.biodata.appearance, {async: true}),
|
||||
notes1: await TextEditor.enrichHTML(this.object.system.biodata.notes1, {async: true}),
|
||||
notes2: await TextEditor.enrichHTML(this.object.system.biodata.notes2, {async: true}),
|
||||
notes3: await TextEditor.enrichHTML(this.object.system.biodata.notes3, {async: true}),
|
||||
notes4: await TextEditor.enrichHTML(this.object.system.biodata.notes4, {async: true}),
|
||||
notes5: await TextEditor.enrichHTML(this.object.system.biodata.notes5, {async: true}),
|
||||
containersTree: this.actor.containersTree,
|
||||
encCurrent: this.actor.encCurrent,
|
||||
options: this.options,
|
||||
@@ -139,7 +152,12 @@ export class Hero6ActorSheet extends ActorSheet {
|
||||
const characKey = $(event.currentTarget).data("charac-key");
|
||||
this.actor.rollCharac(characKey);
|
||||
});
|
||||
|
||||
html.find('.roll-item').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
let itemId = li.data("item-id")
|
||||
this.actor.rollItem(itemId);
|
||||
});
|
||||
|
||||
html.find('.roll-weapon').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
const skillId = li.data("item-id")
|
||||
|
@@ -170,6 +170,26 @@ export class Hero6Actor extends Actor {
|
||||
Hero6Utility.sortArrayObjectsByName(comp)
|
||||
return comp
|
||||
}
|
||||
getPerks() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'perk') || [])
|
||||
Hero6Utility.sortArrayObjectsByName(comp)
|
||||
return comp
|
||||
}
|
||||
getPowers() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'power') || [])
|
||||
Hero6Utility.sortArrayObjectsByName(comp)
|
||||
return comp
|
||||
}
|
||||
getTalents() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'talent') || [])
|
||||
Hero6Utility.sortArrayObjectsByName(comp)
|
||||
return comp
|
||||
}
|
||||
getComplications() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'complication') || [])
|
||||
Hero6Utility.sortArrayObjectsByName(comp)
|
||||
return comp
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async equipItem(itemId) {
|
||||
@@ -341,8 +361,8 @@ export class Hero6Actor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
prepareCharacValues( charac) {
|
||||
charac.total = charac.base+charac.value
|
||||
charac.roll = 9 + Math.floor((charac.base+charac.value)/5)
|
||||
charac.total = charac.value
|
||||
charac.roll = 9 + Math.floor((charac.value)/5)
|
||||
}
|
||||
prepareCharac() {
|
||||
let characs = duplicate(this.system.characteristics)
|
||||
@@ -444,6 +464,14 @@ export class Hero6Actor extends Actor {
|
||||
}
|
||||
this.startRoll(rollData)
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
rollItem(itemId) {
|
||||
let item = this.items.get( itemId)
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.mode = "item"
|
||||
rollData.item = duplicate(item)
|
||||
this.startRoll(rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollSkill(skillId) {
|
||||
|
@@ -154,6 +154,7 @@ export class Hero6Utility {
|
||||
'systems/fvtt-hero-system-6/templates/partials/editor-notes-gm.hbs',
|
||||
'systems/fvtt-hero-system-6/templates/partials/partial-roll-select.hbs',
|
||||
'systems/fvtt-hero-system-6/templates/partials/partial-actor-characteristic-block.hbs',
|
||||
'systems/fvtt-hero-system-6/templates/partials/partial-actor-full-charac.hbs',
|
||||
'systems/fvtt-hero-system-6/templates/partials/partial-actor-status.hbs',
|
||||
'systems/fvtt-hero-system-6/templates/partials/partial-options-abilities.hbs',
|
||||
'systems/fvtt-hero-system-6/templates/partials/partial-item-nav.hbs',
|
||||
@@ -301,6 +302,9 @@ export class Hero6Utility {
|
||||
if (rollData.charac) {
|
||||
target = rollData.charac.roll
|
||||
}
|
||||
if (rollData.item) {
|
||||
target = rollData.item.system.roll
|
||||
}
|
||||
|
||||
// Performs roll
|
||||
console.log("Roll formula", diceFormula)
|
||||
@@ -323,6 +327,9 @@ export class Hero6Utility {
|
||||
if ( myRoll.terms[0].total == 18) { // Always a failure
|
||||
rollData.isSuccess = false
|
||||
}
|
||||
if (rollData.isSuccess ) {
|
||||
rollData.margin = target - rollData.result
|
||||
}
|
||||
|
||||
let msg = await this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-hero-system-6/templates/chat/chat-generic-result.hbs`, rollData)
|
||||
|
Reference in New Issue
Block a user