%%-----------------------------------------------------------------------------
%% @Module  :       battle_field.hrl
%% @Author  :       J
%% @Email   :       j-som@foxmail.com
%% @Created :       2017-12-01
%% @Description:    战场
%%-----------------------------------------------------------------------------

%% 战场进入状态
-define(ROLE_STATE_OUT, 0).         %% 不在战场中
-define(ROLE_STATE_BEFORE_IN, 1).   %% 已经调用了change_scene但是还没有触发finish_change_scene
-define(ROLE_STATE_IN, 2).          %% 正在战场中

%% 在线状态
-define(ONLINE_STATE_OFF,    0).    %% 在线状态：离线
-define(ONLINE_STATE_ON,     1).    %% 在线状态：在线

-define(ETS_ROLE_BATTLE_PID, ets_role_battle_pid).  %% 玩家战场pid（主要用于断线重连）

-define(HAS_API(Mod, ApiName, ArgsNum), lists:member({ApiName, ArgsNum}, Mod:module_info(exports))).

-record(battle_state, {
    lib = lib_battle_field,
    cur_scene = 0,
    scene_pool_id = 0,
    copy_id = 0,
    data = #{},
    roles = #{},
    is_end = false,
    self = undefined
}).

-record(battle_role, {
    key= undefined,
    out_info = #{},     %% #{scene := SceneId, scene_pool_id := ScenePoolId, copy_id := CopyId, x := X, y := Y, scene_args := []}
    in_info = #{},      %% #{x := X, y := Y, scene_args := []}
    state = ?ROLE_STATE_OUT,
    online_state = ?ONLINE_STATE_ON,
    data = #{}
}).

-record(role_battle_pid, {
    id = 0,             %% 玩家id
    pid = none          %% 战斗pid
}).
