update localize Keys

Changes:
 + update localize Keys, to conform with v11
This commit is contained in:
Byroks 2023-11-25 16:38:05 +01:00
parent c2996aa974
commit 97d4a35cd6
6 changed files with 96 additions and 107 deletions

View File

@ -1,14 +1,14 @@
{ {
"ACTOR.TypeCharacter": "Charakter", "TYPES.Actor.character": "Charakter",
"ACTOR.TypeNpc": "Kreatur / Nichtspielerfigur", "ACTOR.TypeNpc": "Kreatur / Nichtspielerfigur",
"ACTOR.TypeVehicle": "Transportmittel / Pferd etc.", "ACTOR.TypeVehicle": "Transportmittel / Pferd etc.",
"ITEM.TypeItem": "Gegenstand", "TYPES.Item.item": "Gegenstand",
"ITEM.TypeWeapon": "Waffe", "TYPES.Item.weapon": "Waffe",
"ITEM.TypeDefensiveWeapon": "Verteidigungswaffe", "ITEM.TypeDefensiveWeapon": "Verteidigungswaffe",
"ITEM.TypeArmor": "Rüstung", "TYPES.Item.armor": "Rüstung",
"ITEM.TypeSpell": "Zauber", "TYPES.Item.spell": "Zauber",
"ITEM.TypeEffect": "Aktive Effekte", "TYPES.Item.effect": "Aktive Effekte",
"midgard5.doRoll": "Würfeln", "midgard5.doRoll": "Würfeln",
"midgard5.learn": "Lernen", "midgard5.learn": "Lernen",

View File

@ -386,7 +386,7 @@ export class M5Character extends Actor {
value: value, value: value,
mods: [ mods: [
{ {
item: (game as Game).i18n.localize("ACTOR.TypeCharacter"), item: (game as Game).i18n.localize("TYPES.Actor.character"),
operation: M5ModOperation.SET, operation: M5ModOperation.SET,
value: value, value: value,
}, },

View File

@ -1,158 +1,147 @@
import { M5Attribute, M5AttributeCalculated, M5Attributes, M5CharacterCalculatedData, M5ItemMod, M5ModOperation, M5ModResult, M5ModSource, M5ModType, M5Stats, M5ModPair } from "../M5Base" import { M5Attribute, M5AttributeCalculated, M5Attributes, M5CharacterCalculatedData, M5ItemMod, M5ModOperation, M5ModResult, M5ModSource, M5ModType, M5Stats, M5ModPair } from "../M5Base";
export default class M5ModAggregate { export default class M5ModAggregate {
private attributes = new Map<string, Array<M5ModPair>>() private attributes = new Map<string, Array<M5ModPair>>();
private stats = new Map<string, Array<M5ModPair>>() private stats = new Map<string, Array<M5ModPair>>();
private skills = new Map<string, Array<M5ModPair>>() private skills = new Map<string, Array<M5ModPair>>();
constructor(public data: any, public calc: M5CharacterCalculatedData) { constructor(public data: any, public calc: M5CharacterCalculatedData) {
const characterString = (game as Game).i18n.localize("ACTOR.TypeCharacter") const characterString = (game as Game).i18n.localize("TYPES.Actor.character");
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.ST, operation: M5ModOperation.SET, value: data.attributes.st.value }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.ST, operation: M5ModOperation.SET, value: data.attributes.st.value }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.GS, operation: M5ModOperation.SET, value: data.attributes.gs.value }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.GS, operation: M5ModOperation.SET, value: data.attributes.gs.value }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.GW, operation: M5ModOperation.SET, value: data.attributes.gw.value }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.GW, operation: M5ModOperation.SET, value: data.attributes.gw.value }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.KO, operation: M5ModOperation.SET, value: data.attributes.ko.value }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.KO, operation: M5ModOperation.SET, value: data.attributes.ko.value }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.IN, operation: M5ModOperation.SET, value: data.attributes.in.value }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.IN, operation: M5ModOperation.SET, value: data.attributes.in.value }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.ZT, operation: M5ModOperation.SET, value: data.attributes.zt.value }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.ZT, operation: M5ModOperation.SET, value: data.attributes.zt.value }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.AU, operation: M5ModOperation.SET, value: data.attributes.au.value }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.AU, operation: M5ModOperation.SET, value: data.attributes.au.value }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.PA, operation: M5ModOperation.SET, value: data.attributes.pa.value }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.PA, operation: M5ModOperation.SET, value: data.attributes.pa.value }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.WK, operation: M5ModOperation.SET, value: data.attributes.wk.value }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.WK, operation: M5ModOperation.SET, value: data.attributes.wk.value }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.ST, operation: M5ModOperation.ADD_100, value: data.attributes.st.bonus }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.ST, operation: M5ModOperation.ADD_100, value: data.attributes.st.bonus }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.GS, operation: M5ModOperation.ADD_100, value: data.attributes.gs.bonus }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.GS, operation: M5ModOperation.ADD_100, value: data.attributes.gs.bonus }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.GW, operation: M5ModOperation.ADD_100, value: data.attributes.gw.bonus }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.GW, operation: M5ModOperation.ADD_100, value: data.attributes.gw.bonus }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.KO, operation: M5ModOperation.ADD_100, value: data.attributes.ko.bonus }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.KO, operation: M5ModOperation.ADD_100, value: data.attributes.ko.bonus }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.IN, operation: M5ModOperation.ADD_100, value: data.attributes.in.bonus }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.IN, operation: M5ModOperation.ADD_100, value: data.attributes.in.bonus }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.ZT, operation: M5ModOperation.ADD_100, value: data.attributes.zt.bonus }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.ZT, operation: M5ModOperation.ADD_100, value: data.attributes.zt.bonus }, characterString);
this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.AU, operation: M5ModOperation.ADD_100, value: data.attributes.au.bonus }, characterString) this.push({ type: M5ModType.ATTRIBUTE, id: M5Attributes.AU, operation: M5ModOperation.ADD_100, value: data.attributes.au.bonus }, characterString);
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.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.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.defenseBonus.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.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.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) this.push({ type: M5ModType.STAT, id: M5Stats.MOVEMENT, operation: M5ModOperation.SET, value: calc.stats.movementBonus.value }, characterString);
this.push({ type: M5ModType.STAT, id: M5Stats.RESISTANCE_MIND, operation: M5ModOperation.SET, value: calc.stats.resistanceMind.value }, characterString) this.push({ type: M5ModType.STAT, id: M5Stats.RESISTANCE_MIND, operation: M5ModOperation.SET, value: calc.stats.resistanceMind.value }, characterString);
this.push({ type: M5ModType.STAT, id: M5Stats.RESISTANCE_BODY, operation: M5ModOperation.SET, value: calc.stats.resistanceBody.value }, characterString) this.push({ type: M5ModType.STAT, id: M5Stats.RESISTANCE_BODY, operation: M5ModOperation.SET, value: calc.stats.resistanceBody.value }, characterString);
this.push({ type: M5ModType.STAT, id: M5Stats.SPELL_CASTING, operation: M5ModOperation.SET, value: calc.stats.spellCasting.value }, characterString) this.push({ type: M5ModType.STAT, id: M5Stats.SPELL_CASTING, operation: M5ModOperation.SET, value: calc.stats.spellCasting.value }, characterString);
this.push({ type: M5ModType.STAT, id: M5Stats.BRAWL, operation: M5ModOperation.SET, value: calc.stats.brawl.value }, characterString) this.push({ type: M5ModType.STAT, id: M5Stats.BRAWL, operation: M5ModOperation.SET, value: calc.stats.brawl.value }, characterString);
this.push({ type: M5ModType.STAT, id: M5Stats.POISON_RESISTANCE, operation: M5ModOperation.SET, value: calc.stats.poisonResistance.value }, characterString) this.push({ type: M5ModType.STAT, id: M5Stats.POISON_RESISTANCE, operation: M5ModOperation.SET, value: calc.stats.poisonResistance.value }, characterString);
this.push({ type: M5ModType.STAT, id: M5Stats.LP, operation: M5ModOperation.SET, value: calc.stats.lp.value }, characterString) this.push({ type: M5ModType.STAT, id: M5Stats.LP, operation: M5ModOperation.SET, value: calc.stats.lp.value }, characterString);
this.push({ type: M5ModType.STAT, id: M5Stats.AP, operation: M5ModOperation.SET, value: calc.stats.ap.value }, characterString) this.push({ type: M5ModType.STAT, id: M5Stats.AP, operation: M5ModOperation.SET, value: calc.stats.ap.value }, characterString);
} }
push(mod: M5ItemMod, source: string) { push(mod: M5ItemMod, source: string) {
if (!mod?.id || mod.id === "") if (!mod?.id || mod.id === "") return;
return
let map: Map<string, Array<M5ModPair>> = null let map: Map<string, Array<M5ModPair>> = null;
if (mod.type === M5ModType.ATTRIBUTE) if (mod.type === M5ModType.ATTRIBUTE) map = this.attributes;
map = this.attributes else if (mod.type === M5ModType.STAT) map = this.stats;
else if (mod.type === M5ModType.STAT) else if (mod.type === M5ModType.SKILL) map = this.skills;
map = this.stats
else if (mod.type === M5ModType.SKILL)
map = this.skills
if (map) { if (map) {
const pair: M5ModPair = { const pair: M5ModPair = {
mod: mod, mod: mod,
source: source source: source,
} };
if (map.has(mod.id)) if (map.has(mod.id)) map.get(mod.id).push(pair);
map.get(mod.id).push(pair) else map.set(mod.id, [pair]);
else
map.set(mod.id, [pair])
} }
} }
calculate() { calculate() {
const calc = this.calc const calc = this.calc;
this.attributes.forEach((pairs, id) => { this.attributes.forEach((pairs, id) => {
const res = M5ModAggregate.processPairs(pairs) const res = M5ModAggregate.processPairs(pairs);
calc.attributes[id] = { calc.attributes[id] = {
value: res.value, value: res.value,
bonus: M5ModAggregate.attributeBonus(res.value), bonus: M5ModAggregate.attributeBonus(res.value),
mods: res.mods mods: res.mods,
} as M5AttributeCalculated } as M5AttributeCalculated;
//console.log("calc.attributes." + id, calc.attributes[id]) //console.log("calc.attributes." + id, calc.attributes[id])
}) });
this.stats.forEach((pairs, id) => { this.stats.forEach((pairs, id) => {
const res = M5ModAggregate.processPairs(pairs) const res = M5ModAggregate.processPairs(pairs);
calc.stats[id] = res calc.stats[id] = res;
}) });
const ret = {} const ret = {};
this.skills.forEach((pairs, id) => { this.skills.forEach((pairs, id) => {
ret[id] = pairs ret[id] = pairs;
}) });
return ret return ret;
} }
static pairAsSource(pair: M5ModPair): M5ModSource { static pairAsSource(pair: M5ModPair): M5ModSource {
return { return {
operation: pair.mod.operation, operation: pair.mod.operation,
value: pair.mod.value, value: pair.mod.value,
item: pair.source item: pair.source,
} };
} }
static processPairs(arr: Array<M5ModPair>): M5ModResult { static processPairs(arr: Array<M5ModPair>): M5ModResult {
let ret: M5ModResult = { let ret: M5ModResult = {
mods: [], mods: [],
value: 0 value: 0,
} };
let mods = arr.filter(pair => pair.mod.operation === M5ModOperation.FIXED).sort((a, b) => b.mod.value - a.mod.value) let mods = arr.filter((pair) => pair.mod.operation === M5ModOperation.FIXED).sort((a, b) => b.mod.value - a.mod.value);
let pair = mods.length === 0 ? null : mods[0] let pair = mods.length === 0 ? null : mods[0];
if (pair) { if (pair) {
ret.mods.push(this.pairAsSource(pair)) ret.mods.push(this.pairAsSource(pair));
ret.value = pair.mod.value ret.value = pair.mod.value;
} else { } else {
mods = arr.filter(pair => pair.mod.operation === M5ModOperation.SET).sort((a, b) => b.mod.value - a.mod.value) mods = arr.filter((pair) => pair.mod.operation === M5ModOperation.SET).sort((a, b) => b.mod.value - a.mod.value);
if (mods.length !== 0) { if (mods.length !== 0) {
ret.mods.push(this.pairAsSource(mods[0])) ret.mods.push(this.pairAsSource(mods[0]));
ret.value = mods[0].mod.value ret.value = mods[0].mod.value;
} }
mods = arr.filter(pair => pair.mod.operation === M5ModOperation.ADD_100) mods = arr.filter((pair) => pair.mod.operation === M5ModOperation.ADD_100);
if (mods.length !== 0) { if (mods.length !== 0) {
ret.mods = ret.mods.concat(mods.map(this.pairAsSource)) ret.mods = ret.mods.concat(mods.map(this.pairAsSource));
const bonus = mods.map(p => p.mod.value).reduce((a, b) => a + b, 0) const bonus = mods.map((p) => p.mod.value).reduce((a, b) => a + b, 0);
ret.value = Math.min(100, Math.max(0, ret.value + bonus)) ret.value = Math.min(100, Math.max(0, ret.value + bonus));
} }
mods = arr.filter(pair => pair.mod.operation === M5ModOperation.ADD) mods = arr.filter((pair) => pair.mod.operation === M5ModOperation.ADD);
if (mods.length !== 0) { if (mods.length !== 0) {
ret.mods = ret.mods.concat(mods.map(this.pairAsSource)) ret.mods = ret.mods.concat(mods.map(this.pairAsSource));
const bonus = mods.map(p => p.mod.value).reduce((a, b) => a + b, 0) const bonus = mods.map((p) => p.mod.value).reduce((a, b) => a + b, 0);
ret.value = Math.max(0, ret.value + bonus) ret.value = Math.max(0, ret.value + bonus);
} }
} }
return ret return ret;
} }
static attributeMinMax(attribute: M5Attribute) { static attributeMinMax(attribute: M5Attribute) {
return Math.min(100, Math.max(0, attribute.value + attribute.bonus)) return Math.min(100, Math.max(0, attribute.value + attribute.bonus));
} }
static attributeBonus(value: number) { static attributeBonus(value: number) {
if (value > 95) if (value > 95) return 2;
return 2 if (value > 80) return 1;
if (value > 80) if (value > 20) return 0;
return 1 if (value > 5) return -1;
if (value > 20) return -2;
return 0
if (value > 5)
return -1
return -2
} }
//static modToString(mod: M5ItemMod): string { } //static modToString(mod: M5ItemMod): string { }
} }

