Skip to content
Snippets Groups Projects
Commit 19735811 authored by Marie Brunet-Carteaux's avatar Marie Brunet-Carteaux
Browse files

Code des fonctions de contrôleur donnant accès aux caractéristiques des personnages

parent e4da73ec
No related branches found
No related tags found
No related merge requests found
Pipeline #
File added
...@@ -191,7 +191,7 @@ char ** obtenirLignesCarte(int numCarte){ ...@@ -191,7 +191,7 @@ char ** obtenirLignesCarte(int numCarte){
*/ */
char ** obtenirDescriptionCarte(){ char ** obtenirDescriptionCarte(){
int i; int i;
//Allocation du tableau contenant les chaines de charactères //Allocation du tableau contenant les chaines de caractères
char ** tabDescCartes = malloc((getNbCartes(packGlobal))*sizeof(char *)); char ** tabDescCartes = malloc((getNbCartes(packGlobal))*sizeof(char *));
for(i=0;i<getNbCartes(packGlobal);i++){ for(i=0;i<getNbCartes(packGlobal);i++){
tabDescCartes[i]= malloc(100*sizeof(char)); tabDescCartes[i]= malloc(100*sizeof(char));
...@@ -468,13 +468,148 @@ char * obtenirNomClassePersonnage(int numero){ ...@@ -468,13 +468,148 @@ char * obtenirNomClassePersonnage(int numero){
} }
} }
int obtenirPVPersonnage(int numero); int obtenirPVPersonnage(int numero){
int obtenirPVMaxPersonnage(int numero); Joueur * actuel = NULL;
int obtenirManaPersonnage(int numero); actuel = getCurrentJoueur(getListJoueur(partieGlobale));
int obtenirManaMaxPersonnage(int numero); int PVPersonnage = -1;
int obtenirPDPersonnage(int numero);
int obtenirPDMaxPersonnage(int numero); if((numero>0)&&(numero<=3)){
char ** obtenirNomsAttaquesPersonnage(int numero); setOnFirstJoueur(getListJoueur(partieGlobale));
PVPersonnage = get_PV(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)),numero-1));
setOnJoueur(getListJoueur(partieGlobale),actuel);
return PVPersonnage;
}
else if ((numero>3)&&(numero<=6)){
setOnFirstJoueur(getListJoueur(partieGlobale));
nextJoueur(getListJoueur(partieGlobale));
PVPersonnage = get_PV(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)),numero-4));
setOnJoueur(getListJoueur(partieGlobale),actuel);
return PVPersonnage;
}
setOnJoueur(getListJoueur(partieGlobale),actuel);
return PVPersonnage;
}
int obtenirPVMaxPersonnage(int numero){
Joueur * actuel = NULL;
actuel = getCurrentJoueur(getListJoueur(partieGlobale));
int PVMaxPersonnage = -1;
if((numero>0)&&(numero<=3)){
setOnFirstJoueur(getListJoueur(partieGlobale));
PVMaxPersonnage = getPVMax(getClasse(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)),numero-1)));
setOnJoueur(getListJoueur(partieGlobale),actuel);
return PVMaxPersonnage;
}
else if ((numero>3)&&(numero<=6)){
setOnFirstJoueur(getListJoueur(partieGlobale));
nextJoueur(getListJoueur(partieGlobale));
PVMaxPersonnage = getPVMax(getClasse(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)),numero-4)));
setOnJoueur(getListJoueur(partieGlobale),actuel);
return PVMaxPersonnage;
}
setOnJoueur(getListJoueur(partieGlobale), actuel);
return PVMaxPersonnage;
}
int obtenirManaPersonnage(int numero){
Joueur * actuel = NULL;
actuel = getCurrentJoueur(getListJoueur(partieGlobale));
int ManaPersonnage = -1;
if((numero>0)&&(numero<=3)){
setOnFirstJoueur(getListJoueur(partieGlobale));
ManaPersonnage = get_mana(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)),numero-1));
setOnJoueur(getListJoueur(partieGlobale),actuel);
return ManaPersonnage;
}
else if ((numero>3)&&(numero<=6)){
setOnFirstJoueur(getListJoueur(partieGlobale));
nextJoueur(getListJoueur(partieGlobale));
ManaPersonnage = get_mana(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)),numero-4));
setOnJoueur(getListJoueur(partieGlobale),actuel);
return ManaPersonnage;
}
setOnJoueur(getListJoueur(partieGlobale), actuel);
return ManaPersonnage;
}
int obtenirManaMaxPersonnage(int numero){
Joueur * actuel = NULL;
actuel = getCurrentJoueur(getListJoueur(partieGlobale));
int ManaMaxPersonnage = -1;
if((numero>0)&&(numero<=3)){
setOnFirstJoueur(getListJoueur(partieGlobale));
ManaMaxPersonnage = getManaMax(getClasse(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)), numero-1)));
setOnJoueur(getListJoueur(partieGlobale),actuel);
return ManaMaxPersonnage;
}
else if ((numero>3)&&(numero<=6)){
setOnFirstJoueur(getListJoueur(partieGlobale));
nextJoueur(getListJoueur(partieGlobale));
ManaMaxPersonnage = getManaMax(getClasse(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)), numero-4)));
setOnJoueur(getListJoueur(partieGlobale),actuel);
return ManaMaxPersonnage;
}
setOnJoueur(getListJoueur(partieGlobale), actuel);
return ManaMaxPersonnage;
}
int obtenirPDPersonnage(int numero){
Joueur * actuel = NULL;
actuel = getCurrentJoueur(getListJoueur(partieGlobale));
int PDPersonnage = -1;
if((numero>0)&&(numero<=3)){
setOnFirstJoueur(getListJoueur(partieGlobale));
PDPersonnage = get_PD(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)),numero-1));
setOnJoueur(getListJoueur(partieGlobale),actuel);
return PDPersonnage;
}
else if ((numero>3)&&(numero<=6)){
setOnFirstJoueur(getListJoueur(partieGlobale));
nextJoueur(getListJoueur(partieGlobale));
PDPersonnage = get_PD(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)),numero-4));
setOnJoueur(getListJoueur(partieGlobale),actuel);
return PDPersonnage;
}
setOnJoueur(getListJoueur(partieGlobale), actuel);
return PDPersonnage;
}
int obtenirPDMaxPersonnage(int numero){
Joueur * actuel = NULL;
actuel = getCurrentJoueur(getListJoueur(partieGlobale));
int PDMaxPersonnage = -1;
if((numero>0)&&(numero<=3)){
setOnFirstJoueur(getListJoueur(partieGlobale));
PDMaxPersonnage = getPDMax(getClasse(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)),numero-1)));
setOnJoueur(getListJoueur(partieGlobale),actuel);
return PDMaxPersonnage;
}
else if ((numero>3)&&(numero<=6)){
setOnFirstJoueur(getListJoueur(partieGlobale));
nextJoueur(getListJoueur(partieGlobale));
PDMaxPersonnage = getPDMax(getClasse(getPersonnage(getCurrentJoueur(getListJoueur(partieGlobale)),numero-4)));
setOnJoueur(getListJoueur(partieGlobale),actuel);
return PDMaxPersonnage;
}
setOnJoueur(getListJoueur(partieGlobale), actuel);
return PDMaxPersonnage;
}
char ** obtenirNomsAttaquesPersonnage(int numero){
}
// Je met ici mes tests réalisés dans le main pour éviter de les réécrire si jamais il y a un problème. // Je met ici mes tests réalisés dans le main pour éviter de les réécrire si jamais il y a un problème.
// Si vous voulez tester aussi, à recopier dans le main avant l'appel à initJeu(). // Si vous voulez tester aussi, à recopier dans le main avant l'appel à initJeu().
...@@ -526,6 +661,13 @@ void testControlleurConsole(){ ...@@ -526,6 +661,13 @@ void testControlleurConsole(){
n=4+getIndicePersonnage((getListJoueur(partieGlobale)->lastNodeJoueur->j),trouverPersonnage(getCase(getCarte(partieGlobale),i,j))); n=4+getIndicePersonnage((getListJoueur(partieGlobale)->lastNodeJoueur->j),trouverPersonnage(getCase(getCarte(partieGlobale),i,j)));
} }
printf("%s\n", obtenirNomClassePersonnage(n)); printf("%s\n", obtenirNomClassePersonnage(n));
printf("%s\n", obtenirPVPersonnage(n));
printf("%s\n", obtenirPVMaxPersonnage(n));
printf("%s\n", obtenirManaPersonnage(n));
printf("%s\n", obtenirManaMaxPersonnage(n));
printf("%s\n", obtenirPDPersonnage(n));
printf("%s\n", obtenirPDMaxPersonnage(n));
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment