diff --git a/src/ActorSheet.hbs b/src/ActorSheet.hbs index a4eddb2..7f083fd 100644 --- a/src/ActorSheet.hbs +++ b/src/ActorSheet.hbs @@ -32,9 +32,15 @@ {{>die-value type=@key header=(localize (concat "DSA41.attributes.short." @key)) value=(lookup @root.actor.system.computed.attributes @key) success-value=(lookup @root.actor.system.computed.attributes @key) data-roll="1d20" data-tooltip="attribute_tooltip"}} {{/each}} -
-
- {{>editable-input type="number" name="system.lebenspunkte" value=actor.system.lebenspunkte}} / {{actor.system.computed.max_lebenspunkte}} +
+
+ {{>editable-input type="number" name="system.lebenspunkte.aktuell" value=actor.system.lebenspunkte.aktuell}} / {{actor.system.computed.lebenspunkte.max}} +
+
+ {{>editable-input type="number" name="system.ausdauer.aktuell" value=actor.system.ausdauer.aktuell}} / {{actor.system.computed.ausdauer.max}} +
+
+ {{>editable-input type="number" name="system.astralenergie.aktuell" value=actor.system.astralenergie.aktuell}} / {{actor.system.computed.astralenergie.max}}
@@ -81,26 +87,88 @@ {{/each}}
-
- Lebenspunkte - {{actor.system.computed.max_lebenspunkte}} - Ausdauer - {{actor.system.computed.max_ausdauer}} - Astralenergie - {{actor.system.computed.max_atralenergie}} - Magieresistenz - {{actor.system.computed.magieresistenz}} +
+
+ + {{localize "DSA41.basiswerte.label_basiswert"}} + {{localize "DSA41.basiswerte.label_modifikator"}} + {{localize "DSA41.basiswerte.label_zukauf"}} + {{localize "DSA41.basiswerte.label_verlust"}} + {{localize "DSA41.basiswerte.label_total"}} +
- INI-Basiswert - {{actor.system.computed.ini_basiswert}} - AT-Basiswert - {{actor.system.computed.at_basiswert}} +
+ {{localize "DSA41.basiswerte.lebenspunkte"}} + {{actor.system.computed.lebenspunkte.basiswert}} + {{>editable-input type="number" name="system.lebenspunkte.modifikator" value=actor.system.lebenspunkte.modifikator}} + {{>editable-input type="number" name="system.lebenspunkte.zukauf" value=actor.system.lebenspunkte.zukauf}} + {{>editable-input type="number" name="system.lebenspunkte.verlust" value=actor.system.lebenspunkte.verlust}} + {{actor.system.computed.lebenspunkte.max}} +
- PA-Basiswert - {{actor.system.computed.pa_basiswert}} - FK-Basiswert - {{actor.system.computed.fk_basiswert}} +
+ {{localize "DSA41.basiswerte.ausdauer"}} + {{actor.system.computed.ausdauer.basiswert}} + {{>editable-input type="number" name="system.ausdauer.modifikator" value=actor.system.ausdauer.modifikator}} + {{>editable-input type="number" name="system.ausdauer.zukauf" value=actor.system.ausdauer.zukauf}} + {{>editable-input type="number" name="system.ausdauer.verlust" value=actor.system.ausdauer.verlust}} + {{actor.system.computed.ausdauer.max}} +
+ +
+ {{localize "DSA41.basiswerte.astralenergie"}} + {{actor.system.computed.astralenergie.basiswert}} + {{>editable-input type="number" name="system.astralenergie.modifikator" value=actor.system.astralenergie.modifikator}} + {{>editable-input type="number" name="system.astralenergie.zukauf" value=actor.system.astralenergie.zukauf}} + {{>editable-input type="number" name="system.astralenergie.verlust" value=actor.system.astralenergie.verlust}} + {{actor.system.computed.astralenergie.max}} +
+ +
+ {{localize "DSA41.basiswerte.magieresistenz"}} + {{actor.system.computed.magieresistenz.basiswert}} + {{>editable-input type="number" name="system.magieresistenz.modifikator" value=actor.system.magieresistenz.modifikator}} + {{>editable-input type="number" name="system.magieresistenz.zukauf" value=actor.system.magieresistenz.zukauf}} + + {{actor.system.computed.magieresistenz.max}} +
+ +
+ {{localize "DSA41.basiswerte.initiative"}} + {{actor.system.computed.initiative.basiswert}} + {{>editable-input type="number" name="system.modifikator_initiative" value=actor.system.modifikator_initiative}} + + + {{actor.system.computed.initiative.wert}} +
+ +
+ {{localize "DSA41.basiswerte.attacke"}} + {{actor.system.computed.attacke.basiswert}} + {{>editable-input type="number" name="system.modifikator_attacke" value=actor.system.modifikator_attacke}} + + + {{actor.system.computed.attacke.wert}} +
+ +
+ {{localize "DSA41.basiswerte.parade"}} + {{actor.system.computed.parade.basiswert}} + {{>editable-input type="number" name="system.modifikator_parade" value=actor.system.modifikator_parade}} + + + {{actor.system.computed.parade.wert}} +
+ +
+ {{localize "DSA41.basiswerte.fernkampf"}} + {{actor.system.computed.fernkampf.basiswert}} + {{>editable-input type="number" name="system.modifikator_fernkampf" value=actor.system.modifikator_fernkampf}} + + + {{actor.system.computed.fernkampf.wert}} +
diff --git a/src/EditableInput.hbs b/src/EditableInput.hbs index 21ed573..b893feb 100644 --- a/src/EditableInput.hbs +++ b/src/EditableInput.hbs @@ -1,8 +1,8 @@
{{#if (eq type "checkbox")}} - + {{else}} - + {{/if}} {{#if placeholder}} diff --git a/src/lang/de.json b/src/lang/de.json index 99d3d50..4e3b4ac 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -36,6 +36,23 @@ "talentwert_short": "TaW" }, + "basiswerte": { + "label_basiswert": "Basiswert", + "label_modifikator": "Modifikator", + "label_zukauf": "Zukauf", + "label_verlust": "Verlust", + "label_total": "Total", + + "lebenspunkte": "Lebenspunkte", + "ausdauer": "Ausdauer", + "astralenergie": "Astralenergie", + "magieresistenz": "Magieresistenz", + "initiative": "Initiative", + "attacke": "Attacke", + "parade": "Parade", + "fernkampf": "Fernkampf" + }, + "vornachteil": { "label_vorteile": "Vorteile", "label_nachteile": "Nachteile", diff --git a/src/main.css b/src/main.css index 5b06018..9416b1c 100644 --- a/src/main.css +++ b/src/main.css @@ -224,6 +224,16 @@ html { --bar-color-left: #401f25; --bar-color-right: #861212; } + + &.ausdauer { + --bar-color-left: #114f0c; + --bar-color-right: #178010; + } + + &.astralenergie { + --bar-color-left: #0e1155; + --bar-color-right: #141cb7; + } } @@ -332,10 +342,14 @@ html { gap: 0.5rem; } - & .Basiswerte { display: grid; - grid-template-columns: repeat(4, minmax(0, 1fr)); + grid-template-columns: minmax(0, max-content) repeat(5, minmax(0, 1fr)); + align-items: center; + + & .list-header :not(:nth-child(1)), .list-item :not(:nth-child(1)) { + text-align: center; + } } & .Sonderfertigkeiten { diff --git a/src/main.mjs b/src/main.mjs index bcea8d1..3f2f651 100644 --- a/src/main.mjs +++ b/src/main.mjs @@ -132,18 +132,6 @@ class AttributeField extends SchemaField { } } -class CombatTalentField extends SchemaField { - constructor() { - return super({ - talentwert: new NumberField({ integer: true, initial: 0 }), - attacke: new NumberField({ integer: true, initial: 0 }), - parade: new NumberField({ integer: true, initial: 0 }), - }); - } -} - - - class DSA41_CharacterDocument extends Actor { static async create(data, operation) { const actor = await super.create(data, operation); @@ -210,8 +198,6 @@ class DSA41_CharacterData extends TypeDataModel { profession: new StringField(), sozialstatus: new NumberField({ integer: true, inital: 1 }), - lebenspunkte: new NumberField({ integer: true, intital: 0 }), - attributes: new SchemaField({ courage: new AttributeField(), cleverness: new AttributeField(), @@ -222,6 +208,42 @@ class DSA41_CharacterData extends TypeDataModel { constitution: new AttributeField(), strength: new AttributeField(), }), + + lebenspunkte: new SchemaField({ + modifikator: new NumberField({integer: true, initial: 0}), + zukauf: new NumberField({integer: true, initial: 0}), + verlust: new NumberField({integer: true, initial: 0}), + + aktuell: new NumberField({integer: true, initial: 0}), + }), + + ausdauer: new SchemaField({ + modifikator: new NumberField({integer: true, initial: 0}), + zukauf: new NumberField({integer: true, initial: 0}), + verlust: new NumberField({integer: true, initial: 0}), + + aktuell: new NumberField({integer: true, initial: 0}), + }), + + astralenergie: new SchemaField({ + modifikator: new NumberField({integer: true, initial: 0}), + zukauf: new NumberField({integer: true, initial: 0}), + verlust: new NumberField({integer: true, initial: 0}), + + aktuell: new NumberField({integer: true, initial: 0}), + }), + + magieresistenz: new SchemaField({ + modifikator: new NumberField({integer: true, initial: 0}), + zukauf: new NumberField({integer: true, initial: 0}), + + aktuell: new NumberField({integer: true, initial: 0}), + }), + + modifikator_initiative: new NumberField({integer: true, initial: 0}), + modifikator_attacke: new NumberField({integer: true, initial: 0}), + modifikator_parade: new NumberField({integer: true, initial: 0}), + modifikator_fernkampf: new NumberField({integer: true, initial: 0}), } } @@ -257,17 +279,40 @@ class DSA41_CharacterData extends TypeDataModel { this.computed.attributes_without_modifiers[attribute] = values.initial + values.advancement; } - this.computed.max_lebenspunkte = Math.round((this.computed.attributes_without_modifiers.constitution + this.computed.attributes_without_modifiers.constitution + this.computed.attributes_without_modifiers.strength) / 2); - this.computed.max_ausdauer = Math.round((this.computed.attributes_without_modifiers.courage + this.computed.attributes_without_modifiers.constitution + this.computed.attributes_without_modifiers.agility) / 2); - this.computed.max_atralenergie = Math.round((this.computed.attributes_without_modifiers.courage + this.computed.attributes_without_modifiers.intuition + this.computed.attributes_without_modifiers.charisma) / 2); + this.computed.lebenspunkte = {}; + this.computed.ausdauer = {}; + this.computed.astralenergie = {}; + this.computed.magieresistenz = {}; - this.computed.lebenspunkte_prozent = (this.lebenspunkte / this.computed.max_lebenspunkte) * 100; + this.computed.lebenspunkte.basiswert = Math.round((this.computed.attributes_without_modifiers.constitution + this.computed.attributes_without_modifiers.constitution + this.computed.attributes_without_modifiers.strength) / 2); + this.computed.ausdauer.basiswert = Math.round((this.computed.attributes_without_modifiers.courage + this.computed.attributes_without_modifiers.constitution + this.computed.attributes_without_modifiers.agility) / 2); + this.computed.astralenergie.basiswert = Math.round((this.computed.attributes_without_modifiers.courage + this.computed.attributes_without_modifiers.intuition + this.computed.attributes_without_modifiers.charisma) / 2); + this.computed.magieresistenz.basiswert = Math.round((this.computed.attributes_without_modifiers.courage + this.computed.attributes_without_modifiers.cleverness + this.computed.attributes_without_modifiers.constitution) / 5); - this.computed.magieresistenz = Math.round((this.computed.attributes_without_modifiers.courage + this.computed.attributes_without_modifiers.cleverness + this.computed.attributes_without_modifiers.constitution) / 5); - this.computed.ini_basiswert = Math.round((this.computed.attributes_without_modifiers.courage + this.computed.attributes_without_modifiers.courage + this.computed.attributes_without_modifiers.intuition + this.computed.attributes_without_modifiers.agility) / 5); - this.computed.at_basiswert = Math.round((this.computed.attributes_without_modifiers.courage + this.computed.attributes_without_modifiers.agility + this.computed.attributes_without_modifiers.strength) / 5);; - this.computed.pa_basiswert = Math.round((this.computed.attributes_without_modifiers.intuition + this.computed.attributes_without_modifiers.agility + this.computed.attributes_without_modifiers.strength) / 5);; - this.computed.fk_basiswert = Math.round((this.computed.attributes_without_modifiers.intuition + this.computed.attributes_without_modifiers.dexterity + this.computed.attributes_without_modifiers.strength) / 5);; + this.computed.lebenspunkte.max = this.computed.lebenspunkte.basiswert + this.lebenspunkte.modifikator + this.lebenspunkte.zukauf - this.lebenspunkte.verlust; + this.computed.ausdauer.max = this.computed.ausdauer.basiswert + this.ausdauer.modifikator + this.ausdauer.zukauf - this.ausdauer.verlust; + this.computed.astralenergie.max = this.computed.astralenergie.basiswert + this.astralenergie.modifikator + this.astralenergie.zukauf - this.astralenergie.verlust; + this.computed.magieresistenz.max = this.computed.magieresistenz.basiswert + this.magieresistenz.modifikator + this.magieresistenz.zukauf; + + this.computed.lebenspunkte.prozent = this.lebenspunkte.aktuell / this.computed.lebenspunkte.max * 100; + this.computed.ausdauer.prozent = this.ausdauer.aktuell / this.computed.ausdauer.max * 100; + this.computed.astralenergie.prozent = this.astralenergie.aktuell / this.computed.astralenergie.max * 100; + this.computed.magieresistenz.prozent = this.magieresistenz.aktuell / this.computed.magieresistenz.max * 100; + + this.computed.initiative = {}; + this.computed.attacke = {}; + this.computed.parade = {}; + this.computed.fernkampf = {}; + + this.computed.initiative.basiswert = Math.round((this.computed.attributes_without_modifiers.courage + this.computed.attributes_without_modifiers.courage + this.computed.attributes_without_modifiers.intuition + this.computed.attributes_without_modifiers.agility) / 5); + this.computed.attacke.basiswert = Math.round((this.computed.attributes_without_modifiers.courage + this.computed.attributes_without_modifiers.agility + this.computed.attributes_without_modifiers.strength) / 5); + this.computed.parade.basiswert = Math.round((this.computed.attributes_without_modifiers.intuition + this.computed.attributes_without_modifiers.agility + this.computed.attributes_without_modifiers.strength) / 5); + this.computed.fernkampf.basiswert = Math.round((this.computed.attributes_without_modifiers.intuition + this.computed.attributes_without_modifiers.dexterity + this.computed.attributes_without_modifiers.strength) / 5); + + this.computed.initiative.wert = this.computed.initiative.basiswert + this.modifikator_initiative; + this.computed.attacke.wert = this.computed.attacke.basiswert + this.modifikator_attacke; + this.computed.parade.wert = this.computed.parade.basiswert + this.modifikator_parade; + this.computed.fernkampf.wert = this.computed.fernkampf.basiswert + this.modifikator_fernkampf; const equipped_ruestungen = this.parent.items.filter((x) => x.type === "Ruestung"); for (const item of equipped_ruestungen) {