diff options
Diffstat (limited to 'actions.c')
-rw-r--r-- | actions.c | 41 |
1 files changed, 18 insertions, 23 deletions
@@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> -enum action_state_t Fattaquer(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, int Vtourallie,ENNEMIS ennemis[],int Vnbennemis) +enum action_state_t Fattaquer(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, ENNEMIS ennemis[],int Vnbennemis) { int max; int min; @@ -47,7 +47,7 @@ enum action_state_t Fattaquer(SURFACES *surfaces,POSITIONS *positions, struct te case SDLK_RETURN: case SDLK_f: continuer=0; - max=Fcalculerdegats(ally, Vtourallie,&min,ennemis,selection,clan,TYPE_ATTAQUE); + max=Fcalculerdegats(ally, &min,ennemis,selection,clan,TYPE_ATTAQUE); degats=(rand()%(max-min+1))+min; if(degats<0) degats=0; @@ -134,7 +134,7 @@ int compute_damages(struct character_t *src, struct character_t *dest, return rand() % (max - min + 1) + min; } -int Fcalculerdegats(struct team_t *ally, int Vtourallie,int *min,ENNEMIS ennemis[],int selection,int camp,int type) +int Fcalculerdegats(struct team_t *ally, int *min,ENNEMIS ennemis[],int selection,int camp,int type) { unsigned int degats; int max; @@ -143,16 +143,16 @@ int Fcalculerdegats(struct team_t *ally, int Vtourallie,int *min,ENNEMIS ennemis if(type==TYPE_ATTAQUE) { if(camp==ENNEMI) - degats=ally->chrs[Vtourallie].strength*60-ennemis[selection].defense*50; + degats=ally->chrs[ally->chr_cur].strength*60-ennemis[selection].defense*50; else - degats=ally->chrs[Vtourallie].strength*60-ally->chrs[selection].defense*50; + degats=ally->chrs[ally->chr_cur].strength*60-ally->chrs[selection].defense*50; } else { if(camp==ENNEMI) - degats=ally->chrs[Vtourallie].magic*60-ennemis[selection].defensemagique*50; + degats=ally->chrs[ally->chr_cur].magic*60-ennemis[selection].defensemagique*50; else - degats=ally->chrs[Vtourallie].magic*60-ally->chrs[selection].spirit*50; + degats=ally->chrs[ally->chr_cur].magic*60-ally->chrs[selection].spirit*50; } taux=degats/4; max=degats+taux; @@ -161,7 +161,7 @@ int Fcalculerdegats(struct team_t *ally, int Vtourallie,int *min,ENNEMIS ennemis return max; } -enum action_state_t Fselectionnermagienoire(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, int Vtourallie,ENNEMIS ennemis[],int Vnbennemis) +enum action_state_t Fselectionnermagienoire(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, ENNEMIS ennemis[],int Vnbennemis) { SDL_Event event; unsigned int continuer=1; @@ -205,7 +205,7 @@ enum action_state_t Fselectionnermagienoire(SURFACES *surfaces,POSITIONS *positi case SDLK_RETURN: SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositiondegats,surfaces->Pecran,&positions->Vpositiondegats); SDL_Flip(surfaces->Pecran); - ret = Fmagieelement(surfaces,positions, ally, Vtourallie,ennemis,Vnbennemis,selection); + ret = Fmagieelement(surfaces,positions, ally, ennemis,Vnbennemis,selection); if (ret == ACTION_PERFORMED) { continuer = 0; @@ -221,7 +221,7 @@ enum action_state_t Fselectionnermagienoire(SURFACES *surfaces,POSITIONS *positi return ret; } -enum action_state_t Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, int Vtourallie,ENNEMIS ennemis[],int Vnbennemis) +enum action_state_t Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, ENNEMIS ennemis[],int Vnbennemis) { enum action_state_t ret = ACTION_CANCELED; int continuer=1; @@ -266,7 +266,7 @@ enum action_state_t Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *posi SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositiondegats,surfaces->Pecran,&positions->Vpositiondegats); SDL_Flip(surfaces->Pecran); if(selection==SOIN) - ret = Fmagiesoin(surfaces,positions, ally, Vtourallie,ennemis,Vnbennemis); + ret = Fmagiesoin(surfaces,positions, ally, ennemis,Vnbennemis); if (ret == ACTION_PERFORMED) { continuer = 0; @@ -281,7 +281,7 @@ enum action_state_t Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *posi return ret; } -enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, int Vtourallie,ENNEMIS ennemis[],int Vnbennemis) +enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, ENNEMIS ennemis[],int Vnbennemis) { enum action_state_t ret = ACTION_CANCELED; SDL_Event event; @@ -328,17 +328,17 @@ enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions, if(page==0) { if(selection==POTION) - ret = Fpotion(surfaces,positions, ally,Vtourallie,ennemis,Vnbennemis, &ally->objects,selection); + ret = Fpotion(surfaces,positions, ally, ennemis,Vnbennemis, &ally->objects,selection); else if(selection==ETHER) - ret = Fether(surfaces,positions, ally,Vtourallie,ennemis,Vnbennemis, &ally->objects,selection); + ret = Fether(surfaces,positions, ally, ennemis,Vnbennemis, &ally->objects,selection); else if(selection==POTIONPLUS) - ret = Fpotion(surfaces,positions, ally,Vtourallie,ennemis,Vnbennemis, &ally->objects,selection); + ret = Fpotion(surfaces,positions, ally, ennemis,Vnbennemis, &ally->objects,selection); } else if(page==1) { if(selection==ETHERPLUS) - ret = Fether(surfaces,positions, ally,Vtourallie,ennemis,Vnbennemis, &ally->objects,selection); + ret = Fether(surfaces,positions, ally, ennemis,Vnbennemis, &ally->objects,selection); } if (ret == ACTION_PERFORMED) { @@ -355,7 +355,7 @@ enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions, return ret; } -enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, int Vtourallie,ENNEMIS ennemis[],int Vnbennemis,OBJET *objets,int type) +enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, ENNEMIS ennemis[],int Vnbennemis,OBJET *objets,int type) { enum action_state_t ret = ACTION_CANCELED; int continuer=1; @@ -366,9 +366,6 @@ enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team int Bdegats=SOINS; int clan=ALLIE; - /* since the item does not depend on a specific character .. */ - (void) Vtourallie; - if(type==POTION&&objets->potions<=0) return ACTION_ERROR; else if(type==POTIONPLUS&&objets->potionsplus<=0) @@ -472,7 +469,7 @@ enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team return ret; } -enum action_state_t Fether(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, int Vtourallie,ENNEMIS ennemis[],int Vnbennemis,OBJET *objets,int type) +enum action_state_t Fether(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, ENNEMIS ennemis[],int Vnbennemis,OBJET *objets,int type) { enum action_state_t ret = ACTION_CANCELED; int continuer=1; @@ -483,8 +480,6 @@ enum action_state_t Fether(SURFACES *surfaces,POSITIONS *positions, struct team_ int Bdegats=SOINS; int clan=ALLIE; - (void) Vtourallie; - if(type==ETHER&&objets->ethers<=0) return ACTION_ERROR; else if(type==ETHERPLUS&&objets->ethersplus<=0) |