Finishes mod system functionality
This commit is contained in:
parent
c827693e72
commit
58ed9d7d74
|
|
@ -128,7 +128,7 @@ export class M5Character extends Actor {
|
||||||
|
|
||||||
context.items?.filter(item => item.data.type === "item").forEach(item => {
|
context.items?.filter(item => item.data.type === "item").forEach(item => {
|
||||||
const mods = item.data.data.mods
|
const mods = item.data.data.mods
|
||||||
console.log("Actor item mods", mods)
|
//console.log("Actor item mods", mods)
|
||||||
Object.keys(mods).forEach(modIndex => {
|
Object.keys(mods).forEach(modIndex => {
|
||||||
const mod = mods[modIndex] as M5ItemMod
|
const mod = mods[modIndex] as M5ItemMod
|
||||||
aggregate.push(mod, item.data.name)
|
aggregate.push(mod, item.data.name)
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,13 @@ export default class M5ModAggregate {
|
||||||
}
|
}
|
||||||
|
|
||||||
let key = mod.id
|
let key = mod.id
|
||||||
if (mod.type === M5ModType.ATTRIBUTE)
|
// if (mod.type === M5ModType.ATTRIBUTE) {
|
||||||
key = (mod.id + "").toLowerCase()
|
// key = M5Attributes[mod.id] as string
|
||||||
else if (mod.type === M5ModType.STAT)
|
// console.log("M5ModType.ATTRIBUTE", mod.id, key)
|
||||||
key = (mod.id + "").toLowerCase()
|
// } else if (mod.type === M5ModType.STAT) {
|
||||||
|
// key = M5Stats[mod.id] as string
|
||||||
|
// console.log("M5ModType.STAT", mod.id, key)
|
||||||
|
// }
|
||||||
|
|
||||||
if (map.has(key))
|
if (map.has(key))
|
||||||
map.get(key).push(pair)
|
map.get(key).push(pair)
|
||||||
|
|
|
||||||
|
|
@ -30,18 +30,18 @@ export class M5Item extends Item {
|
||||||
const actorCalc = character.derivedData({ skills: true, weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
|
const actorCalc = character.derivedData({ skills: true, weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
|
||||||
if (actorCalc?.skillMods && Object.keys(actorCalc.skillMods).indexOf(context._id) !== -1) {
|
if (actorCalc?.skillMods && Object.keys(actorCalc.skillMods).indexOf(context._id) !== -1) {
|
||||||
pairs = pairs.concat(actorCalc.skillMods[context._id])
|
pairs = pairs.concat(actorCalc.skillMods[context._id])
|
||||||
}
|
|
||||||
|
|
||||||
if (context.data?.attribute && context.data?.attribute !== "") {
|
if (context.data?.attribute && context.data?.attribute !== "") {
|
||||||
pairs.push({
|
pairs.push({
|
||||||
source: context.name,
|
source: context.name,
|
||||||
mod: {
|
mod: {
|
||||||
type: M5ModType.SKILL,
|
type: M5ModType.SKILL,
|
||||||
id: context._id,
|
id: context._id,
|
||||||
operation: M5ModOperation.ADD,
|
operation: M5ModOperation.ADD,
|
||||||
value: actorCalc.attributes[context.data.attribute].bonus
|
value: actorCalc.attributes[context.data.attribute].bonus
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,15 +119,15 @@ export class M5Item extends Item {
|
||||||
switch (mod.type) {
|
switch (mod.type) {
|
||||||
case M5ModType.ATTRIBUTE: {
|
case M5ModType.ATTRIBUTE: {
|
||||||
for (const key of enumKeys(M5Attributes)) {
|
for (const key of enumKeys(M5Attributes)) {
|
||||||
const val = M5Attributes[key]
|
const val: string = M5Attributes[key]
|
||||||
modCalc[key] = (game as Game).i18n.localize(`midgard5.actor-${val}-long`)
|
modCalc[val] = (game as Game).i18n.localize(`midgard5.actor-${val}-long`)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case M5ModType.STAT: {
|
case M5ModType.STAT: {
|
||||||
for (const key of enumKeys(M5Stats)) {
|
for (const key of enumKeys(M5Stats)) {
|
||||||
const val = M5Stats[key]
|
const val: string = M5Stats[key]
|
||||||
modCalc[key] = (game as Game).i18n.localize(`midgard5.mod-stat-${val}`)
|
modCalc[val] = (game as Game).i18n.localize(`midgard5.mod-stat-${val}`)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,93 +54,38 @@
|
||||||
<div class="filler"></div>
|
<div class="filler"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>{{localize "midgard5.actor-st-long"}}</td>
|
|
||||||
<td><input name="data.attributes.st.value" type="text" value="{{data.attributes.st.value}}" data-dtype="Number" /></td>
|
|
||||||
<td><input name="data.attributes.st.bonus" type="text" value="{{data.attributes.st.bonus}}" data-dtype="Number" placeholder="Bonus" /></td>
|
|
||||||
<td><button class="roll-button roll-attribute-button" data-attribute="st" /></td>
|
|
||||||
|
|
||||||
<td>{{localize "midgard5.actor-gs-long"}}</td>
|
|
||||||
<td><input name="data.attributes.gs.value" type="text" value="{{data.attributes.gs.value}}" data-dtype="Number" /></td>
|
|
||||||
<td><input name="data.attributes.gs.bonus" type="text" value="{{data.attributes.gs.bonus}}" data-dtype="Number" placeholder="Bonus" /></td>
|
|
||||||
<td><button class="roll-button roll-attribute-button" data-attribute="gs" /></td>
|
|
||||||
|
|
||||||
<td>{{localize "midgard5.actor-gw-long"}}</td>
|
|
||||||
<td><input name="data.attributes.gw.value" type="text" value="{{data.attributes.gw.value}}" data-dtype="Number" /></td>
|
|
||||||
<td><input name="data.attributes.gw.bonus" type="text" value="{{data.attributes.gw.bonus}}" data-dtype="Number" placeholder="Bonus" /></td>
|
|
||||||
<td><button class="roll-button roll-attribute-button" data-attribute="gw" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>{{localize "midgard5.actor-ko-long"}}</td>
|
|
||||||
<td><input name="data.attributes.ko.value" type="text" value="{{data.attributes.ko.value}}" data-dtype="Number" /></td>
|
|
||||||
<td><input name="data.attributes.ko.bonus" type="text" value="{{data.attributes.ko.bonus}}" data-dtype="Number" placeholder="Bonus" /></td>
|
|
||||||
<td><button class="roll-button roll-attribute-button" data-attribute="ko" /></td>
|
|
||||||
|
|
||||||
<td>{{localize "midgard5.actor-in-long"}}</td>
|
|
||||||
<td><input name="data.attributes.in.value" type="text" value="{{data.attributes.in.value}}" data-dtype="Number" /></td>
|
|
||||||
<td><input name="data.attributes.in.bonus" type="text" value="{{data.attributes.in.bonus}}" data-dtype="Number" placeholder="Bonus" /></td>
|
|
||||||
<td><button class="roll-button roll-attribute-button" data-attribute="in" /></td>
|
|
||||||
|
|
||||||
<td>{{localize "midgard5.actor-zt-long"}}</td>
|
|
||||||
<td><input name="data.attributes.zt.value" type="text" value="{{data.attributes.zt.value}}" data-dtype="Number" /></td>
|
|
||||||
<td><input name="data.attributes.zt.bonus" type="text" value="{{data.attributes.zt.bonus}}" data-dtype="Number" placeholder="Bonus" /></td>
|
|
||||||
<td><button class="roll-button roll-attribute-button" data-attribute="zt" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>{{localize "midgard5.actor-au-long"}}</td>
|
|
||||||
<td><input name="data.attributes.au.value" type="text" value="{{data.attributes.au.value}}" data-dtype="Number" /></td>
|
|
||||||
<td><input name="data.attributes.au.bonus" type="text" value="{{data.attributes.au.bonus}}" data-dtype="Number" placeholder="Bonus" /></td>
|
|
||||||
<td><button class="roll-button roll-attribute-button" data-attribute="au" /></td>
|
|
||||||
|
|
||||||
<td>{{localize "midgard5.actor-pa-long"}}</td>
|
|
||||||
<td><input name="data.attributes.pa.value" type="text" value="{{data.attributes.pa.value}}" data-dtype="Number" /></td>
|
|
||||||
<td><input name="data.attributes.pa.bonus" type="text" value="{{data.attributes.pa.bonus}}" data-dtype="Number" placeholder="Bonus" /></td>
|
|
||||||
<td><button class="roll-button roll-attribute-button" data-attribute="pa" /></td>
|
|
||||||
|
|
||||||
<td>{{localize "midgard5.actor-wk-long"}}</td>
|
|
||||||
<td><input name="data.attributes.wk.value" type="text" value="{{data.attributes.wk.value}}" data-dtype="Number" /></td>
|
|
||||||
<td><input name="data.attributes.wk.bonus" type="text" value="{{data.attributes.wk.bonus}}" data-dtype="Number" placeholder="Bonus" /></td>
|
|
||||||
<td><button class="roll-button roll-attribute-button" data-attribute="wk" /></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<h3>Berechnete Werte</h3>
|
<h3>Berechnete Werte</h3>
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{localize "midgard5.brawl"}}</td>
|
<td>{{localize "midgard5.brawl"}}</td>
|
||||||
<td><input type="text" value="{{data.calc.stats.brawl}}" data-dtype="Number" readonly /></td>
|
<td class="fixed-value">{{data.calc.stats.brawl.value}}</td>
|
||||||
<td>{{localize "midgard5.enduranceBonus"}}</td>
|
<td>{{localize "midgard5.enduranceBonus"}}</td>
|
||||||
<td><input type="text" value="{{data.calc.stats.enduranceBonus}}" data-dtype="Number" readonly /></td>
|
<td class="fixed-value">{{data.calc.stats.enduranceBonus}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{localize "midgard5.defense"}}</td>
|
<td>{{localize "midgard5.defense"}}</td>
|
||||||
<td><input type="text" value="{{data.calc.stats.defense}}" data-dtype="Number" readonly /></td>
|
<td class="fixed-value">{{data.calc.stats.defense.value}}</td>
|
||||||
<td>{{localize "midgard5.defenseBonus"}}</td>
|
<td>{{localize "midgard5.defenseBonus"}}</td>
|
||||||
<td><input type="text" value="{{data.calc.stats.defenseBonus}}" data-dtype="Number" readonly /></td>
|
<td class="fixed-value">{{data.calc.stats.defenseBonus.value}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{localize "midgard5.damageBonus"}}</td>
|
<td>{{localize "midgard5.damageBonus"}}</td>
|
||||||
<td><input type="text" value="{{data.calc.stats.damageBonus}}" data-dtype="Number" readonly /></td>
|
<td class="fixed-value">{{data.calc.stats.damageBonus.value}}</td>
|
||||||
<td>{{localize "midgard5.attackBonus"}}</td>
|
<td>{{localize "midgard5.attackBonus"}}</td>
|
||||||
<td><input type="text" value="{{data.calc.stats.attackBonus}}" data-dtype="Number" readonly /></td>
|
<td class="fixed-value">{{data.calc.stats.attackBonus.value}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{localize "midgard5.spellCasting"}}</td>
|
<td>{{localize "midgard5.spellCasting"}}</td>
|
||||||
<td><input type="text" value="{{data.calc.stats.spellCasting}}" data-dtype="Number" readonly /></td>
|
<td class="fixed-value">{{data.calc.stats.spellCasting.value}}</td>
|
||||||
<td>{{localize "midgard5.poisonResistance"}}</td>
|
<td>{{localize "midgard5.poisonResistance"}}</td>
|
||||||
<td><input type="text" value="{{data.calc.stats.poisonResistance}}" data-dtype="Number" readonly /></td>
|
<td class="fixed-value">{{data.calc.stats.poisonResistance.value}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{localize "midgard5.resistanceMind"}}</td>
|
<td>{{localize "midgard5.resistanceMind"}}</td>
|
||||||
<td><input type="text" value="{{data.calc.stats.resistanceMind}}" data-dtype="Number" readonly /></td>
|
<td class="fixed-value">{{data.calc.stats.resistanceMind.value}}</td>
|
||||||
<td>{{localize "midgard5.resistanceBody"}}</td>
|
<td>{{localize "midgard5.resistanceBody"}}</td>
|
||||||
<td><input type="text" value="{{data.calc.stats.resistanceBody}}" data-dtype="Number" readonly /></td>
|
<td class="fixed-value">{{data.calc.stats.resistanceBody.value}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue