1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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).
|