summaryrefslogtreecommitdiff
path: root/actions.c
diff options
context:
space:
mode:
Diffstat (limited to 'actions.c')
-rw-r--r--actions.c60
1 files changed, 34 insertions, 26 deletions
diff --git a/actions.c b/actions.c
index 5ab45b4..f5a06f1 100644
--- a/actions.c
+++ b/actions.c
@@ -7,7 +7,7 @@
#include "target.h"
#include "character.h"
-static int compute_damages(const struct character_t *src, const struct character_t *dest,
+static int compute_damages(const struct chr_t *src, const struct chr_t *dest,
enum damages_type_t type, enum element_t element)
{
int avg;
@@ -15,7 +15,7 @@ static int compute_damages(const struct character_t *src, const struct character
int max;
/* we optimize if the target is invulnerable */
- if (element != ELEMENT_NONE && dest->affinities[element] == AFFINITY_INVULNERABILITY)
+ if (element != ELEM_NONE && dest->affinities[element] == AFFIN_INVULN)
return 0;
if (type == DAMAGES_PHYSICAL) {
@@ -27,18 +27,18 @@ static int compute_damages(const struct character_t *src, const struct character
if (avg <= 0)
return 0;
- if (element != ELEMENT_NONE) {
+ if (element != ELEM_NONE) {
switch (dest->affinities[element]) {
- case AFFINITY_SENSITIVE:
+ case AFFIN_SENSITIVE:
avg *= 2;
break;
- case AFFINITY_RESISTANCE:
+ case AFFIN_RESISTANCE:
avg /= 2;
break;
- case AFFINITY_ABSORPTION:
+ case AFFIN_ABSORPTION:
avg = -avg;
break;
- case AFFINITY_NONE:
+ case AFFIN_NONE:
break;
default:
abort();
@@ -55,7 +55,7 @@ static int compute_damages(const struct character_t *src, const struct character
return rand() % (max - min + 1) + min;
}
-static int compute_cure(const struct character_t *src, const struct character_t *dest)
+static int compute_cure(const struct chr_t *src, const struct chr_t *dest)
{
int avg, max, min;
@@ -69,23 +69,25 @@ static int compute_cure(const struct character_t *src, const struct character_t
return rand() % (max - min + 1) + min;
}
-static
-void __attack(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct character_t *dest)
+static void __attack(SURFACES *surfaces, POSITIONS *positions,
+ struct chr_t *src, struct chr_t *dest)
{
int damages;
- damages = compute_damages(src, dest, DAMAGES_PHYSICAL, ELEMENT_NONE);
+ damages = compute_damages(src, dest, DAMAGES_PHYSICAL, ELEM_NONE);
damage_target_hp(surfaces, positions, dest, damages);
}
-void attack(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct target_t *dest, void *data)
+void attack(SURFACES *surfaces, POSITIONS *positions,
+ struct chr_t *src, struct target_t *dest, void *data)
{
(void) data;
__attack(surfaces, positions, src, dest->chr);
}
-void defend(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct target_t *dest, void *data)
+void defend(SURFACES *surfaces, POSITIONS *positions,
+ struct chr_t *src, struct target_t *dest, void *data)
{
(void) data;
(void) dest;
@@ -95,7 +97,8 @@ void defend(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, s
src->defensive = true;
}
-void cast_element(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct target_t *dest, void *data)
+void cast_element(SURFACES *surfaces, POSITIONS *positions,
+ struct chr_t *src, struct target_t *dest, void *data)
{
int damages;
enum element_t elem = *((enum element_t *)data);
@@ -107,7 +110,7 @@ void cast_element(SURFACES *surfaces, POSITIONS *positions, struct character_t *
damage_target_hp(surfaces, positions, dest->chr, damages);
} else {
for (int i = 0; i < dest->team->chr_cnt; ++i) {
- struct character_t *target = &dest->team->chrs[i];
+ struct chr_t *target = &dest->team->chrs[i];
if (!target->alive)
continue;
@@ -118,7 +121,8 @@ void cast_element(SURFACES *surfaces, POSITIONS *positions, struct character_t *
}
}
-void cast_cure(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct target_t *dest, void *data)
+void cast_cure(SURFACES *surfaces, POSITIONS *positions,
+ struct chr_t *src, struct target_t *dest, void *data)
{
int cure;
@@ -129,7 +133,7 @@ void cast_cure(SURFACES *surfaces, POSITIONS *positions, struct character_t *src
cure_target_hp(surfaces, positions, dest->chr, cure);
} else {
for (int i = 0; i < dest->team->chr_cnt; ++i) {
- struct character_t *target = &dest->team->chrs[i];
+ struct chr_t *target = &dest->team->chrs[i];
if (!target->alive)
continue;
@@ -141,8 +145,8 @@ void cast_cure(SURFACES *surfaces, POSITIONS *positions, struct character_t *src
}
-static
-void __use_potion(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct character_t *dest, int type)
+static void __use_potion(SURFACES *surfaces, POSITIONS *positions,
+ struct chr_t *src, struct chr_t *dest, int type)
{
int cure;
@@ -162,13 +166,14 @@ void __use_potion(SURFACES *surfaces, POSITIONS *positions, struct character_t *
cure_target_hp(surfaces, positions, dest, cure);
}
-void use_potion(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct target_t *dest, void *data)
+void use_potion(SURFACES *surfaces, POSITIONS *positions,
+ struct chr_t *src, struct target_t *dest, void *data)
{
__use_potion(surfaces, positions, src, dest->chr, *((int *)data));
}
-static
-void __use_ether(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct character_t *dest, int type)
+static void __use_ether(SURFACES *surfaces, POSITIONS *positions,
+ struct chr_t *src, struct chr_t *dest, int type)
{
int cure;
@@ -188,14 +193,16 @@ void __use_ether(SURFACES *surfaces, POSITIONS *positions, struct character_t *s
cure_target_mp(surfaces, positions, dest, cure);
}
-void use_ether(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct target_t *dest, void *data)
+void use_ether(SURFACES *surfaces, POSITIONS *positions,
+ struct chr_t *src, struct target_t *dest, void *data)
{
__use_ether(surfaces, positions, src, dest->chr, *((int *)data));
}
-void cyanure(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct target_t *dest, void *data)
+void cyanure(SURFACES *surfaces, POSITIONS *positions,
+ struct chr_t *src, struct target_t *dest, void *data)
{
- struct character_t *target = dest->chr;
+ struct chr_t *target = dest->chr;
(void) data;
(void) src;
@@ -204,7 +211,8 @@ void cyanure(SURFACES *surfaces, POSITIONS *positions, struct character_t *src,
target->poisoned = true;
}
-void esuna(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct target_t *dest, void *data)
+void esuna(SURFACES *surfaces, POSITIONS *positions,
+ struct chr_t *src, struct target_t *dest, void *data)
{
(void) surfaces;
(void) positions;