summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions.c11
-rw-r--r--actions.h1
-rw-r--r--jouer.c17
-rw-r--r--menuchoixpersos.c1
-rw-r--r--players.h1
-rw-r--r--priv_entries.h8
6 files changed, 39 insertions, 0 deletions
diff --git a/actions.c b/actions.c
index ac5cc03..9f02ef2 100644
--- a/actions.c
+++ b/actions.c
@@ -192,3 +192,14 @@ void use_ether(SURFACES *surfaces, POSITIONS *positions, struct character_t *src
{
__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)
+{
+ struct character_t *target = dest->chr;
+
+ (void) data;
+ (void) src;
+
+ damage_target_hp(surfaces, positions, target, target->max_hp / 4);
+ target->poisoned = true;
+}
diff --git a/actions.h b/actions.h
index 7510f38..77d9781 100644
--- a/actions.h
+++ b/actions.h
@@ -11,5 +11,6 @@ void cast_cure(SURFACES *, POSITIONS *, struct character_t *src, struct target_t
void use_potion(SURFACES *, POSITIONS *, struct character_t *src, struct target_t *dst, void *data);
void use_ether(SURFACES *, POSITIONS *, struct character_t *src, struct target_t *dst, void *data);
void defend(SURFACES *, POSITIONS *, struct character_t *src, struct target_t *dst, void *data);
+void cyanure(SURFACES *, POSITIONS *, struct character_t *src, struct target_t *dst, void *data);
#endif /* ACTIONS_H */
diff --git a/jouer.c b/jouer.c
index a5f20ad..29365f3 100644
--- a/jouer.c
+++ b/jouer.c
@@ -5,6 +5,8 @@
#include "ai.h"
#include "blits.h"
+#include "character.h"
+
#include "priv_entries.h"
static inline void highlight_current_character(struct team_t *team)
@@ -301,6 +303,19 @@ static enum action_state_t character_play_turn(struct action_params_t *params)
return ACTION_PERFORMED;
}
+static void hook_post_action(struct action_params_t *params)
+{
+ struct character_t *chr = params->src;
+
+ if (chr->alive && chr->poisoned) {
+ damage_target_hp(params->surfaces, params->positions, chr, chr->max_hp / 4);
+
+ SDL_Flip(params->surfaces->screen);
+
+ SDL_Delay(1000);
+ }
+}
+
int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *t1, struct team_t *t2)
{
struct team_t *playing_team;
@@ -347,6 +362,8 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *t1, struct
SDL_Flip(surfaces->Pecran);
+ hook_post_action(&params);
+
update_current_character(t1, t2, &playing_team);
blit_team(surfaces, t1);
blit_team(surfaces, t2);
diff --git a/menuchoixpersos.c b/menuchoixpersos.c
index f83fb16..176ec45 100644
--- a/menuchoixpersos.c
+++ b/menuchoixpersos.c
@@ -22,6 +22,7 @@ static void init_team_players(struct team_t *team, bool left,
chr->alive = true;
chr->defensive = false;
+ chr->poisoned = false;
switch (chr->class_) {
case CLASS_PALADIN:
diff --git a/players.h b/players.h
index 5d535bf..0da996d 100644
--- a/players.h
+++ b/players.h
@@ -37,6 +37,7 @@ struct character_t {
bool alive;
bool defensive;
+ bool poisoned;
int hp;
int max_hp;
diff --git a/priv_entries.h b/priv_entries.h
index f7697a6..6c3c798 100644
--- a/priv_entries.h
+++ b/priv_entries.h
@@ -139,6 +139,14 @@ struct entry_t black_magic_entries[] = {
.data = (enum element_t []) { ELEMENT_NONE },
.target = TARGET_TEAM,
},
+ }, {
+ .name = "Cyanure",
+ .children_cnt = 0,
+ .action = {
+ .f = cyanure,
+ .data = NULL,
+ .target = TARGET_SINGLE,
+ },
},
};