diff options
-rw-r--r-- | actions.c | 11 | ||||
-rw-r--r-- | actions.h | 1 | ||||
-rw-r--r-- | jouer.c | 17 | ||||
-rw-r--r-- | menuchoixpersos.c | 1 | ||||
-rw-r--r-- | players.h | 1 | ||||
-rw-r--r-- | priv_entries.h | 8 |
6 files changed, 39 insertions, 0 deletions
@@ -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; +} @@ -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 */ @@ -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(¶ms); + 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: @@ -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, + }, }, }; |