dsa-4th-edition/zig/system.zig
2024-12-19 10:28:29 +01:00

175 lines
4.0 KiB
Zig

const foundry = @import("foundry.zig");
const String = []const u8;
pub const SYSTEM_NAME = "dsa-4th-edition";
pub const SYSTEM_VERSION = "0.1.5";
pub const ItemCompendium = foundry.Compendium(.Item, union(enum) {
const Entry = @This();
Folder: struct {
name: String,
entries: []const Entry,
},
Gegenstand: foundry.Item("Gegenstand", struct {
gewicht: f64 = 0,
preis: f64 = 0,
}),
Ruestung: foundry.Item("Ruestung", struct {
gewicht: f64 = 0,
preis: f64 = 0,
kopf: u8 = 0,
brust: u8 = 0,
ruecken: u8 = 0,
bauch: u8 = 0,
linker_arm: u8 = 0,
rechter_arm: u8 = 0,
linkes_bein: u8 = 0,
rechtes_bein: u8 = 0,
gesamt_ruestungsschutz: f64 = 0,
gesamt_behinderung: f64 = 0,
}),
Bewaffnung: foundry.Item("Bewaffnung", struct {
gewicht: f64 = 0,
preis: f64 = 0,
nahkampfwaffe: struct {
aktiv: bool = false,
basis: String = "1d4",
schwellenwert: u8 = 0,
schadensschritte: u8 = 0,
modifikator_attacke: i8 = 0,
modifikator_parade: i8 = 0,
initiative: i8 = 0,
bruchfaktor: i8 = 0,
distanzklasse: String = "",
kampftalente: String = "",
laenge: u8 = 0,
zweihaendig: bool = false,
werfbar: bool = false,
improvisiert: bool = false,
priviligiert: bool = false,
} = .{},
parierwaffe: struct {
aktiv: bool = false,
modifikator_attacke: i8 = 0,
modifikator_parade: i8 = 0,
initiative: i8 = 0,
bruchfaktor: i8 = 0,
} = .{},
schild: struct {
aktiv: bool = false,
groesse: String = "klein",
modifikator_attacke: i8 = 0,
modifikator_parade: i8 = 0,
initiative: i8 = 0,
bruchfaktor: i8 = 0,
} = .{},
fernkampfwaffe: struct {
aktiv: bool = false,
basis: String = "1d4",
laden: u8 = 0,
reichweite1: u8 = 0,
reichweite2: u8 = 0,
reichweite3: u8 = 0,
reichweite4: u8 = 0,
reichweite5: u8 = 0,
modifikator1: ?i8 = null,
modifikator2: ?i8 = null,
modifikator3: ?i8 = null,
modifikator4: ?i8 = null,
modifikator5: ?i8 = null,
munitionskosten: u8 = 0,
munitionsgewicht: u8 = 0,
} = .{},
}),
Talent: foundry.Item("Talent", struct {
kategorie: enum {
koerperliche,
gesellschaftliche,
natur,
wissens,
handwerks,
},
behinderung: String = "",
attribute1: Attribute,
attribute2: Attribute,
attribute3: Attribute,
talentwert: u8 = 0,
}),
Kampftalent: foundry.Item("Kampftalent", struct {
kategorie: enum {
waffenlos,
nahkampf,
fernkampf,
},
steigern: enum {
A_Star,
A,
B,
C,
D,
E,
F,
G,
H,
},
behinderung: String = "",
beschreibung: String = "",
talentwert: u8 = 0,
attacke: u8 = 0,
parade: u8 = 0,
}),
});
const Attribute = enum {
MU,
KL,
IN,
CH,
FF,
GE,
KO,
KK,
pub fn jsonStringify(self: @This(), out: anytype) !void {
const attribute = switch (self) {
.MU => "courage",
.KL => "cleverness",
.IN => "intuition",
.CH => "charisma",
.FF => "dexterity",
.GE => "agility",
.KO => "constitution",
.KK => "strength",
};
try out.write(attribute);
}
};