From 36c4af70fb3cda46d553306b65d9a73b1d0220fc Mon Sep 17 00:00:00 2001 From: nsensfel Date: Tue, 8 Oct 2019 18:19:38 +0200 Subject: ... --- src/battle/mechanic/condition/blt_cond_heal.erl | 7 +- .../mechanic/skill/btl_skill_static_heal.erl | 137 +++++++++++++++++++++ src/battle/mechanic/skill/btl_static_heal.erl | 137 --------------------- 3 files changed, 140 insertions(+), 141 deletions(-) create mode 100644 src/battle/mechanic/skill/btl_skill_static_heal.erl delete mode 100644 src/battle/mechanic/skill/btl_static_heal.erl (limited to 'src/battle/mechanic') diff --git a/src/battle/mechanic/condition/blt_cond_heal.erl b/src/battle/mechanic/condition/blt_cond_heal.erl index 2479720..e67ae08 100644 --- a/src/battle/mechanic/condition/blt_cond_heal.erl +++ b/src/battle/mechanic/condition/blt_cond_heal.erl @@ -26,16 +26,15 @@ btl_character_turn_update:type() ) -> { - btl_condition:type(), - [ataxic:basic()], + [{btl_condition:type(), ataxic:basic()}], btl_character_turn_update:type() }. apply (Condition, Update) -> {TargetIX, Amount} = - case btl_condition:get_parameter(Condition) of + case btl_condition:get_parameters(Condition) of {StoredTargetIX, StoredAmount} -> {StoredTargetIX, StoredAmount}; Other -> error({condition, parameter, Other}) end, % TODO - {Condition, [], Update}. + {[{Condition, []}], Update}. diff --git a/src/battle/mechanic/skill/btl_skill_static_heal.erl b/src/battle/mechanic/skill/btl_skill_static_heal.erl new file mode 100644 index 0000000..7a9bf35 --- /dev/null +++ b/src/battle/mechanic/skill/btl_skill_static_heal.erl @@ -0,0 +1,137 @@ +-module(btl_skill_static_heal). +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-include("tacticians/skills.hrl") +-include("tacticians/conditions.hrl") + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-export +( + [ + cast/5 + ] +). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-spec cast_logic + ( + non_neg_integer(), + non_neg_integer(), + btl_character_turn_update:type() + ) + -> btl_character_turn_update:type(). +cast_logic (TargetIX, Amount, S0Update) -> + Healing = + btl_condition:new + ( + ?CONDITION_EFFECT_HEAL, + [], + -1, + 1, + {TargetIX, HealAmount} + ), + + {_S1HealindAndUpdate, S1Update} = + btl_cond_heal:apply + ( + Healing, + S0Update + ), + + % TODO: Add a btl_turn_result showing the heal to S1Update. + + S1Update. + +-spec group_cast_logic + ( + list(non_neg_integer()), + non_neg_integer(), + non_neg_integer(), + btl_character_turn_update:type() + ) + -> btl_character_turn_update:type(). +group_cast_logic (TargetIXs, MaxTargets, Amount, S0Update) -> + case (length(TargetIXs) > MaxTargets) of + true -> error({skill, target, TargetIXs}); + false -> ok + end, + + lists:foldl + ( + fun (TargetIX, S1Update) -> + cast_logic(Amount, TargetIX, S1Update) + end, + S0Update, + TargetIXs + ). + +-spec player_cast_logic + ( + non_neg_integer(), + non_neg_integer(), + btl_character_turn_update:type() + ) + -> btl_character_turn_update:type(). +player_cast_logic (TargetIX, Amount, S0Update) -> + Characters = todo, %TODO + TargetRef = todo, %TODO + TargetPlayerIX = todo, %TODO + + % TODO: + % apply `cast_logic(Amount, TargetIX, S1Update)` on all characters whose + % PlayerIX == TargetPlayerIX. + S0Update. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-spec cast + ( + shr_skill:variant(), + non_neg_integer(), + list(non_neg_integer()), + list(shr_location:type()), + btl_character_turn_update:type() + ) + -> btl_character_turn_update:type(). +cast (?SKILL_VARIANT_ALPHA_0, _UserIX, [TargetIX], _Locations, S0Update) -> + cast_logic(20, TargetIX, S0Update); +cast (?SKILL_VARIANT_ALPHA_1, _UserIX, [TargetIX], _Locations, S0Update) -> + cast_logic(40, TargetIX, S0Update); +cast (?SKILL_VARIANT_ALPHA_2, _UserIX, [TargetIX], _Locations, S0Update) -> + cast_logic(60, TargetIX, S0Update); +cast (?SKILL_VARIANT_ALPHA_3, _UserIX, [TargetIX], _Locations, S0Update) -> + cast_logic(80, TargetIX, S0Update); +cast (?SKILL_VARIANT_ALPHA_4, _UserIX, [TargetIX], _Locations, S0Update) -> + cast_logic(100, TargetIX, S0Update); +cast (?SKILL_VARIANT_PHI_0, _UserIX, TargetIXs, _Locations, S0Update) -> + group_cast_logic(TargetIXs, 2, 20, S0Update); +cast (?SKILL_VARIANT_PHI_1, _UserIX, TargetIXs, _Locations, S0Update) -> + group_cast_logic(TargetIXs, 2, 60, S0Update); +cast (?SKILL_VARIANT_PHI_2, _UserIX, TargetIXs, _Locations, S0Update) -> + group_cast_logic(TargetIXs, 2, 100, S0Update); +cast (?SKILL_VARIANT_PHI_3, _UserIX, TargetIXs, _Locations, S0Update) -> + group_cast_logic(TargetIXs, 4, 20, S0Update); +cast (?SKILL_VARIANT_PHI_4, _UserIX, TargetIXs, _Locations, S0Update) -> + group_cast_logic(TargetIXs, 4, 60, S0Update); +cast (?SKILL_VARIANT_PHI_5, _UserIX, TargetIXs, _Locations, S0Update) -> + group_cast_logic(TargetIXs, 4, 100, S0Update); +cast (?SKILL_VARIANT_PHI_6, _UserIX, TargetIXs, _Locations, S0Update) -> + group_cast_logic(TargetIXs, 8, 20, S0Update); +cast (?SKILL_VARIANT_PHI_7, _UserIX, TargetIXs, _Locations, S0Update) -> + group_cast_logic(TargetIXs, 8, 60, S0Update); +cast (?SKILL_VARIANT_PHI_8, _UserIX, TargetIXs, _Locations, S0Update) -> + group_cast_logic(TargetIXs, 8, 100, S0Update); +cast (?SKILL_VARIANT_PSI_0, _UserIX, [TargetIX], _Locations, S0Update) -> + player_cast_logic(TargetIX, 20, S0Update); +cast (?SKILL_VARIANT_PSI_1, _UserIX, [TargetIX], _Locations, S0Update) -> + player_cast_logic(TargetIX, 40, S0Update); +cast (?SKILL_VARIANT_PSI_2, _UserIX, [TargetIX], _Locations, S0Update) -> + player_cast_logic(TargetIX, 60, S0Update); +cast (?SKILL_VARIANT_PSI_3, _UserIX, [TargetIX], _Locations, S0Update) -> + player_cast_logic(TargetIX, 80, S0Update). diff --git a/src/battle/mechanic/skill/btl_static_heal.erl b/src/battle/mechanic/skill/btl_static_heal.erl deleted file mode 100644 index bb67463..0000000 --- a/src/battle/mechanic/skill/btl_static_heal.erl +++ /dev/null @@ -1,137 +0,0 @@ --module(btl_skill_static_heal). -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --include("tacticians/skills.hrl") --include("tacticians/conditions.hrl") - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --export -( - [ - cast/5 - ] -). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec cast_logic - ( - non_neg_integer(), - non_neg_integer(), - btl_character_turn_update:type() - ) - -> btl_character_turn_update:type(). -cast_logic (TargetIX, Amount, S0Update) -> - Healing = - btl_condition:new - ( - ?CONDITION_EFFECT_HEAL, - [], - -1, - 1, - {TargetIX, HealAmount} - ), - - {_S1Healing, _HealingUpdates, S1Update} = - btl_cond_heal:apply - ( - Healing, - S0Update - ), - - % TODO: Add a btl_turn_result showing the heal to S1Update. - - S1Update. - --spec group_cast_logic - ( - list(non_neg_integer()), - non_neg_integer(), - non_neg_integer(), - btl_character_turn_update:type() - ) - -> btl_character_turn_update:type(). -group_cast_logic (TargetIXs, MaxTargets, Amount, S0Update) -> - case (length(TargetIXs) > MaxTargets) of - true -> error({skill, target, TargetIXs}); - false -> ok - end, - - lists:foldl - ( - fun (TargetIX, S1Update) -> - cast_logic(Amount, TargetIX, S1Update) - end, - S0Update, - TargetIXs - ). - --spec player_cast_logic - ( - non_neg_integer(), - non_neg_integer(), - btl_character_turn_update:type() - ) - -> btl_character_turn_update:type(). -player_cast_logic (TargetIX, Amount, S0Update) -> - Characters = todo, %TODO - TargetRef = todo, %TODO - TargetPlayerIX = todo, %TODO - - % TODO: - % apply `cast_logic(Amount, TargetIX, S1Update)` on all characters whose - % PlayerIX == TargetPlayerIX. - S0Update. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec cast - ( - shr_skill:variant(), - non_neg_integer(), - list(non_neg_integer()), - list(shr_location:type()), - btl_character_turn_update:type() - ) - -> btl_character_turn_update:type(). -cast (?SKILL_VARIANT_ALPHA_0, _UserIX, [TargetIX], _Locations, S0Update) -> - cast_logic(20, TargetIX, S0Update); -cast (?SKILL_VARIANT_ALPHA_1, _UserIX, [TargetIX], _Locations, S0Update) -> - cast_logic(40, TargetIX, S0Update); -cast (?SKILL_VARIANT_ALPHA_2, _UserIX, [TargetIX], _Locations, S0Update) -> - cast_logic(60, TargetIX, S0Update); -cast (?SKILL_VARIANT_ALPHA_3, _UserIX, [TargetIX], _Locations, S0Update) -> - cast_logic(80, TargetIX, S0Update); -cast (?SKILL_VARIANT_ALPHA_4, _UserIX, [TargetIX], _Locations, S0Update) -> - cast_logic(100, TargetIX, S0Update); -cast (?SKILL_VARIANT_PHI_0, _UserIX, TargetIXs, _Locations, S0Update) -> - group_cast_logic(TargetIXs, 2, 20, S0Update); -cast (?SKILL_VARIANT_PHI_1, _UserIX, TargetIXs, _Locations, S0Update) -> - group_cast_logic(TargetIXs, 2, 60, S0Update); -cast (?SKILL_VARIANT_PHI_2, _UserIX, TargetIXs, _Locations, S0Update) -> - group_cast_logic(TargetIXs, 2, 100, S0Update); -cast (?SKILL_VARIANT_PHI_3, _UserIX, TargetIXs, _Locations, S0Update) -> - group_cast_logic(TargetIXs, 4, 20, S0Update); -cast (?SKILL_VARIANT_PHI_4, _UserIX, TargetIXs, _Locations, S0Update) -> - group_cast_logic(TargetIXs, 4, 60, S0Update); -cast (?SKILL_VARIANT_PHI_5, _UserIX, TargetIXs, _Locations, S0Update) -> - group_cast_logic(TargetIXs, 4, 100, S0Update); -cast (?SKILL_VARIANT_PHI_6, _UserIX, TargetIXs, _Locations, S0Update) -> - group_cast_logic(TargetIXs, 8, 20, S0Update); -cast (?SKILL_VARIANT_PHI_7, _UserIX, TargetIXs, _Locations, S0Update) -> - group_cast_logic(TargetIXs, 8, 60, S0Update); -cast (?SKILL_VARIANT_PHI_8, _UserIX, TargetIXs, _Locations, S0Update) -> - group_cast_logic(TargetIXs, 8, 100, S0Update); -cast (?SKILL_VARIANT_PSI_0, _UserIX, [TargetIX], _Locations, S0Update) -> - player_cast_logic(TargetIX, 20, S0Update); -cast (?SKILL_VARIANT_PSI_1, _UserIX, [TargetIX], _Locations, S0Update) -> - player_cast_logic(TargetIX, 40, S0Update); -cast (?SKILL_VARIANT_PSI_2, _UserIX, [TargetIX], _Locations, S0Update) -> - player_cast_logic(TargetIX, 60, S0Update); -cast (?SKILL_VARIANT_PSI_3, _UserIX, [TargetIX], _Locations, S0Update) -> - player_cast_logic(TargetIX, 80, S0Update). -- cgit v1.2.3-70-g09d2