include "Math/Vec3f.fbs";

namespace pkNX.Structures.FlatBuffers.Arceus;
attribute "fs_serializer";

table PokeAI {
    Species:int;
    Form:int;
    IsAlpha:bool;
    Behavior1:string (required);
    Behavior2:string (required);
    Behavior3:string (required);
    Field_06:bool;
    Field_07:ulong = 2458747221614355867;
    Field_08:bool = true; // always true
    Field_09:PokeAI_F09 (required);
    Field_10:bool = true; // always true
    Field_11:PokeAI_F09;
    Field_12:bool = true; // always true except for Darkrai
    Field_13:PokeAI_F09;
    Field_14:bool = true; // always true
    Field_15:PokeAI_F09;
    Field_16:bool = true; // always true
    Field_17:PokeAI_F09 (required);
    Field_18:PokeAI_F18 (required); // only used by Kleavor-1
    Field_19:PokeAI_F18 (required); // assumed same as above, none use
    Field_20:PokeAI_F18 (required); // assumed same as above, none use
    Field_21:PokeAI_F18 (required); // assumed same as above, only used by Kleavor-1 with fields 0,1,2
    MoveEffect1:string (required);
    MoveEffect2:string (required);
    Field_24:PokeAI_F24 (required);
    Field_25:float = 20;
    Field_26:float = 30;
    Field_27:Vec3f (required); // new(20, 50, 100);
    Field_28:Vec3f (required); // new(20, 50, 100);
    Field_29:Vec3f (required); // new(20, 50, 100);
    Field_30:Vec3f (required); // new(15, 10, 15);
    Field_31:int;
    Field_32:int = -1;
    Field_33:int;
    Field_34:float; // cascoon/silcoon
}

table PokeAI_F24 {
    Field_00:float = 7;
}

table PokeAI_F18 {
    Field_00:bool;
    Field_01:float;
    Field_02:float;
    Field_03:float;
    Field_04:float;
}

table PokeAI_F09 {
    Field_00:PokeAIBehaviour (required);
    Field_01:PokeAIBehaviour (required);
    Field_02:PokeAIBehaviour (required);
    Field_03:PokeAIBehaviour (required);
    Field_04:PokeAIBehaviour (required);
    Field_05:PokeAIBehaviour (required);
    Field_06:PokeAIBehaviour (required);
    Field_07:PokeAIBehaviour (required);
    Field_08:PokeAIBehaviour (required);
}

table PokeAIBehaviour {
    BehaviourHash:ulong = 9252365659083253459 (key);
    Parameters:[string] (required); // { "0.5", "35" };
}

table PokeAIArchive (fs_serializer) {
    Table:[PokeAI] (required);
}

root_type PokeAIArchive;
