Add customizable rolls to items

This commit is contained in:
mstein 2022-07-23 18:50:08 +02:00
parent 58ed9d7d74
commit b3e2771e91
24 changed files with 361 additions and 155 deletions

View File

@ -9,9 +9,10 @@
"ITEM.TypeArmor": "Rüstung",
"ITEM.TypeSpell": "Zauber",
"midgard5.roll": "Würfeln",
"midgard5.doRoll": "Würfeln",
"midgard5.learn": "Lernen",
"midgard5.label": "Bezeichnung",
"midgard5.description": "Beschreibung",
"midgard5.attribute": "Leiteigenschaft",
"midgard5.skill": "Fertigkeit",
@ -158,6 +159,7 @@
"midgard5.no-skill": "Keine Fertigkeit",
"midgard5.magic": "magisch",
"midgard5.rangedWeapon": "Schusswaffe",
"midgard5.assignItemToCharacter": "Füge Gegenstand einem Charakter hinzu, um Fähigkeit auwählen zu können",
"midgard5.pw": "Prüfwurf",
"midgard5.attack": "Angriff",
@ -204,9 +206,9 @@
"midgard5.mod-operation-set": "Basiswert",
"midgard5.mod-operation-fixed": "Fester Wert",
"midgard5.mod-stat-defense": "Abwehr",
"midgard5.mod-stat-attack": "Angriff",
"midgard5.mod-stat-damage": "Schaden",
"midgard5.mod-stat-defenseBonus": "Abwehrbonus",
"midgard5.mod-stat-attackBonus": "Angriffsbonus",
"midgard5.mod-stat-damageBonus": "Schadensbonus",
"midgard5.mod-stat-movement": "Bewegung",
"midgard5.mod-stat-resistanceMind": "Resistenz Geist",
"midgard5.mod-stat-resistanceBody": "Resistenz Körper",
@ -219,5 +221,9 @@
"midgard5.mod-type": "Typ der Modifikation",
"midgard5.mod-id": "Was soll modifiziert werden",
"midgard5.mod-operation": "Wie soll modifiziert werden",
"midgard5.mod-value": "Wert"
"midgard5.mod-value": "Wert",
"midgard5.type": "Typ",
"midgard5.formula": "Formel",
"midgard5.roll": "Wurf"
}

View File

@ -0,0 +1,49 @@
{
"name": "Fernkampfwaffe",
"type": "weapon",
"img": "icons/svg/item-bag.svg",
"data": {
"description": "",
"stats": {
"damageBonus": 0,
"attackBonus": 0,
"defenseBonus": 0,
"movementBonus": 0,
"resistanceMind": 0,
"resistanceBody": 0,
"spellBonus": 0
},
"equippable": false,
"equipped": true,
"value": 0,
"magic": false,
"special": false,
"ranged": true,
"skillId": "",
"damageBase": "1d6",
"rolls": {
"formulas": {
"0": {
"formula": "1d20 + @i.calc.fw + @i.calc.bonus + @i.calc.special + @c.calc.stats.attackBonus.value + @i.stats.attackBonus",
"label": "Angriff",
"enabled": true
},
"1": {
"formula": "@i.damageBase + @i.stats.damageBonus",
"label": "Schaden",
"enabled": true
}
},
"output": ""
},
"calc": {}
},
"effects": [],
"folder": null,
"sort": 0,
"permission": {
"default": 0,
"XD0IpWT6bN4AJiYQ": 3
},
"_id": "h1inVuRJQI42JTCs"
}

View File

@ -50,7 +50,7 @@
"formulas": {
"0": {
"formula": "1d20 + @i.fw + @i.calc.bonus",
"type": "ew",
"enabled": true,
"label": "EW"
}
},

View File

