const std = @import("std");
const zm = @import("zmath");
const protocol = @import("protocol.zig");

pub const id = u64;
pub const INVALID_ID: id = 0;

pub const EntityKinds = .{
    Elf,
    Monster,
    Projectile,
};

pub const Elf = struct {
    id: id = INVALID_ID,
    pos: zm.Vec,
    hp: i32,

    pub fn update(self: *Elf) void {
        self.pos += zm.f32x4(1, 1, 0, 0);
    }

    pub fn to_message(self: *Elf) protocol.Elf_v1 {
        return protocol.Elf_v1.init(self);
    }
};

pub const Monster = struct {
    id: id = INVALID_ID,
    pos: zm.Vec,
    hp: i32,
};

pub const Projectile = struct {
    id: id = INVALID_ID,
    pos: zm.Vec,
    vel: zm.Vec,

    pub fn update(self: *Projectile) void {
        self.pos = self.pos + self.vel;
        std.log.info("pos=({})", .{self.pos});
    }
};
