Status bringt konditionen mit
This commit is contained in:
1 parent
ce70c63918
commit
701638e9f0
5 files changed
+64
-79
No files matched your search
+3
-1
@@ -207,7 +207,9 @@
|
||||
"Effect": {
|
||||
"Temporary": "Temporär",
|
||||
"Passive": "Passiv",
|
||||
"Inactive": "Inaktiv"
|
||||
"Inactive": "Inaktiv",
|
||||
"ToggleOn": "Aktivieren",
|
||||
"ToggleOff": "Deaktivieren"
|
||||
},
|
||||
"Warnings": {
|
||||
"maxSpezReached": "Die Maximale Anzahl erlaubter Spezialisierungen für einen Skill sind erreicht"
|
||||
|
||||
@@ -149,79 +149,4 @@ function defineSchema() {
|
||||
|
||||
export class CharacterData extends foundry.abstract.TypeDataModel {
|
||||
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 },
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,62 @@ import { M6ChatMessage } from "./ui/chat-message.mjs";
|
||||
import "./styles/M6.scss";
|
||||
|
||||
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.template = systemPath("templates/chat/message-default.hbs");
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"id": "midgard6-lvd",
|
||||
"version": "0.9.0",
|
||||
"version": "1.1.0",
|
||||
"title": "Midgard: Legenden von Damatu",
|
||||
"url": "",
|
||||
"description": "Eine Midgard: LvD implementation",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{{! Effects Tab }}
|
||||
<section class="tab effects flexcol scrollable {{tab.cssClass}}" data-group="primary" data-tab="effects">
|
||||
<fieldset>
|
||||
<ul class="effects-list">
|
||||
{{#each effects as |section sid|}}
|
||||
<li class="effects-header flexrow draggable" data-effect-type="{{section.type}}">
|
||||
@@ -21,7 +22,6 @@
|
||||
data-img="icons/svg/aura.svg"
|
||||
>
|
||||
<i class="fas fa-plus"></i>
|
||||
{{localize "DOCUMENT.New" type=(localize "UTS.Effect.Label")}}
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
@@ -38,7 +38,7 @@
|
||||
<div class="effect-duration">{{effect.duration.label}}</div>
|
||||
<div class="document-controls flexrow">
|
||||
{{#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>
|
||||
</a>
|
||||
{{/if}}
|
||||
@@ -54,6 +54,8 @@
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
<hr>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</fieldset>
|
||||
</section>
|
||||
Reference in new issue
Block a user