behavior3行为树
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 line
745 B

  1. %%%-------------------------------------------------------------------
  2. %%% @author DY
  3. %%% @copyright (C) 2020, <COMPANY>
  4. %%% @doc
  5. %%% 增加怒气
  6. %%% 根据add_rage增加相应怒气,结果小于等于100
  7. %%% 返回:SUCCESS
  8. %%% @end
  9. %%% Created : 07. 10月 2020 15:13
  10. %%%-------------------------------------------------------------------
  11. -module(action_add_rage).
  12. -include("eBhv3.hrl").
  13. -include("example.hrl").
  14. %% API
  15. -export([tick/2]).
  16. tick(#{properties := #{add_rage := AddRage}} = _BTree, #{cur_rage := CurRage} = State) ->
  17. State1 = State#{cur_rage := min(CurRage + AddRage, ?MAX_RAGE)},
  18. ?INFO("~ts:怒气值增加~w点 总怒气~w", [maps:get(uid, State1), AddRage, maps:get(cur_rage, State1)]),
  19. {?BT_SUCCESS, State1}.