Status bringt konditionen mit

This commit is contained in:
Byroks committed 2026-11-04 16:27:44 +01:00
1 parent ce70c63918
commit 701638e9f0
5 files changed
+64 -79

No files matched your search

+3 -1
View File
@@ -207,7 +207,9 @@
"Effect": { "Effect": {
"Temporary": "Temporär", "Temporary": "Temporär",
"Passive": "Passiv", "Passive": "Passiv",
"Inactive": "Inaktiv" "Inactive": "Inaktiv",
"ToggleOn": "Aktivieren",
"ToggleOff": "Deaktivieren"
}, },
"Warnings": { "Warnings": {
"maxSpezReached": "Die Maximale Anzahl erlaubter Spezialisierungen für einen Skill sind erreicht" "maxSpezReached": "Die Maximale Anzahl erlaubter Spezialisierungen für einen Skill sind erreicht"
-75
View File
@@ -149,79 +149,4 @@ function defineSchema() {
export class CharacterData extends foundry.abstract.TypeDataModel { export class CharacterData extends foundry.abstract.TypeDataModel {
static defineSchema = defineSchema; static defineSchema = defineSchema;
prepareDerivedData() {
const actor = this.parent;
if (!actor) return;
const leben = this.resources.leben;
const ausdauer = this.resources.ausdauer;
const istVerwundet = leben.value <= 4;
const istErschöpft = ausdauer.value === 0;
const verwundetId = "verwundet";
const erschöpftId = "erschöpft";
if (istVerwundet && !actor.effects.find((x) => x.flags?.core?.statusId === verwundetId)) {
this._addVerwundetEffect(actor, verwundetId);
} else if (
!istVerwundet &&
actor.effects.find((x) => x.flags?.core?.statusId === verwundetId)
) {
actor.effects.get(verwundetId)?.delete();
}
if (istErschöpft && !actor.effects.find((x) => x.flags?.core?.statusId === erschöpftId)) {
this._addErschöpftEffect(actor, erschöpftId);
} else if (
!istErschöpft &&
actor.effects.find((x) => x.flags?.core?.statusId === erschöpftId)
) {
actor.effects.get(erschöpftId)?.delete();
}
}
async _addVerwundetEffect(actor, statusId) {
await ActiveEffect.create(
{
name: "Verwundet",
icon: "icons/svg/blood.svg",
changes: [
{ key: "@athletik.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
{
key: "@beweglichkeit.nachteil",
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
value: "1",
},
{ key: "@heimlichkeit.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
{
key: "@fingerfertigkeit.nachteil",
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
value: "1",
},
{ key: "@fernkampf.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
{ key: "@nahkampf.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
],
flags: { core: { statusId } },
},
{ parent: actor },
);
}
async _addErschöpftEffect(actor, statusId) {
await ActiveEffect.create(
{
name: "Erschöpft",
icon: "icons/svg/blood.svg",
changes: [
{ key: "@reflexe.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
{ key: "@willenskraft.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
{ key: "@zähigkeit.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
],
flags: { core: { statusId } },
},
{ parent: actor },
);
}
} }
+56
View File
@@ -22,6 +22,62 @@ import { M6ChatMessage } from "./ui/chat-message.mjs";
import "./styles/M6.scss"; import "./styles/M6.scss";
Hooks.once("init", () => { Hooks.once("init", () => {
CONFIG.statusEffects = [
{
id: "verwundet",
name: "Verwundet",
img: "icons/svg/bones.svg",
changes: [
{ key: "@athletik.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
{
key: "@beweglichkeit.nachteil",
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
value: "1",
},
{ key: "@heimlichkeit.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
{
key: "@fingerfertigkeit.nachteil",
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
value: "1",
},
{ key: "@fernkampf.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
{ key: "@nahkampf.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
],
},
{
id: "erschöpft",
name: "Erschöpft",
img: "icons/svg/downgrade.svg",
changes: [
{
key: "@reflexe.nachteil",
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
value: "1",
},
{
key: "@willenskraft.nachteil",
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
value: "1",
},
{
key: "@zähigkeit.nachteil",
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
value: "1",
},
],
},
{ id: "dead", name: "Tot", img: "icons/svg/skull.svg" },
{ id: "invisible", name: "Unsichtbar", img: "icons/svg/invisible.svg" },
{ id: "blind", name: "Blind", img: "icons/svg/blind.svg" },
];
CONFIG.specialStatusEffects = {
VERWUNDET: "verwundet",
ERSCHÖPFT: "erschöpft",
DEFEATED: "dead",
INVISIBLE: "invisible",
BLIND: "blind",
};
CONFIG.ChatMessage.documentClass = M6ChatMessage; CONFIG.ChatMessage.documentClass = M6ChatMessage;
CONFIG.ChatMessage.template = systemPath("templates/chat/message-default.hbs"); CONFIG.ChatMessage.template = systemPath("templates/chat/message-default.hbs");
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"id": "midgard6-lvd", "id": "midgard6-lvd",
"version": "0.9.0", "version": "1.1.0",
"title": "Midgard: Legenden von Damatu", "title": "Midgard: Legenden von Damatu",
"url": "", "url": "",
"description": "Eine Midgard: LvD implementation", "description": "Eine Midgard: LvD implementation",
+4 -2
View File
@@ -1,5 +1,6 @@
{{! Effects Tab }} {{! Effects Tab }}
<section class="tab effects flexcol scrollable {{tab.cssClass}}" data-group="primary" data-tab="effects"> <section class="tab effects flexcol scrollable {{tab.cssClass}}" data-group="primary" data-tab="effects">
<fieldset>
<ul class="effects-list"> <ul class="effects-list">
{{#each effects as |section sid|}} {{#each effects as |section sid|}}
<li class="effects-header flexrow draggable" data-effect-type="{{section.type}}"> <li class="effects-header flexrow draggable" data-effect-type="{{section.type}}">
@@ -21,7 +22,6 @@
data-img="icons/svg/aura.svg" data-img="icons/svg/aura.svg"
> >
<i class="fas fa-plus"></i> <i class="fas fa-plus"></i>
{{localize "DOCUMENT.New" type=(localize "UTS.Effect.Label")}}
</a> </a>
</div> </div>
</li> </li>
@@ -38,7 +38,7 @@
<div class="effect-duration">{{effect.duration.label}}</div> <div class="effect-duration">{{effect.duration.label}}</div>
<div class="document-controls flexrow"> <div class="document-controls flexrow">
{{#if @root.editable}} {{#if @root.editable}}
<a class="effect-control" data-action="toggleEffect" title="{{localize 'UTS.Effect.Toggle'}}"> <a class="effect-control" data-action="toggleEffect" title="{{#if effect.disabled}}{{localize 'Midgard6.Effect.ToggleOn'}}{{else}}{{localize 'Midgard6.Effect.ToggleOff'}}{{/if}}">
<i class="fas {{#if effect.disabled}}fa-check{{else}}fa-times{{/if}}"></i> <i class="fas {{#if effect.disabled}}fa-check{{else}}fa-times{{/if}}"></i>
</a> </a>
{{/if}} {{/if}}
@@ -54,6 +54,8 @@
</li> </li>
{{/each}} {{/each}}
</ul> </ul>
<hr>
{{/each}} {{/each}}
</ul> </ul>
</fieldset>
</section> </section>