@ -49,8 +49,8 @@
"rolls": {
"formulas": {
"0": {
"formula": "1d20 + @i.fw + @i.calc.bonus",
"type": "ew",
"formula": "1d20 + @i.calc.fw + @i.calc.bonus",
"enabled": true,
"label": "EW"
}
},

View File

@ -21,8 +21,8 @@
"rolls": {
"formulas": {
"0": {
"formula": "1d20 + @i.calc.fw + @i.calc.bonus + @i.calc.special + @c.calc.stats.defense + @c.calc.stats.defenseBonus + @i.stats.defenseBonus",
"type": "ew",
"formula": "1d20 + @i.calc.fw + @i.calc.bonus + @i.calc.special + @c.calc.stats.defense.value + @c.calc.stats.defenseBonus.value + @i.stats.defenseBonus",
"enabled": true,
"label": "Abwehr"
}
},

View File

@ -23,13 +23,13 @@
"rolls": {
"formulas": {
"0": {
"formula": "1d20 + @i.calc.fw + @i.calc.bonus + @i.calc.special + @c.calc.stats.attackBonus + @i.stats.attackBonus",
"type": "ew",
"formula": "1d20 + @i.calc.fw + @i.calc.bonus + @i.calc.special + @c.calc.stats.attackBonus.value + @i.stats.attackBonus",
"enabled": true,
"label": "Angriff"
},
"1": {
"formula": "@i.damageBase + @i.stats.damageBonus + @c.calc.stats.damageBonus",
"type": "dmg",
"formula": "@i.damageBase + @i.stats.damageBonus + @c.calc.stats.damageBonus.value",
"enabled": true,
"label": "Schaden"
}
},

View File

@ -49,8 +49,8 @@
"rolls": {
"formulas": {
"0": {
"formula": "1d20 + @i.fw + @i.calc.bonus",
"type": "ew",
"formula": "1d20 + @i.calc.fw + @i.calc.bonus",
"enabled": true,
"label": "EW"
}
},

View File

@ -47,8 +47,8 @@
"rolls": {
"formulas": {
"0": {
"formula": "1d20 + @c.calc.stats.spellCasting + @i.bonus",
"type": "ew",
"formula": "1d20 + @c.calc.stats.spellCasting.value + @i.bonus",
"enabled": true,
"label": "Zaubern"
}
},

View File

@ -11,6 +11,7 @@ const preloadTemplates = async (): Promise<Handlebars.TemplateDelegate<any>[]> =
"sheets/character/skills.hbs",
"sheets/character/gear.hbs",
"sheets/character/spells.hbs",
"sheets/item/rolls.hbs",
"chat/roll-m5.hbs"
]
return loadTemplates(templates.map(s => rootPath + s))

View File

@ -1,3 +1,4 @@
import { BooleanField } from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/data/fields.mjs"
export interface M5Skill {
fw: number
@ -33,11 +34,13 @@ export interface M5RollData {
}
}
export interface M5RollResult {
export interface M5RollTemplate {
formula: string
label: string
type: string
enabled: boolean
}
export interface M5RollResult extends M5RollTemplate {
total: number
totalStr: string
result: string
@ -67,9 +70,9 @@ export enum M5Attributes {
}
export enum M5Stats {
DEFENSE = "defense",
ATTACK = "attack",
DAMAGE = "damage",
DEFENSE = "defenseBonus",
ATTACK = "attackBonus",
DAMAGE = "damageBonus",
MOVEMENT = "movement",
RESISTANCE_MIND = "resistanceMind",
RESISTANCE_BODY = "resistanceBody",

View File

@ -28,7 +28,7 @@ export default class M5ModAggregate {
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.PA, operation: M5ModOperation.ADD_100, value: data.attributes.pa.bonus }, characterString)
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.WK, operation: M5ModOperation.ADD_100, value: data.attributes.wk.bonus }, characterString)
this.push({ type: M5ModType.STAT, id: M5Stats.DEFENSE, operation: M5ModOperation.SET, value: calc.stats.defense.value }, characterString)
this.push({ type: M5ModType.STAT, id: M5Stats.DEFENSE, operation: M5ModOperation.SET, value: calc.stats.defenseBonus.value }, characterString)
this.push({ type: M5ModType.STAT, id: M5Stats.ATTACK, operation: M5ModOperation.SET, value: calc.stats.attackBonus.value }, characterString)
this.push({ type: M5ModType.STAT, id: M5Stats.DAMAGE, operation: M5ModOperation.SET, value: calc.stats.damageBonus.value }, characterString)
this.push({ type: M5ModType.STAT, id: M5Stats.MOVEMENT, operation: M5ModOperation.SET, value: calc.stats.movementBonus.value }, characterString)
@ -59,19 +59,10 @@ export default class M5ModAggregate {
source: source
}
let key = mod.id
// if (mod.type === M5ModType.ATTRIBUTE) {
// key = M5Attributes[mod.id] as string
// console.log("M5ModType.ATTRIBUTE", mod.id, key)
// } else if (mod.type === M5ModType.STAT) {
// key = M5Stats[mod.id] as string
// console.log("M5ModType.STAT", mod.id, key)
// }
if (map.has(key))
map.get(key).push(pair)
if (map.has(mod.id))
map.get(mod.id).push(pair)
else
map.set(key, [pair])
map.set(mod.id, [pair])
}
}

View File

@ -65,7 +65,7 @@ export class M5Item extends Item {
if (actor) {
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
if (actorCalc) {
calc.ew += actorCalc.stats.attackBonus
calc.ew += actorCalc.stats.attackBonus.value
calc.combatSkills = actorCalc.skills.combat
}
@ -108,7 +108,7 @@ export class M5Item extends Item {
if (actor) {
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
if (actorCalc) {
calc.ew += actorCalc.stats.spellCasting
calc.ew += actorCalc.stats.spellCasting.value
}
}
} else if (context.type === "item") {
@ -204,15 +204,17 @@ export class M5Item extends Item {
const rollData = this.getRollData()
formulaNames.forEach(formulaName => {
const formula = item.data.rolls.formulas[formulaName]
rollData.rolls[formulaName] = {
formula: formula.formula,
label: formula.label,
type: formula.type,
result: "",
total: 0,
totalStr: "",
dice: {}
} as M5RollResult
if (formula) {
rollData.rolls[formulaName] = {
formula: formula.formula,
label: formula.label,
enabled: formula.enabled,
result: "",
total: 0,
totalStr: "",
dice: {}
} as M5RollResult
}
})
const roll = new M5Roll(rollData, this.actor, item.name)

View File

@ -17,19 +17,24 @@ export class M5Roll { // extends Roll<M5RollData>
// @ts-ignore
//override evaluate(options?: InexactPartial<RollTerm.EvaluationOptions>): Evaluated<Roll<M5RollData>> | Promise<Evaluated<Roll<M5RollData>>> {
evaluate() {
const indexMap = new Map<number, string>()
const rollNames = Object.keys(this.data.rolls)
const rolls = rollNames.map(rollName => {
const rolls = rollNames.filter(rollName => this.data.rolls[rollName].enabled).map((rollName, index) => {
indexMap.set(index, rollName)
const formula = this.data.rolls[rollName]
const roll = new Roll(formula.formula, this.data)
return roll
})
this.pool = PoolTerm.fromRolls(rolls)
console.log("evaluate", this._evaluated, this.pool)
return this.pool.evaluate({ async: true }).then(results => {
this._total = 0
results.rolls.forEach((roll, index) => {
const rollResult = this.data.rolls[index.toString()] as M5RollResult
const rollIndex = indexMap.get(index)
const rollResult = this.data.rolls[rollIndex] as M5RollResult
rollResult.result = roll.result
rollResult.total = roll.total
rollResult.totalStr = roll.total.toString()
@ -37,27 +42,29 @@ export class M5Roll { // extends Roll<M5RollData>
this._total += roll.total
let rowRes = M5EwResult.TBD
let face100 = -1
roll.dice.forEach((d, dIndex) => {
rollResult.dice[dIndex.toString()] = d.total
if (rowRes === M5EwResult.TBD && dIndex === 0) {
if (rollResult.type === "ew") {
if (d.faces === 20) {
//if (rollResult.type === "ew") {
if (d.total === 1)
rowRes = M5EwResult.FUMBLE
else if (d.total === 20)
rowRes = M5EwResult.CRITICAL
else if (d.total >= 16)
rowRes = M5EwResult.HIGH
} else if (rollResult.type === "pw") {
if (d.total === 1)
rowRes = M5EwResult.FUMBLE
else if (d.total === 20)
rowRes = M5EwResult.CRITICAL
} else if (d.faces === 100) {
face100 = d.total as number
}
}
})
if (rollResult.type === "ew") {
const parseResult = M5Roll.parseDiceSides(rollResult.formula)
//console.log("evaluate roll", parseResult)
if (parseResult?.sides === 20) {
if (roll.total < 20) {
if (rowRes === M5EwResult.TBD || rowRes === M5EwResult.HIGH)
rowRes = M5EwResult.FAIL
@ -65,10 +72,18 @@ export class M5Roll { // extends Roll<M5RollData>
if (rowRes === M5EwResult.TBD)
rowRes = M5EwResult.PASS
}
} else if (rollResult.type === "pw") {
if (roll.total < 0) {
} else if (face100 >= 0) {
const threshold100 = roll.total + face100
const threshold = Math.floor(threshold100 / 10)
if (face100 === 100) {
if (rowRes === M5EwResult.TBD)
rowRes = M5EwResult.FUMBLE
} else if (roll.total < 0) {
if (rowRes === M5EwResult.TBD)
rowRes = M5EwResult.FAIL
} else if (face100 <= threshold) {
if (rowRes === M5EwResult.TBD)
rowRes = M5EwResult.CRITICAL
} else {
if (rowRes === M5EwResult.TBD)
rowRes = M5EwResult.PASS
@ -114,7 +129,7 @@ export class M5Roll { // extends Roll<M5RollData>
rollData.i = attribute.value + attribute.bonus
rollData.rolls["0"] = {
formula: "@i - 1d100",
type: "pw",
enabled: true,
label: (game as Game).i18n.localize("midgard5.pw"),
result: "",
total: 0,
@ -135,7 +150,7 @@ export class M5Roll { // extends Roll<M5RollData>
rollData.rolls["0"] = {
formula: "1d20 + @c.calc.stats.brawl + @c.calc.stats.attackBonus + @i.attackBonus",
type: "ew",
enabled: true,
label: (game as Game).i18n.localize("midgard5.attack"),
result: "",
total: 0,
@ -146,7 +161,7 @@ export class M5Roll { // extends Roll<M5RollData>
rollData.rolls["1"] = {
formula: "1d6 - 4 + @c.calc.stats.damageBonus + @i.damageBonus",
type: "dmg",
enabled: true,
label: (game as Game).i18n.localize("midgard5.damage"),
result: "",
total: 0,
@ -157,4 +172,35 @@ export class M5Roll { // extends Roll<M5RollData>
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.brawl"))
}
static parseDiceSides(formula: string): FormulaParseResult {
const ewMatcher: RegExp = /\d*[dD]20/g
const pwMatcher: RegExp = /(\d+)\s*\-\s*\d*[dD]100/g
let res = formula.match(ewMatcher)
if (res && !!res[0]) {
return {
sides: 20,
type: "ew",
threshold: null
}
}
res = formula.match(pwMatcher)
if (res && !!res[1]) {
return {
sides: 100,
type: "pw",
threshold: parseInt(res[1])
}
}
return null
}
}
interface FormulaParseResult {
sides: number,
type: string,
threshold: number
}

View File

@ -1,5 +1,5 @@
import { M5Item } from "../items/M5Item"
import { M5Attributes, M5ItemMod, M5ModOperation, M5ModType } from "../M5Base"
import { M5Attributes, M5ItemMod, M5ModOperation, M5ModType, M5RollTemplate } from "../M5Base"
export class M5ItemSheet extends ItemSheet {
@ -78,6 +78,54 @@ export class M5ItemSheet extends ItemSheet {
this.render(false)
})
html.find(".roll-delete").on("click", async (event) => {
//console.log("roll-delete", this.item.data.data.rolls.formulas)
let row = event.target.parentElement
let rollIndex = row.dataset["roll"]
while (!rollIndex) {
row = row.parentElement
if (!row)
return
rollIndex = row.dataset["roll"]
}
const rolls = this.item.data.data.rolls.formulas
rolls[rollIndex] = null
this.item.update({
data: {
rolls: {
formulas: rolls
}
}
})
this.render(false)
})
html.find(".roll-create").on("click", async (event) => {
const rolls = this.item.data.data.rolls.formulas
const indeces = Object.keys(rolls).map(index => parseInt(index)).sort().reverse()
const index = (indeces.find(index => !!rolls[index.toString()]) ?? -1) + 1
console.log("roll-create", rolls, indeces, index)
rolls[index.toString()] = {
formula: "1d6",
label: (game as Game).i18n.localize("midgard5.roll"),
enabled: true
} as M5RollTemplate
this.item.update({
data: {
rolls: {
formulas: rolls
}
}
})
this.render(false)
})
// Drag & Drop
if (["item"].includes(this.object.data?.type)) {
const itemToItemAssociation = new DragDrop({

View File

@ -43,7 +43,7 @@
font-weight: bold;
}
td {
td, th {
padding: 0 0.5rem 0 0.5rem;
&.center {

View File

@ -1,20 +1,58 @@
// main: midgard5.less
.midgard5.sheet.item {
form {
display: flex;
flex-direction: column;
}
.sheet-content {
height: 100%;
display: flex;
flex-direction: column;
.editor {
height: 100%;
}
}
.item-img {
height: 64px;
width: 64px;
}
form {
display: flex;
flex-direction: column;
}
.sheet-content {
height: 100%;
display: flex;
flex-direction: column;
.editor {
height: 100%;
}
}
.item-img {
height: 64px;
width: 64px;
}
td, th {
padding: 0 0.5rem 0 0.5rem;
&.center {
text-align: center;
}
&.fixed-value {
width: 3rem;
text-align: center;
}
}
table.rolls-table {
.col-enabled {
width: 3rem;
text-align: center;
}
.col-create {
width: 3rem;
text-align: center;
button {
background: rgba(255, 255, 255, 0.5);
}
}
.col-delete {
width: 3rem;
text-align: center;
}
.col-label {
width: 6rem;
}
}
}

View File

@ -112,9 +112,6 @@
"character": {
"templates": ["characterBars", "attributes", "characterDescription", "characterHeader", "skills"],
"calc": {}
},
"vehicle": {
"templates": ["characterBars", "attributes"]
}
},
"Item": {
@ -217,7 +214,6 @@
"formulas": {
"0": {
"formula": "1d20 + @i.calc.fw + @i.calc.bonus",
"type": "ew",
"label": "EW",
"enabled": true
}
@ -226,13 +222,6 @@
},
"calc": {}
},
"mod": {
"type": "",
"id": "",
"operation": "",
"value": 0,
"calc": {}
},
"item": {
"templates": ["itemDescription", "equippable", "physical"],
"rolls": {
@ -251,14 +240,12 @@
"rolls": {
"formulas": {
"0": {
"formula": "1d20 + @i.calc.fw + @i.calc.bonus + @i.calc.special + @c.calc.stats.attackBonus + @i.stats.attackBonus",
"type": "ew",
"formula": "1d20 + @i.calc.fw + @i.calc.bonus + @i.calc.special + @c.calc.stats.attackBonus.value + @i.stats.attackBonus",
"label": "Angriff",
"enabled": true
},
"1": {
"formula": "@i.damageBase + @i.stats.damageBonus + @c.calc.stats.damageBonus",
"type": "dmg",
"formula": "@i.damageBase + @i.stats.damageBonus + @c.calc.stats.damageBonus.value",
"label": "Schaden",
"enabled": true
}
@ -274,8 +261,7 @@
"rolls": {
"formulas": {
"0": {
"formula": "1d20 + @i.calc.fw + @i.calc.bonus + @i.calc.special + @c.calc.stats.defense + @c.calc.stats.defenseBonus + @i.stats.defenseBonus",
"type": "ew",
"formula": "1d20 + @i.calc.fw + @i.calc.bonus + @i.calc.special + @c.calc.stats.defense.value + @c.calc.stats.defenseBonus.value + @i.stats.defenseBonus",
"label": "Abwehr",
"enabled": true
}
@ -309,8 +295,7 @@
"rolls": {
"formulas": {
"0": {
"formula": "1d20 + @c.calc.stats.spellCasting + @i.bonus",
"type": "ew",
"formula": "1d20 + @c.calc.stats.spellCasting.value + @i.bonus",
"label": "Zaubern",
"enabled": true
}

View File

@ -5,52 +5,54 @@
<table>
<tbody>
{{#if (eq iType "spell")}}
<tr>
<td>{{localize "midgard5.actor-ap"}}</td>
<td class="roll-spell-details">{{i.ap}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-castDuration"}}</td>
<td class="roll-spell-details">{{i.castDuration}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-range"}}</td>
<td class="roll-spell-details">{{i.range}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-effectTarget"}}</td>
<td class="roll-spell-details">{{localize (m5concat "midgard5.spell-target-" i.effectTarget)}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-effectArea"}}</td>
<td class="roll-spell-details">{{i.effectArea}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-effectDuration"}}</td>
<td class="roll-spell-details">{{i.effectDuration}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-origin"}}</td>
<td class="roll-spell-details">{{i.origin}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-type"}}</td>
<td class="roll-spell-details">{{localize (m5concat "midgard5.spell-type-" i.type)}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-process"}}</td>
<td class="roll-spell-details">{{localize (m5concat "midgard5.spell-process-" i.process)}}</td>
</tr>
<tr>
<td>{{localize "midgard5.actor-ap"}}</td>
<td class="roll-spell-details">{{i.ap}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-castDuration"}}</td>
<td class="roll-spell-details">{{i.castDuration}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-range"}}</td>
<td class="roll-spell-details">{{i.range}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-effectTarget"}}</td>
<td class="roll-spell-details">{{localize (m5concat "midgard5.spell-target-" i.effectTarget)}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-effectArea"}}</td>
<td class="roll-spell-details">{{i.effectArea}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-effectDuration"}}</td>
<td class="roll-spell-details">{{i.effectDuration}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-origin"}}</td>
<td class="roll-spell-details">{{i.origin}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-type"}}</td>
<td class="roll-spell-details">{{localize (m5concat "midgard5.spell-type-" i.type)}}</td>
</tr>
<tr>
<td>{{localize "midgard5.spell-process"}}</td>
<td class="roll-spell-details">{{localize (m5concat "midgard5.spell-process-" i.process)}}</td>
</tr>
{{/if}}
{{#each rolls as |roll index|}}
<tr class="roll-row {{roll.css}}">
<td>{{roll.label}}</td>
<td class="roll-result">
<span class="roll-total">{{roll.totalStr}}</span>
<span class="roll-detail">{{roll.result}}</span>
</td>
</tr>
{{#if roll.enabled}}
<tr class="roll-row {{roll.css}}">
<td>{{roll.label}}</td>
<td class="roll-result">
<span class="roll-total">{{roll.totalStr}}</span>
<span class="roll-detail">{{roll.result}}</span>
</td>
</tr>
{{/if}}
{{/each}}
</tbody>
</table>

View File

@ -2,9 +2,9 @@
<thead>
<tr>
<th>{{localize "ITEM.TypeWeapon"}}</th>
<th>{{localize "midgard5.ew"}}</th>
<th></th>
<th></th>
<th class="fixed-value">{{localize "midgard5.ew"}}</th>
<th class="fixed-value"></th>
<th class="fixed-value"></th>
</tr>
</thead>
<tbody>
@ -30,9 +30,9 @@
<thead>
<tr>
<th>{{localize "ITEM.TypeDefensiveWeapon"}}</th>
<th>{{localize "midgard5.ew"}}</th>
<th></th>
<th></th>
<th class="fixed-value">{{localize "midgard5.ew"}}</th>
<th class="fixed-value"></th>
<th class="fixed-value"></th>
</tr>
</thead>
<tbody>
@ -51,13 +51,13 @@
<thead>
<tr>
<th>{{localize "ITEM.TypeArmor"}}</th>
<th>{{localize "midgard5.actor-lp-short"}}</th>
<th>{{localize "midgard5.actor-ap-short"}}</th>
<th>{{localize "midgard5.attackBonus-short"}}</th>
<th>{{localize "midgard5.defenseBonus-short"}}</th>
<th>B</th>
<th>Gw</th>
<th></th>
<th class="fixed-value">{{localize "midgard5.actor-lp-short"}}</th>
<th class="fixed-value">{{localize "midgard5.actor-ap-short"}}</th>
<th class="fixed-value">{{localize "midgard5.attackBonus-short"}}</th>
<th class="fixed-value">{{localize "midgard5.defenseBonus-short"}}</th>
<th class="fixed-value">B</th>
<th class="fixed-value">Gw</th>
<th class="fixed-value"></th>
</tr>
</thead>
<tbody>
@ -80,12 +80,14 @@
<thead>
<tr>
<th>{{localize "ITEM.TypeItem"}}</th>
<th></th>
</tr>
</thead>
<tbody>
{{#each data.calc.gear.items as |item itemId|}}
<tr data-item="{{itemId}}">
<td class="padding edit-item">{{item.label}}</td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr>
{{/each}}
</tbody>

View File

@ -43,6 +43,9 @@
</tr>
</tbody>
</table>
{{> "systems/midgard5/templates/sheets/item/rolls.hbs"}}
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
</form>

View File

@ -0,0 +1,22 @@
<table class="rolls-table">
<thead>
<tr>
<th class="col-enabled"></th>
<th class="col-label">{{localize "midgard5.label"}}</th>
<th class="col-formula">{{localize "midgard5.formula"}}</th>
<th class="col-delete"><button class="roll-create">+</button></th>
</tr>
</thead>
<tbody>
{{#each data.rolls.formulas as |roll rollIndex|}}
{{#if roll}}
<tr data-roll="{{rollIndex}}">
<td><input type="checkbox" name="data.rolls.formulas.{{rollIndex}}.enabled" {{checked roll.enabled}} /></td>
<td><input type="text" name="data.rolls.formulas.{{rollIndex}}.label" value="{{roll.label}}" data-dtype="String" /></td>
<td><input type="text" name="data.rolls.formulas.{{rollIndex}}.formula" value="{{roll.formula}}" data-dtype="String" /></td>
<td class="fixed-value"><a class="roll-delete" title="Delete Roll"><i class="fas fa-trash"></i></a></td>
</tr>
{{/if}}
{{/each}}
</tbody>
</table>

View File

@ -29,6 +29,8 @@
</tbody>
</table>
{{> "systems/midgard5/templates/sheets/item/rolls.hbs"}}
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
</form>

View File

@ -62,6 +62,9 @@
</tr>
</tbody>
</table>
{{> "systems/midgard5/templates/sheets/item/rolls.hbs"}}
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
</form>

View File

@ -48,7 +48,7 @@
{{/select}}
</select>
{{else}}
<span>Assign item to character to select weapon skill</span>
<span>{{localize "midgard5.assignItemToCharacter"}}</span>
{{/if}}
</td>
</tr>
@ -60,6 +60,9 @@
</tr>
</tbody>
</table>
{{> "systems/midgard5/templates/sheets/item/rolls.hbs"}}
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
</form>