artificer/src/api/combat_stats.zig
2024-08-28 01:20:28 +03:00

18 lines
536 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),
};
}