Adds skills and how to add them to the sheet
This commit is contained in:
parent
403109921c
commit
0f06d4020b
|
|
@ -136,5 +136,12 @@
|
|||
"midgard5.spellBonus": "Zauberbonus",
|
||||
"midgard5.brawl": "Raufen",
|
||||
"midgard5.poisonResistance": "Giftresistenz",
|
||||
"midgard5.enduranceBonus": "Ausdauerbonus"
|
||||
"midgard5.enduranceBonus": "Ausdauerbonus",
|
||||
|
||||
"midgard5.new-skill": "Neue Fertigkeit",
|
||||
"midgard5.special": "Spezial",
|
||||
"midgard5.learned-skill": "Gelernte Fertigkeit",
|
||||
"midgard5.language": "Sprache",
|
||||
"midgard5.weapon-skill": "Waffenfertigkeit",
|
||||
"midgard5.unlearned-skill": "Ungelernte Fertigkeit"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ const preloadTemplates = async (): Promise<Handlebars.TemplateDelegate<any>[]> =
|
|||
// This would map to our local folder of /Assets/Templates/Actor/actor-sheet.hbs
|
||||
const templates: Array<string> = [
|
||||
"sheets/character/base_values.hbs",
|
||||
"sheets/character/skills.hbs"
|
||||
"sheets/character/skills.hbs",
|
||||
"sheets/character/gear.hbs"
|
||||
]
|
||||
return loadTemplates(templates.map(s => rootPath + s))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,10 @@ Hooks.once("init", async () => {
|
|||
return actor.skillEw(skill).toString()
|
||||
})
|
||||
|
||||
Handlebars.registerHelper("skill", (skillId: string) => {
|
||||
return (game as Game).items.get(skillId)
|
||||
})
|
||||
|
||||
// Default Sheet für Items definieren und das Standardsheet deaktivieren
|
||||
Items.unregisterSheet("core", ItemSheet)
|
||||
Items.registerSheet("midgard5", M5ItemSheet, { makeDefault: true })
|
||||
|
|
|
|||
|
|
@ -17,3 +17,10 @@ export interface M5Attribute {
|
|||
value: number
|
||||
bonus: number
|
||||
}
|
||||
|
||||
export interface M5RollData {
|
||||
c: any,
|
||||
i: any,
|
||||
rolls: any,
|
||||
res: any
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,33 @@
|
|||
import { M5Attribute, M5Skill, M5SkillLearned } from "../M5Base"
|
||||
import { M5Item } from "../items/M5Item"
|
||||
import { M5Attribute, M5RollData, M5Skill, M5SkillLearned } from "../M5Base"
|
||||
|
||||
export interface M5CharacterCalculatedData {
|
||||
level: number,
|
||||
level: number
|
||||
attributes: {
|
||||
st: { value: number, bonus: number }
|
||||
gs: { value: number, bonus: number }
|
||||
gw: { value: number, bonus: number }
|
||||
ko: { value: number, bonus: number }
|
||||
in: { value: number, bonus: number }
|
||||
zt: { value: number, bonus: number }
|
||||
au: { value: number, bonus: number }
|
||||
pa: { value: number, bonus: number }
|
||||
wk: { value: number, bonus: number }
|
||||
}
|
||||
stats: {
|
||||
armor: number,
|
||||
defense: number,
|
||||
damageBonus: number,
|
||||
attackBonus: number,
|
||||
defenseBonus: number,
|
||||
movementBonus: number,
|
||||
resistanceMind: number,
|
||||
resistanceBody: number,
|
||||
spellCasting: number,
|
||||
brawl: number,
|
||||
poisonResistance: number,
|
||||
armor: number
|
||||
defense: number
|
||||
damageBonus: number
|
||||
attackBonus: number
|
||||
defenseBonus: number
|
||||
movementBonus: number
|
||||
resistanceMind: number
|
||||
resistanceBody: number
|
||||
spellCasting: number
|
||||
brawl: number
|
||||
poisonResistance: number
|
||||
enduranceBonus: number
|
||||
},
|
||||
}
|
||||
skills: {
|
||||
general: {}
|
||||
}
|
||||
|
|
@ -49,10 +61,21 @@ export class M5Character extends Actor {
|
|||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
const context = (this as any).data;
|
||||
const context = (this as any).data
|
||||
|
||||
context.data.calc = {
|
||||
level: 0,
|
||||
attributes: {
|
||||
st: { value: 0, bonus: 0 },
|
||||
gs: { value: 0, bonus: 0 },
|
||||
gw: { value: 0, bonus: 0 },
|
||||
ko: { value: 0, bonus: 0 },
|
||||
in: { value: 0, bonus: 0 },
|
||||
zt: { value: 0, bonus: 0 },
|
||||
au: { value: 0, bonus: 0 },
|
||||
pa: { value: 0, bonus: 0 },
|
||||
wk: { value: 0, bonus: 0 }
|
||||
},
|
||||
stats: {
|
||||
armor: 0,
|
||||
defense: 0,
|
||||
|
|
@ -68,41 +91,71 @@ export class M5Character extends Actor {
|
|||
enduranceBonus: 0
|
||||
},
|
||||
skills: {
|
||||
general: {}
|
||||
general: {},
|
||||
combat: {},
|
||||
language: {},
|
||||
custom: {}
|
||||
}
|
||||
} as M5CharacterCalculatedData
|
||||
|
||||
const data = context.data
|
||||
const st = M5Character.attributeMinMax(data.attributes.st)
|
||||
const gs = M5Character.attributeMinMax(data.attributes.gs)
|
||||
const gw = M5Character.attributeMinMax(data.attributes.gw)
|
||||
const ko = M5Character.attributeMinMax(data.attributes.ko)
|
||||
|
||||
const calc = context.data.calc as M5CharacterCalculatedData
|
||||
calc.level = M5Character.levelFromExp(data.es)
|
||||
|
||||
calc.attributes.st.value = M5Character.attributeMinMax(data.attributes.st) // TODO item effects
|
||||
calc.attributes.gs.value = M5Character.attributeMinMax(data.attributes.gs)
|
||||
calc.attributes.gw.value = M5Character.attributeMinMax(data.attributes.gw)
|
||||
calc.attributes.ko.value = M5Character.attributeMinMax(data.attributes.ko)
|
||||
calc.attributes.in.value = M5Character.attributeMinMax(data.attributes.in)
|
||||
calc.attributes.zt.value = M5Character.attributeMinMax(data.attributes.zt)
|
||||
calc.attributes.au.value = M5Character.attributeMinMax(data.attributes.au)
|
||||
calc.attributes.pa.value = M5Character.attributeMinMax(data.attributes.pa)
|
||||
calc.attributes.wk.value = M5Character.attributeMinMax(data.attributes.wk)
|
||||
|
||||
calc.attributes.st.bonus = M5Character.attributeBonus(data.attributes.st)
|
||||
calc.attributes.gs.bonus = M5Character.attributeBonus(data.attributes.gs)
|
||||
calc.attributes.gw.bonus = M5Character.attributeBonus(data.attributes.gw)
|
||||
calc.attributes.ko.bonus = M5Character.attributeBonus(data.attributes.ko)
|
||||
calc.attributes.in.bonus = M5Character.attributeBonus(data.attributes.in)
|
||||
calc.attributes.zt.bonus = M5Character.attributeBonus(data.attributes.zt)
|
||||
calc.attributes.au.bonus = M5Character.attributeBonus(data.attributes.au)
|
||||
calc.attributes.pa.bonus = M5Character.attributeBonus(data.attributes.pa)
|
||||
calc.attributes.wk.bonus = M5Character.attributeBonus(data.attributes.wk)
|
||||
|
||||
calc.stats.armor = 0
|
||||
calc.stats.defense = M5Character.defenseFromLevel(calc.level)
|
||||
calc.stats.damageBonus = Math.floor(st/20) + Math.floor(gs/30) - 3
|
||||
calc.stats.attackBonus = M5Character.attributeBonus(data.attributes.gs)
|
||||
calc.stats.defenseBonus = M5Character.attributeBonus(data.attributes.gw)
|
||||
calc.stats.damageBonus = Math.floor(calc.attributes.st.value/20) + Math.floor(calc.attributes.gs.value/30) - 3
|
||||
calc.stats.attackBonus = calc.attributes.gs.bonus
|
||||
calc.stats.defenseBonus = calc.attributes.gw.bonus
|
||||
calc.stats.movementBonus = 0
|
||||
calc.stats.resistanceMind = calc.stats.defense
|
||||
calc.stats.resistanceBody = calc.stats.defense + 1
|
||||
calc.stats.spellCasting = (data.info.magicUsing ? M5Character.spellCastingFromLevel(calc.level) : 3) + M5Character.attributeBonus(data.attributes.zt)
|
||||
calc.stats.brawl = Math.floor((st + gw) / 20)
|
||||
calc.stats.poisonResistance = 30 + Math.floor(ko / 2)
|
||||
calc.stats.enduranceBonus = Math.floor(ko/10) + Math.floor(st/20)
|
||||
calc.stats.spellCasting = (data.info.magicUsing ? M5Character.spellCastingFromLevel(calc.level) : 3) + calc.attributes.zt.bonus
|
||||
calc.stats.brawl = Math.floor((calc.attributes.st.value + calc.attributes.gw.value) / 20)
|
||||
calc.stats.poisonResistance = 30 + Math.floor(calc.attributes.ko.value / 2)
|
||||
calc.stats.enduranceBonus = Math.floor(calc.attributes.ko.value/10) + Math.floor(calc.attributes.st.value/20)
|
||||
|
||||
//console.log("prepareDerivedData", context)
|
||||
context.items?.filter(item => item.data.type === "skill").forEach(item => {
|
||||
calc.skills.general[item.data.name] = {
|
||||
item.prepareDerivedData()
|
||||
const skillMap = calc.skills[item.data.data.type]
|
||||
skillMap[item.data._id] = {
|
||||
label: item.data.name,
|
||||
fw: item.data.data.fw,
|
||||
attribute: item.data.data.attribute,
|
||||
id: item.data._id
|
||||
calc: item.data.data.calc
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override getRollData(): any {
|
||||
return {
|
||||
c: (this as any).data.data,
|
||||
i: null,
|
||||
rolls: {},
|
||||
res: {}
|
||||
} as M5RollData
|
||||
}
|
||||
|
||||
static readonly levelThreshold: Array<number> = [0, 100, 250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 6000, 7000, 8000, 9000, 10000, 12500, 15000, 17500, 20000, 22500, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000, 70000, 75000, 80000, 85000, 90000, 95000, 100000, 105000, 110000, 115000, 120000, 125000, 130000, 135000, 140000, 145000, 150000, 155000, 160000, 165000, 170000, 175000, 180000, 185000, 190000, 195000, 200000, 205000, 210000, 215000, 220000, 225000, 230000, 235000, 240000, 245000, 250000, 255000, 260000, 265000, 270000, 275000, 280000]
|
||||
static levelFromExp(exp: number): number {
|
||||
const ret = M5Character.levelThreshold.findIndex(val => val > exp)
|
||||
|
|
@ -155,4 +208,16 @@ export class M5Character extends Actor {
|
|||
return context.data.attributes[name]
|
||||
}
|
||||
|
||||
createSkill(skillName: string): Promise<M5Item> {
|
||||
const itemData = {
|
||||
name: skillName,
|
||||
type: "skill"
|
||||
};
|
||||
|
||||
return (this as any).createEmbeddedDocuments("Item", [itemData]).then(docs => {
|
||||
const item = docs[0]
|
||||
return item as M5Item
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,45 @@
|
|||
import { M5Character } from "../actors/M5Character"
|
||||
import { M5Skill } from "../M5Base"
|
||||
import { M5RollData, M5Skill } from "../M5Base"
|
||||
|
||||
export class M5Item extends Item {
|
||||
static readonly SKILL = "skill"
|
||||
|
||||
getRollData() {
|
||||
if (!this.actor)
|
||||
return null
|
||||
prepareDerivedData() {
|
||||
const actor = (this.actor as any)
|
||||
const character = actor as M5Character
|
||||
const context = (this as any).data
|
||||
const calc = context.data.calc
|
||||
|
||||
if (context.type === "skill") {
|
||||
calc.bonus = 0
|
||||
|
||||
if (context.data.attribute && context.data.attribute !== "") {
|
||||
//console.log(context.name, context.data)
|
||||
const attribute = character.attribute(context.data.attribute)
|
||||
calc.bonus += M5Character.attributeBonus(attribute)
|
||||
}
|
||||
|
||||
if (context._id === actor.data.data.skills.preferredCombatSkill) {
|
||||
calc.bonus += 2
|
||||
}
|
||||
|
||||
calc.ew = context.data.fw + calc.bonus
|
||||
} else if (context.type === "weapon") {
|
||||
}
|
||||
}
|
||||
|
||||
getRollData() {
|
||||
const actor = this.actor as any
|
||||
const context = (this as any).data
|
||||
|
||||
let ret = null
|
||||
if (context.type === "skill") {
|
||||
const character = actor as M5Character
|
||||
const actorData = actor.data.data
|
||||
const itemData = context.data as M5Skill
|
||||
|
||||
ret = {
|
||||
fw: itemData.fw,
|
||||
bonus: M5Character.attributeBonus(character.attribute(itemData.attribute))
|
||||
}
|
||||
} else {
|
||||
ret = actor.getRollData()
|
||||
ret.item = foundry.utils.deepClone(context.data)
|
||||
let ret: M5RollData = actor?.getRollData() ?? {
|
||||
c: null,
|
||||
i: null,
|
||||
rolls: {},
|
||||
res: {}
|
||||
}
|
||||
|
||||
ret.i = context.data
|
||||
return ret
|
||||
}
|
||||
|
||||
|
|
@ -38,27 +52,32 @@ export class M5Item extends Item {
|
|||
const label = `[${item.type}] ${item.name}`
|
||||
|
||||
// If there's no roll data, send a chat message.
|
||||
if (!item.data.formula) {
|
||||
const formulaNames = item.data.rolls?.formulas ? Object.keys(item.data.rolls.formulas) : []
|
||||
if (formulaNames.length > 0) {
|
||||
const rollData = this.getRollData()
|
||||
let ret = []
|
||||
|
||||
formulaNames.forEach(formulaName => {
|
||||
const formula = item.data.rolls.formulas[formulaName]
|
||||
const roll = new Roll(formula.formula, rollData)
|
||||
|
||||
roll.toMessage({
|
||||
speaker: speaker,
|
||||
rollMode: rollMode,
|
||||
flavor: label,
|
||||
})
|
||||
ret.push(roll)
|
||||
})
|
||||
|
||||
return ret
|
||||
} else {
|
||||
ChatMessage.create({
|
||||
speaker: speaker,
|
||||
rollMode: rollMode,
|
||||
flavor: label,
|
||||
content: item.data.description ?? ''
|
||||
})
|
||||
} else { // Otherwise, create a roll and send a chat message from it.
|
||||
// Retrieve roll data.
|
||||
const rollData = this.getRollData()
|
||||
|
||||
// Invoke the roll and submit it to chat.
|
||||
const roll = new Roll(item.data.formula, rollData)
|
||||
// If you need to store the value first, uncomment the next line.
|
||||
// let result = await roll.roll({async: true})
|
||||
roll.toMessage({
|
||||
speaker: speaker,
|
||||
rollMode: rollMode,
|
||||
flavor: label,
|
||||
})
|
||||
return roll
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
return mergeObject(super.defaultOptions, {
|
||||
template: "systems/midgard5/templates/sheets/character/main.hbs",
|
||||
width: 600,
|
||||
height: 400,
|
||||
height: 800,
|
||||
classes: ["midgard5", "sheet", "character"],
|
||||
tabs: [{ navSelector: ".sheet-navigation", contentSelector: ".sheet-content", initial: "base_values" }]
|
||||
})
|
||||
|
|
@ -46,6 +46,20 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
item.sheet.render(true)
|
||||
})
|
||||
|
||||
html.find(".change-special-combat-skill").on("click", async (event) => {
|
||||
const row = event.target.parentElement.parentElement
|
||||
let skillId = row.dataset["skill"]
|
||||
|
||||
const actor = this.actor as any
|
||||
actor.update({
|
||||
data: {
|
||||
skills: {
|
||||
preferredCombatSkill: skillId
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
html.find(".roll-learned-button").on("click", async (event) => {
|
||||
const row = event.target.parentElement.parentElement
|
||||
let skillId = row.dataset["skill"]
|
||||
|
|
@ -58,6 +72,24 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
await item.roll()
|
||||
})
|
||||
|
||||
html.find(".create-skill-button").on("click", async (event) => {
|
||||
const button = event.target
|
||||
const skillType = button.dataset["skilltype"]
|
||||
|
||||
const character = this.actor as M5Character
|
||||
character.createSkill((game as Game).i18n.localize("midgard5.new-skill")).then(skill => {
|
||||
const item = skill as any
|
||||
item.update({
|
||||
data: {
|
||||
fw: 5,
|
||||
attribute: "",
|
||||
skill: "",
|
||||
type: skillType
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
html.find(".roll-general-button").on("click", async (event) => {
|
||||
const row = event.target.parentElement.parentElement
|
||||
let skillName = row.dataset["skill"]
|
||||
|
|
@ -93,30 +125,89 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
const data = this.actor.data.data
|
||||
const unlearnedSkill = data.skills.general[skillName] as M5SkillUnlearned
|
||||
|
||||
const itemData = {
|
||||
name: (game as Game).i18n.localize("midgard5." + skillName),
|
||||
type: "skill",
|
||||
const character = this.actor as M5Character
|
||||
character.createSkill((game as Game).i18n.localize("midgard5." + skillName)).then(skill => {
|
||||
const item = skill as any
|
||||
item.update({
|
||||
data: {
|
||||
fw: unlearnedSkill.initial,
|
||||
attribute: unlearnedSkill.attribute,
|
||||
skill: skillName,
|
||||
type: "general"
|
||||
} as M5SkillLearned
|
||||
}
|
||||
|
||||
this.actor.createEmbeddedDocuments("Item", [itemData]).then(docs => {
|
||||
const item = docs[0]
|
||||
//console.log("createEmbeddedDocuments", item.data)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
// Drag & Drop
|
||||
// const dragDropSkill = new DragDrop({
|
||||
// dragSelector: ".items-list .item",
|
||||
// dropSelector: ".sheet-body",
|
||||
// permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) },
|
||||
// callbacks: { dragstart: this._onTransferItemDragStart.bind(this), drop: this._onTransferItemDrop.bind(this) },
|
||||
// })
|
||||
// dragDrop.bind(html[0])
|
||||
const dragDrop = new DragDrop({
|
||||
dragSelector: ".items-list .item",
|
||||
dropSelector: ".sheet-body",
|
||||
permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) },
|
||||
callbacks: { dragstart: this._onTransferItemDragStart.bind(this), drop: this._onTransferItemDrop.bind(this) },
|
||||
})
|
||||
dragDrop.bind(html[0])
|
||||
}
|
||||
|
||||
_canDragStart(selector) {
|
||||
return this.options.editable && this.actor.isOwner;
|
||||
}
|
||||
|
||||
_canDragDrop(selector) {
|
||||
return true;
|
||||
}
|
||||
|
||||
_onTransferItemDragStart(event) {
|
||||
const li = event.currentTarget
|
||||
$(event.currentTarget).attr("data-item-actorid", this.actor.id)
|
||||
const item = this.actor.items.get(li.dataset.itemId)
|
||||
|
||||
// limit transfer on personal weapons/armour/gear
|
||||
if (["weapon"].includes(item.data.type)) {
|
||||
const dragData = {
|
||||
type: "Transfer",
|
||||
actorId: this.actor.id,
|
||||
data: item.data,
|
||||
tokenId: null
|
||||
}
|
||||
|
||||
if (this.actor.isToken)
|
||||
dragData.tokenId = this.actor.token.id
|
||||
|
||||
event.dataTransfer.setData("text/plain", JSON.stringify(dragData))
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
async _onTransferItemDrop(event) {
|
||||
// Try to extract the data
|
||||
let data = null
|
||||
try {
|
||||
data = JSON.parse(event.dataTransfer.getData("text/plain"))
|
||||
if (data.type !== "Transfer")
|
||||
return false
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!data.data)
|
||||
return false
|
||||
|
||||
|
||||
if (data.actorId === this.actor.id)
|
||||
return false
|
||||
|
||||
try {
|
||||
this.actor.createEmbeddedDocuments("Item", [duplicate(data.data)]) // Create a new Item
|
||||
const actor = (game as any).actors.get(data.actorId)
|
||||
await actor.items.get(data.data._id)?.delete() // Delete originating item from other actor
|
||||
} catch (e) {
|
||||
console.error("Error transfering item between actors", e)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import { M5Item } from "../items/M5Item"
|
||||
|
||||
export class M5ItemSheet extends ItemSheet {
|
||||
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
width: 530,
|
||||
height: 340,
|
||||
width: 420,
|
||||
height: 240,
|
||||
classes: ["midgard5", "sheet", "item"]
|
||||
})
|
||||
}
|
||||
|
|
@ -16,7 +17,9 @@ export class M5ItemSheet extends ItemSheet {
|
|||
}
|
||||
|
||||
override getData(options?: Partial<ItemSheet.Options>): ItemSheet.Data<ItemSheet.Options> | Promise<ItemSheet.Data<ItemSheet.Options>> {
|
||||
const item = this.item as M5Item
|
||||
return Promise.resolve(super.getData()).then(value => {
|
||||
item.prepareDerivedData()
|
||||
const context = value as any
|
||||
|
||||
// Use a safe clone of the item data for further operations.
|
||||
|
|
|
|||
|
|
@ -42,16 +42,24 @@
|
|||
}
|
||||
|
||||
td {
|
||||
padding: 0 0.5rem 0 0.5rem;
|
||||
|
||||
&.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&.padding {
|
||||
padding: 0 1rem 0 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
input.skill {
|
||||
width: 5rem;
|
||||
}
|
||||
|
||||
.new-skill {
|
||||
font-style: italic;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
color:rgba(255, 255, 255);
|
||||
|
||||
button {
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -40,47 +40,21 @@
|
|||
},
|
||||
"attributes": {
|
||||
"attributes": {
|
||||
"st": {
|
||||
"value": 50,
|
||||
"bonus": 0
|
||||
},
|
||||
"gs": {
|
||||
"value": 50,
|
||||
"bonus": 0
|
||||
},
|
||||
"gw": {
|
||||
"value": 50,
|
||||
"bonus": 0
|
||||
},
|
||||
"ko": {
|
||||
"value": 50,
|
||||
"bonus": 0
|
||||
},
|
||||
"in": {
|
||||
"value": 50,
|
||||
"bonus": 0
|
||||
},
|
||||
"zt": {
|
||||
"value": 50,
|
||||
"bonus": 0
|
||||
},
|
||||
"au": {
|
||||
"value": 50,
|
||||
"bonus": 0
|
||||
},
|
||||
"pa": {
|
||||
"value": 50,
|
||||
"bonus": 0
|
||||
},
|
||||
"wk": {
|
||||
"value": 50,
|
||||
"bonus": 0
|
||||
}
|
||||
"st": { "value": 50, "bonus": 0 },
|
||||
"gs": { "value": 50, "bonus": 0 },
|
||||
"gw": { "value": 50, "bonus": 0 },
|
||||
"ko": { "value": 50, "bonus": 0 },
|
||||
"in": { "value": 50, "bonus": 0 },
|
||||
"zt": { "value": 50, "bonus": 0 },
|
||||
"au": { "value": 50, "bonus": 0 },
|
||||
"pa": { "value": 50, "bonus": 0 },
|
||||
"wk": { "value": 50, "bonus": 0 }
|
||||
}
|
||||
},
|
||||
"skills": {
|
||||
"skills": {
|
||||
"preferredCombatSkill": "",
|
||||
"innate": {},
|
||||
"general": {
|
||||
"akrobatik": { "fw": 6, "attribute": "gw", "initial": 8 },
|
||||
"alchimie": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||
|
|
@ -139,7 +113,8 @@
|
|||
}
|
||||
},
|
||||
"character": {
|
||||
"templates": ["characterBars", "attributes", "characterDescription", "characterHeader", "skills"]
|
||||
"templates": ["characterBars", "attributes", "characterDescription", "characterHeader", "skills"],
|
||||
"calc": {}
|
||||
},
|
||||
"npc": {
|
||||
"templates": ["characterBars", "attributes", "characterDescription"]
|
||||
|
|
@ -175,6 +150,16 @@
|
|||
"pa": { "short": "midgard5.actor-pa", "long": "midgard5.actor-pa-long" },
|
||||
"wk": { "short": "midgard5.actor-wk", "long": "midgard5.actor-wk-long" }
|
||||
}
|
||||
},
|
||||
"rollable": {
|
||||
"rolls": {
|
||||
"formulas": {},
|
||||
"output": ""
|
||||
}
|
||||
},
|
||||
"equippable": {
|
||||
"equippable": false,
|
||||
"equipped": true
|
||||
}
|
||||
},
|
||||
"skill": {
|
||||
|
|
@ -183,27 +168,52 @@
|
|||
"attribute": "st",
|
||||
"skill": "",
|
||||
"type": "general",
|
||||
"formula": "1d20 + @fw + @bonus"
|
||||
"rolls": {
|
||||
"formulas": {
|
||||
"1": {
|
||||
"formula": "1d20 + @i.fw + @i.calc.bonus",
|
||||
"type": "ew"
|
||||
}
|
||||
},
|
||||
"output": ""
|
||||
},
|
||||
"calc": {}
|
||||
},
|
||||
"item": {
|
||||
"templates": ["itemDescription"],
|
||||
"templates": ["itemDescription", "stats", "equippable"],
|
||||
"quantity": 1,
|
||||
"value": 0,
|
||||
"magic": false,
|
||||
"onbody": false,
|
||||
"attributes": {},
|
||||
"groups": {}
|
||||
"groups": {},
|
||||
"rolls": {
|
||||
"formulas": {},
|
||||
"output": ""
|
||||
}
|
||||
},
|
||||
"weapon": {
|
||||
"templates": ["itemDescription", "stats"],
|
||||
"skill": ""
|
||||
"templates": ["itemDescription", "stats", "equippable"],
|
||||
"defensive": false,
|
||||
"skill": "",
|
||||
"rolls": {
|
||||
"formulas": {},
|
||||
"output": ""
|
||||
}
|
||||
},
|
||||
"armor": {
|
||||
"templates": ["itemDescription", "stats"],
|
||||
"skill": ""
|
||||
"templates": ["itemDescription", "stats", "equippable"],
|
||||
"rolls": {
|
||||
"formulas": {},
|
||||
"output": ""
|
||||
}
|
||||
},
|
||||
"spell": {
|
||||
"templates": ["itemDescription"]
|
||||
"templates": ["itemDescription"],
|
||||
"rolls": {
|
||||
"formulas": {},
|
||||
"output": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,15 +16,15 @@ class Logger {
|
|||
console.log(time.str + moduleName.str + text.str, ...time.params.concat(moduleName.params, text.params));
|
||||
}
|
||||
|
||||
static Err(str: string): void {
|
||||
static err(str: string): void {
|
||||
Logger.log(str, Color("orange"));
|
||||
}
|
||||
|
||||
static Warn(str: string): void {
|
||||
static warn(str: string): void {
|
||||
Logger.log(str, Color("yellow"));
|
||||
}
|
||||
|
||||
static Ok(str: string): void {
|
||||
static ok(str: string): void {
|
||||
Logger.log(str, Color("green"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,5 +22,9 @@
|
|||
{{> "systems/midgard5/templates/sheets/character/skills.hbs"}}
|
||||
</div>
|
||||
|
||||
<div class="tab base_values flexcol" data-group="primary" data-tab="gear">
|
||||
{{> "systems/midgard5/templates/sheets/character/gear.hbs"}}
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</form>
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
<h3>Gelernte Fertigkeiten</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{localize "midgard5.skill"}}</th>
|
||||
<th>{{localize "midgard5.learned-skill"}}</th>
|
||||
<th>{{localize "midgard5.fw"}}</th>
|
||||
<th>{{localize "midgard5.bonus"}}</th>
|
||||
<th>{{localize "midgard5.ew"}}</th>
|
||||
|
|
@ -10,24 +9,102 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each data.calc.skills.general as |skill label|}}
|
||||
<tr data-skill="{{skill.id}}">
|
||||
<td class="padding edit-skill">{{label}}</td>
|
||||
{{#each data.calc.skills.general as |skill skillId|}}
|
||||
<tr data-skill="{{skillId}}">
|
||||
<td class="padding edit-skill">{{skill.label}}</td>
|
||||
<td class="center">{{skill.fw}}</td>
|
||||
<td class="center">{{skillBonus ../actor._id skill}}</td>
|
||||
<td class="center">{{skillEw ../actor._id skill}}</td>
|
||||
<td class="center">{{skill.calc.bonus}}</td>
|
||||
<td class="center">{{skill.calc.ew}}</td>
|
||||
<td><button class="roll-learned-button">{{localize "midgard5.roll"}}</button></td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
||||
<tr class="new-skill">
|
||||
<td class="padding">{{localize "midgard5.new-skill"}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td><button data-skilltype="general" class="create-skill-button">{{localize "midgard5.learn"}}</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{localize "midgard5.language"}}</th>
|
||||
<th>{{localize "midgard5.fw"}}</th>
|
||||
<th>{{localize "midgard5.bonus"}}</th>
|
||||
<th>{{localize "midgard5.ew"}}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each data.calc.skills.language as |skill skillId|}}
|
||||
<tr data-skill="{{skillId}}">
|
||||
<td class="padding edit-skill">{{skill.label}}</td>
|
||||
<td class="center">{{skill.fw}}</td>
|
||||
<td class="center">{{skill.calc.bonus}}</td>
|
||||
<td class="center">{{skill.calc.ew}}</td>
|
||||
<td><button class="roll-learned-button">{{localize "midgard5.roll"}}</button></td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
||||
<tr class="new-skill">
|
||||
<td class="padding">{{localize "midgard5.new-skill"}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td><button data-skilltype="language" class="create-skill-button">{{localize "midgard5.learn"}}</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{localize "midgard5.weapon-skill"}}</th>
|
||||
<th>{{localize "midgard5.special"}}</th>
|
||||
<th>{{localize "midgard5.fw"}}</th>
|
||||
<th>{{localize "midgard5.bonus"}}</th>
|
||||
<th>{{localize "midgard5.ew"}}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each data.calc.skills.combat as |skill skillId|}}
|
||||
<tr data-skill="{{skillId}}">
|
||||
<td class="padding edit-skill">{{skill.label}}</td>
|
||||
<td class="center">
|
||||
{{#if (eq skillId ../data.skills.preferredCombatSkill)}}
|
||||
<input type="checkbox" checked />
|
||||
{{else}}
|
||||
<input type="checkbox" class="change-special-combat-skill" />
|
||||
{{/if}}
|
||||
</td>
|
||||
<td class="center">{{skill.fw}}</td>
|
||||
<td class="center">{{skill.calc.bonus}}</td>
|
||||
<td class="center">{{skill.calc.ew}}</td>
|
||||
<td><button class="roll-learned-button">{{localize "midgard5.roll"}}</button></td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
||||
<tr class="new-skill">
|
||||
<td class="padding">{{localize "midgard5.new-skill"}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td><button data-skilltype="combat" class="create-skill-button">{{localize "midgard5.learn"}}</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3>Ungelernte Fertigkeiten</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>{{localize "midgard5.skill"}}</th>
|
||||
<th>{{localize "midgard5.unlearned-skill"}}</th>
|
||||
<th>{{localize "midgard5.fw"}}</th>
|
||||
<th>{{localize "midgard5.bonus"}}</th>
|
||||
<th>{{localize "midgard5.ew"}}</th>
|
||||
|
|
|
|||
|
|
@ -4,11 +4,17 @@
|
|||
<h1><input name="name" type="text" value="{{item.name}}" placeholder="Name" /></h1>
|
||||
</header>
|
||||
<div class="sheet-content">
|
||||
<div class="flexrow">
|
||||
<span>{{localize "midgard5.skill-value"}}</span>
|
||||
<input name="data.fw" type="text" value="{{data.fw}}" data-dtype="Number" />
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{localize "midgard5.skill-value"}}</td>
|
||||
<td><input name="data.fw" type="text" value="{{data.fw}}" data-dtype="Number" /></td>
|
||||
</tr>
|
||||
|
||||
<span>{{localize "midgard5.attribute"}}</span>
|
||||
{{#unless (eq data.type "combat")}}
|
||||
<tr>
|
||||
<td>{{localize "midgard5.attribute"}}</td>
|
||||
<td>
|
||||
<select class="select-attribute" name="data.attribute" data-type="String">
|
||||
{{#select data.attribute}}
|
||||
{{#each data.attributes as |attribute key|}}
|
||||
|
|
@ -16,7 +22,11 @@
|
|||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{/unless}}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<form class="{{cssClass}}" autocomplete="off">
|
||||
<header class="sheet-header">
|
||||
<img class="item-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" />
|
||||
<h1><input name="name" type="text" value="{{item.name}}" placeholder="Name" /></h1>
|
||||
</header>
|
||||
<div class="sheet-content">
|
||||
|
||||
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</form>
|
||||
Loading…
Reference in New Issue