add bars for Ausdauer and Astralenergie, make basiswerte have modifiers

This commit is contained in:
Sven Balzer 2024-12-19 14:28:42 +01:00
parent 4079a40d6b
commit fea5de6596
5 changed files with 191 additions and 47 deletions

View File

@ -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}}
</div>
<div class="col">
<div class="bar hp" style="--bar-percentage: {{actor.system.computed.lebenspunkte_prozent}}%;">
{{>editable-input type="number" name="system.lebenspunkte" value=actor.system.lebenspunkte}} / <span>{{actor.system.computed.max_lebenspunkte}}</span>
<div class="grid3">
<div class="bar hp" style="--bar-percentage: {{actor.system.computed.lebenspunkte.prozent}}%;">
{{>editable-input type="number" name="system.lebenspunkte.aktuell" value=actor.system.lebenspunkte.aktuell}} / <span>{{actor.system.computed.lebenspunkte.max}}</span>
</div>
<div class="bar ausdauer" style="--bar-percentage: {{actor.system.computed.ausdauer.prozent}}%;">
{{>editable-input type="number" name="system.ausdauer.aktuell" value=actor.system.ausdauer.aktuell}} / <span>{{actor.system.computed.ausdauer.max}}</span>
</div>
<div class="bar astralenergie" style="--bar-percentage: {{actor.system.computed.astralenergie.prozent}}%;">
{{>editable-input type="number" name="system.astralenergie.aktuell" value=actor.system.astralenergie.aktuell}} / <span>{{actor.system.computed.astralenergie.max}}</span>
</div>
</div>
</div>
@ -81,26 +87,88 @@
{{/each}}
</div>
</fieldset>
<div class="Basiswerte">
<span>Lebenspunkte</span>
<span>{{actor.system.computed.max_lebenspunkte}}</span>
<span>Ausdauer</span>
<span>{{actor.system.computed.max_ausdauer}}</span>
<span>Astralenergie</span>
<span>{{actor.system.computed.max_atralenergie}}</span>
<span>Magieresistenz</span>
<span>{{actor.system.computed.magieresistenz}}</span>
<div class="list Basiswerte">
<div class="list-header">
<span></span>
<span>{{localize "DSA41.basiswerte.label_basiswert"}}</span>
<span>{{localize "DSA41.basiswerte.label_modifikator"}}</span>
<span>{{localize "DSA41.basiswerte.label_zukauf"}}</span>
<span>{{localize "DSA41.basiswerte.label_verlust"}}</span>
<span>{{localize "DSA41.basiswerte.label_total"}}</span>
</div>
<span>INI-Basiswert</span>
<span>{{actor.system.computed.ini_basiswert}}</span>
<span>AT-Basiswert</span>
<span>{{actor.system.computed.at_basiswert}}</span>
<div class="list-item">
<span>{{localize "DSA41.basiswerte.lebenspunkte"}}</span>
<span>{{actor.system.computed.lebenspunkte.basiswert}}</span>
<span>{{>editable-input type="number" name="system.lebenspunkte.modifikator" value=actor.system.lebenspunkte.modifikator}}</span>
<span>{{>editable-input type="number" name="system.lebenspunkte.zukauf" value=actor.system.lebenspunkte.zukauf}}</span>
<span>{{>editable-input type="number" name="system.lebenspunkte.verlust" value=actor.system.lebenspunkte.verlust}}</span>
<span>{{actor.system.computed.lebenspunkte.max}}</span>
</div>
<span>PA-Basiswert</span>
<span>{{actor.system.computed.pa_basiswert}}</span>
<span>FK-Basiswert</span>
<span>{{actor.system.computed.fk_basiswert}}</span>
<div class="list-item">
<span>{{localize "DSA41.basiswerte.ausdauer"}}</span>
<span>{{actor.system.computed.ausdauer.basiswert}}</span>
<span>{{>editable-input type="number" name="system.ausdauer.modifikator" value=actor.system.ausdauer.modifikator}}</span>
<span>{{>editable-input type="number" name="system.ausdauer.zukauf" value=actor.system.ausdauer.zukauf}}</span>
<span>{{>editable-input type="number" name="system.ausdauer.verlust" value=actor.system.ausdauer.verlust}}</span>
<span>{{actor.system.computed.ausdauer.max}}</span>
</div>
<div class="list-item">
<span>{{localize "DSA41.basiswerte.astralenergie"}}</span>
<span>{{actor.system.computed.astralenergie.basiswert}}</span>
<span>{{>editable-input type="number" name="system.astralenergie.modifikator" value=actor.system.astralenergie.modifikator}}</span>
<span>{{>editable-input type="number" name="system.astralenergie.zukauf" value=actor.system.astralenergie.zukauf}}</span>
<span>{{>editable-input type="number" name="system.astralenergie.verlust" value=actor.system.astralenergie.verlust}}</span>
<span>{{actor.system.computed.astralenergie.max}}</span>
</div>
<div class="list-item">
<span>{{localize "DSA41.basiswerte.magieresistenz"}}</span>
<span>{{actor.system.computed.magieresistenz.basiswert}}</span>
<span>{{>editable-input type="number" name="system.magieresistenz.modifikator" value=actor.system.magieresistenz.modifikator}}</span>
<span>{{>editable-input type="number" name="system.magieresistenz.zukauf" value=actor.system.magieresistenz.zukauf}}</span>
<span></span>
<span>{{actor.system.computed.magieresistenz.max}}</span>
</div>
<div class="list-item">
<span>{{localize "DSA41.basiswerte.initiative"}}</span>
<span>{{actor.system.computed.initiative.basiswert}}</span>
<span>{{>editable-input type="number" name="system.modifikator_initiative" value=actor.system.modifikator_initiative}}</span>
<span></span>
<span></span>
<span>{{actor.system.computed.initiative.wert}}</span>
</div>
<div class="list-item">
<span>{{localize "DSA41.basiswerte.attacke"}}</span>
<span>{{actor.system.computed.attacke.basiswert}}</span>
<span>{{>editable-input type="number" name="system.modifikator_attacke" value=actor.system.modifikator_attacke}}</span>
<span></span>
<span></span>
<span>{{actor.system.computed.attacke.wert}}</span>
</div>
<div class="list-item">
<span>{{localize "DSA41.basiswerte.parade"}}</span>
<span>{{actor.system.computed.parade.basiswert}}</span>
<span>{{>editable-input type="number" name="system.modifikator_parade" value=actor.system.modifikator_parade}}</span>
<span></span>
<span></span>
<span>{{actor.system.computed.parade.wert}}</span>
</div>
<div class="list-item">
<span>{{localize "DSA41.basiswerte.fernkampf"}}</span>
<span>{{actor.system.computed.fernkampf.basiswert}}</span>
<span>{{>editable-input type="number" name="system.modifikator_fernkampf" value=actor.system.modifikator_fernkampf}}</span>
<span></span>
<span></span>
<span>{{actor.system.computed.fernkampf.wert}}</span>
</div>
</div>
<div class="grid2 gap">

View File

@ -1,8 +1,8 @@
<div class="editable-input editable-{{type}} {{class}}">
{{#if (eq type "checkbox")}}
<input type="checkbox" name="{{name}}" data-name="{{data-name}}" {{checked value}}>
<input type="checkbox" name="{{name}}" {{#if data-name}}data-name="{{data-name}}"{{/if}} {{checked value}}>
{{else}}
<input type="{{type}}" name="{{name}}" data-name="{{data-name}}" value="{{value}}" placeholder="{{placeholder}}">
<input type="{{type}}" name="{{name}}" {{#if data-name}}data-name="{{data-name}}"{{/if}} value="{{value}}" placeholder="{{placeholder}}">
{{/if}}
{{#if placeholder}}

View File

@ -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",

View File

@ -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 {

View File

@ -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) {