Add crafting skills
This commit is contained in:
@@ -45,6 +45,7 @@ export class Avd12ActorSheet extends ActorSheet {
|
||||
equippedWeapons: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getEquippedWeapons()) ),
|
||||
equippedArmor: this.actor.getEquippedArmor(),
|
||||
equippedShield: this.actor.getEquippedShield(),
|
||||
craftingSkills: this.actor.getCraftingSkills(),
|
||||
subActors: duplicate(this.actor.getSubActors()),
|
||||
moneys: duplicate(this.actor.getMoneys()),
|
||||
focusData: this.actor.computeFinalFocusData(),
|
||||
@@ -129,6 +130,11 @@ export class Avd12ActorSheet extends ActorSheet {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
this.actor.rollSpell( li.data("item-id") )
|
||||
});
|
||||
html.find('.roll-crafting').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
this.actor.rollCrafting( li.data("item-id") )
|
||||
});
|
||||
|
||||
|
||||
html.find('.roll-weapon').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
|
||||
@@ -176,7 +176,12 @@ export class Avd12Actor extends Actor {
|
||||
Avd12Utility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getCraftingSkills() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'craftingskill') || [])
|
||||
Avd12Utility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getArmors() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'armor') || []);
|
||||
@@ -705,7 +710,20 @@ export class Avd12Actor extends Actor {
|
||||
console.log("New fovcus", this.system, focusData)
|
||||
this.update({ 'system.focus': focusData })
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollCrafting(craftId) {
|
||||
let crafting = this.items.get(craftId)
|
||||
if (crafting) {
|
||||
crafting = duplicate(crafting)
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.mode = "crafting"
|
||||
rollData.crafting = crafting
|
||||
rollData.img = crafting.img
|
||||
this.startRoll(rollData)
|
||||
} else {
|
||||
ui.notifications.warn("Unable to find the relevant weapon ")
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
rollWeapon(weaponId) {
|
||||
let weapon = this.items.get(weaponId)
|
||||
@@ -722,6 +740,7 @@ export class Avd12Actor extends Actor {
|
||||
ui.notifications.warn("Unable to find the relevant weapon ")
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollWeaponDamage(weaponId, damageType) {
|
||||
let weapon = this.items.get(weaponId)
|
||||
|
||||
@@ -9,6 +9,7 @@ export const defaultItemImg = {
|
||||
module: "systems/fvtt-avd12/images/icons/focus2.webp",
|
||||
money: "systems/fvtt-avd12/images/icons/focus2.webp",
|
||||
spell: "systems/fvtt-avd12/images/icons/spell1.webp",
|
||||
craftingskill: "systems/fvtt-avd12/images/icons/cloak2.webp",
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -528,6 +528,9 @@ export class Avd12Utility {
|
||||
if (rollData.skill) {
|
||||
diceFormula += "+" + rollData.skill.finalvalue
|
||||
}
|
||||
if (rollData.crafting) {
|
||||
diceFormula += "+" + rollData.crafting.system.level
|
||||
}
|
||||
if (rollData.spellAttack) {
|
||||
diceFormula += "+" + rollData.spellAttack
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user