View File

@ -1,7 +1,7 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th>{{localize "ITEM.TypeEffect"}}</th> <th>{{localize "TYPES.Item.effect"}}</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>

View File

@ -1,7 +1,7 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th>{{localize "ITEM.TypeWeapon"}}</th> <th>{{localize "TYPES.Item.weapon"}}</th>
<th class="fixed-value">{{localize "midgard5.ew"}}</th> <th class="fixed-value">{{localize "midgard5.ew"}}</th>
<th class="fixed-value"></th> <th class="fixed-value"></th>
<th class="fixed-value"></th> <th class="fixed-value"></th>
@ -71,7 +71,7 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th>{{localize "ITEM.TypeArmor"}}</th> <th>{{localize "TYPES.Item.armor"}}</th>
<th class="fixed-value">{{localize "midgard5.actor-lp-short"}}</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.actor-ap-short"}}</th>
<th class="fixed-value">{{localize "midgard5.attackBonus-short"}}</th> <th class="fixed-value">{{localize "midgard5.attackBonus-short"}}</th>
@ -100,7 +100,7 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th>{{localize "ITEM.TypeItem"}}</th> <th>{{localize "TYPES.Item.item"}}</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>

View File

@ -1,7 +1,7 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th>{{localize "ITEM.TypeSpell"}}</th> <th>{{localize "TYPES.Item.spell"}}</th>
<th>{{localize "midgard5.ew"}}</th> <th>{{localize "midgard5.ew"}}</th>
<th></th> <th></th>
<th></th> <th></th>