diff options
Diffstat (limited to 'actions.c')
-rw-r--r-- | actions.c | 73 |
1 files changed, 73 insertions, 0 deletions
@@ -5,6 +5,79 @@ #include <stdio.h> #include <stdlib.h> +void attack(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct character_t *dest, void *data) +{ + int damages; + + (void) data; + + damages = compute_damages(src, dest, DAMAGES_PHYSICAL, ELEMENT_NONE); + damage_target_hp(surfaces, positions, dest, damages); +} + +void cast_element(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct character_t *dest, void *data) +{ + int damages; + enum element_t elem = *((enum element_t *)data); + + /* TODO remove the MP */ + + damages = compute_damages(src, dest, DAMAGES_MAGICAL, elem); + damage_target_hp(surfaces, positions, dest, damages); +} + +void cast_cure(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct character_t *dest, void *data) +{ + int cure; + + (void) data; + + cure = compute_cure(src, dest); + cure_target_hp(surfaces, positions, dest, cure); +} + +void use_potion(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct character_t *dest, void *data) +{ + int type = *((int *)data); + int cure; + + switch (type) { + case POTION: + cure = 1000; + src->team->objects.potions--; + break; + case POTIONPLUS: + cure = 4000; + src->team->objects.potionsplus--; + break; + default: + abort(); + } + + cure_target_hp(surfaces, positions, dest, cure); +} + +void use_ether(SURFACES *surfaces, POSITIONS *positions, struct character_t *src, struct character_t *dest, void *data) +{ + int type = *((int *)data); + int cure; + + switch (type) { + case ETHER: + cure = 10; + src->team->objects.ethers--; + break; + case ETHERPLUS: + cure = 40; + src->team->objects.ethersplus--; + break; + default: + abort(); + } + + cure_target_mp(surfaces, positions, dest, cure); +} + enum action_state_t Fattaquer(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, void *data) { int degats; |