Subject: Enhance combat mechanics and localization
- Introduced new combat-related properties (initiative, group, unable to act) to characters for an enriched gaming experience. - Added German translations for newly introduced terms to ensure consistency within the game's interface. - Capitalized the German translation for "magic" to align with existing convention. - Refactored settings management in player and NPC sheets for better clarity and maintenance. - Implemented logic for handling characters' inability to act in combat, including UI elements for managing this state, thereby increasing gameplay depth. - Adjusted display and management of items and effects to accommodate new combat features, streamlining user interaction and integration with the combat system. - Minor UI and styling adjustments to enhance readability and user experience across character and item sheets. These changes aim to make combat encounters more dynamic and engaging, while also improving the user interface for ease of interaction and consistency.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { log } from "console";
|
||||
import { M5Item } from "../items/M5Item";
|
||||
import { M5Attribute, M5CharacterCalculatedData, M5ItemMod, M5ItemType, M5ModOperation, M5ModResult, M5RollData, M5Skill, M5SkillCalculated } from "../M5Base";
|
||||
import M5ModAggregate from "./M5ModAggregate";
|
||||
@@ -86,6 +87,7 @@ export class M5Character extends Actor {
|
||||
): M5CharacterCalculatedData {
|
||||
let ret: M5CharacterCalculatedData = {
|
||||
level: 0,
|
||||
initiative: 0,
|
||||
attributes: {
|
||||
st: { value: 0, bonus: 0, mods: [] },
|
||||
gs: { value: 0, bonus: 0, mods: [] },
|
||||
@@ -151,6 +153,9 @@ export class M5Character extends Actor {
|
||||
if (!data) return null;
|
||||
|
||||
ret.level = M5Character.levelFromExp(data.info.race === "Zwerg" ? Math.min(data.calc.stats?.hoard * 2 || 0, data.es) : data.es);
|
||||
ret.initiative = M5Character.initiativeFromAnfuehren(data.calc.skills?.general, (game as Game).i18n.localize("midgard5.anfuehren"), data.skills.general.anfuehren.fw);
|
||||
ret.unableToAct = M5Character.unableToActFromEffect(data.calc.gear?.effects);
|
||||
ret.group = M5Character.groupFromDisposition(this);
|
||||
|
||||
ret.attributes.st.value = M5Character.attributeMinMax(data.attributes.st); // TODO item effects
|
||||
ret.attributes.gs.value = M5Character.attributeMinMax(data.attributes.gs);
|
||||
@@ -494,6 +499,7 @@ export class M5Character extends Actor {
|
||||
magic: item.system.magic,
|
||||
calc: item.system.calc,
|
||||
equipped: item.system?.equipped || false,
|
||||
unablesToAct: item.system?.unablesToAct || false,
|
||||
duration: item.system?.duration || { time: 0, unit: "" },
|
||||
};
|
||||
});
|
||||
@@ -604,6 +610,47 @@ export class M5Character extends Actor {
|
||||
return ret === -1 ? M5Character.levelThreshold.length : ret;
|
||||
}
|
||||
|
||||
static initiativeFromAnfuehren(list: object, anfuehren: string, unlearned: number): number {
|
||||
for (const element in list) {
|
||||
if (list[element].label.toLowerCase() === anfuehren.toLowerCase()) {
|
||||
return list[element].calc.ew;
|
||||
}
|
||||
}
|
||||
return unlearned;
|
||||
}
|
||||
|
||||
static unableToActFromEffect(list: object): { effectId: string; enabled: boolean; rounds: number; reason: string } {
|
||||
console.log("Effects:", list);
|
||||
for (const element in list) {
|
||||
if (list[element].unablesToAct) {
|
||||
return {
|
||||
effectId: list[element],
|
||||
enabled: list[element].equipped,
|
||||
rounds: list[element].duration.time,
|
||||
reason: list[element].label,
|
||||
};
|
||||
}
|
||||
}
|
||||
return { effectId: "", enabled: false, rounds: 0, reason: "" };
|
||||
}
|
||||
|
||||
static groupFromDisposition(actor: any): string {
|
||||
console.log("Group:", actor);
|
||||
let disposition:number = 0;
|
||||
if (actor.isToken) {
|
||||
disposition = actor.token.disposition;
|
||||
} else {
|
||||
disposition = actor.prototypeToken.disposition;
|
||||
}
|
||||
switch ( disposition ) {
|
||||
case 1: return "Spieler";
|
||||
case -1: return "Gegner";
|
||||
case 0: return "Gegner 2";
|
||||
case 2: return "Gegner 3";
|
||||
default: return "Unbekannt";
|
||||
}
|
||||
}
|
||||
|
||||
static readonly defenseThreshold: Array<[number, number]> = [
|
||||
[30, 18],
|
||||
[25, 17],
|
||||
|
||||
Reference in New Issue
Block a user