27 lines
689 B
Zig
27 lines
689 B
Zig
const std = @import("std");
|
|
const json_utils = @import("../json_utils.zig");
|
|
const json = std.json;
|
|
|
|
const ElementalStat = @This();
|
|
|
|
pub const Element = enum {
|
|
water,
|
|
fire,
|
|
earth,
|
|
air,
|
|
};
|
|
|
|
pub const Array = std.EnumArray(ElementalStat.Element, ElementalStat);
|
|
|
|
attack: i64,
|
|
damage: i64,
|
|
resistance: i64,
|
|
|
|
pub fn parse(object: json.ObjectMap, attack: []const u8, damage: []const u8, resistance: []const u8) !ElementalStat {
|
|
return ElementalStat{
|
|
.attack = try json_utils.getIntegerRequired(object, attack),
|
|
.damage = try json_utils.getIntegerRequired(object, damage),
|
|
.resistance = try json_utils.getIntegerRequired(object, resistance),
|
|
};
|
|
}
|