18 lines
539 B
Zig
18 lines
539 B
Zig
const std = @import("std");
|
|
const json_utils = @import("../json_utils.zig");
|
|
const json = std.json;
|
|
|
|
const CombatStats = @This();
|
|
|
|
attack: i64,
|
|
damage: i64,
|
|
resistance: i64,
|
|
|
|
pub fn parse(object: json.ObjectMap, attack: []const u8, damage: []const u8, resistance: []const u8) !CombatStats {
|
|
return CombatStats{
|
|
.attack = try json_utils.getIntegerRequired(object, attack),
|
|
.damage = try json_utils.getIntegerRequired(object, damage),
|
|
.resistance = try json_utils.getIntegerRequired(object, resistance),
|
|
};
|
|
}
|