summaryrefslogtreecommitdiff
path: root/competences.c
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2014-10-26 18:20:28 +0000
committerOlivier Gayot <duskcoder@gmail.com>2014-10-26 18:20:54 +0000
commite816f16a5007798968f4c9003b3159a45485e88f (patch)
tree86be1ca571b383ba1d532fa655991d099903732a /competences.c
parentf290b8cd7e40ed8688175fba312697f7da96a34e (diff)
game: remove useless checks
it is safe to pass a null pointer to SDL_FreeSurface() BTW: change the format of the files from dos to unix Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'competences.c')
-rw-r--r--competences.c240
1 files changed, 120 insertions, 120 deletions
diff --git a/competences.c b/competences.c
index 5d97b4a..e25acf1 100644
--- a/competences.c
+++ b/competences.c
@@ -1,120 +1,120 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <SDL/SDL.h>
-#include "structures.h"
-#include "constantes.h"
-#include "prototypes.h"
-
-void Fremplircompetencesennemis (ENNEMIS ennemis[],int Vnbennemis)
-{
- int i, y;
- unsigned int sensibilite;
- unsigned int max = 8, min = 0;
-
- for (i=0;i<=Vnbennemis;i++)
- {
- if(ennemis[i].classe==GUERRIER_GOBELIN)
- {
- ennemis[i].force = 15;
- ennemis[i].magie = 0;
- ennemis[i].defense = 10;
- ennemis[i].defensemagique = 5;
- ennemis[i].pv = 1000;
- ennemis[i].pm = 0;
- ennemis[i].pminitiaux = 0;
- ennemis[i].pvinitiaux = 1000;
- ennemis[i].etat = VIE;
- for (y=0;y<4;y++)
- {
- sensibilite = (rand() % (max - min + 1)) + min;
- if (sensibilite == SENSIBILITE)
- {
- ennemis[i].sensibilite[y] = ACTIVE;
- ennemis[i].resistance[y] = DESACTIVE;
- ennemis[i].invulnerabilite[y] = DESACTIVE;
- ennemis[i].absorbtion[y] = DESACTIVE;
- }
- else if (sensibilite == RESISTANCE)
- {
- ennemis[i].resistance[y] = ACTIVE;
- ennemis[i].sensibilite[y] = DESACTIVE;
- ennemis[i].invulnerabilite[y] = DESACTIVE;
- ennemis[i].absorbtion[y] = DESACTIVE;
- }
- else if (sensibilite == INVULNERABILITE)
- {
- ennemis[i].resistance[y] = DESACTIVE;
- ennemis[i].sensibilite[y] = DESACTIVE;
- ennemis[i].invulnerabilite[y] = ACTIVE;
- ennemis[i].absorbtion[y] = DESACTIVE;
- }
- else if (sensibilite == ABSORBTION)
- {
- ennemis[i].sensibilite[y] = DESACTIVE;
- ennemis[i].resistance[y] = DESACTIVE;
- ennemis[i].invulnerabilite[y] = DESACTIVE;
- ennemis[i].absorbtion[y] = ACTIVE;
- }
- else
- {
- ennemis[i].sensibilite[y] = DESACTIVE;
- ennemis[i].resistance[y] = DESACTIVE;
- ennemis[i].invulnerabilite[y] = DESACTIVE;
- ennemis[i].absorbtion[y] = DESACTIVE;
- }
- }
- }
- }
-}
-
-void Fremplircompetencesallie (PERSONNAGES persos[])
-{
- int i;
-
- for(i=0;i<3;i++)
- {
- if(persos[i].classe==PALADIN)
- {
- persos[i].xp = 0;
- persos[i].nv = 0;
- persos[i].force = 20;
- persos[i].magie = 5;
- persos[i].defense = 15;
- persos[i].defensemagique = 10;
- persos[i].pv = 1500;
- persos[i].pvinitiaux = 1500;
- persos[i].pminitiaux = 40;
- persos[i].pm = 40;
- persos[i].etat = VIE;
- }
- else if (persos[i].classe == PRETRE)
- {
- persos[i].xp = 0;
- persos[i].nv = 0;
- persos[i].force = 5;
- persos[i].magie = 20;
- persos[i].defense = 10;
- persos[i].defensemagique = 20;
- persos[i].pv = 1000;
- persos[i].pvinitiaux = 1000;
- persos[i].pminitiaux = 40;
- persos[i].pm = 40;
- persos[i].etat = VIE;
- }
- else if (persos[i].classe == VOLEUR)
- {
- persos[i].xp = 0;
- persos[i].nv = 0;
- persos[i].force = 14;
- persos[i].magie = 11;
- persos[i].defense = 15;
- persos[i].defensemagique = 15;
- persos[i].pv = 1250;
- persos[i].pvinitiaux = 1250;
- persos[i].pminitiaux = 40;
- persos[i].pm = 40;
- persos[i].etat = VIE;
- }
- }
-}
-
+#include <stdlib.h>
+#include <stdio.h>
+#include <SDL/SDL.h>
+#include "structures.h"
+#include "constantes.h"
+#include "prototypes.h"
+
+void Fremplircompetencesennemis (ENNEMIS ennemis[],int Vnbennemis)
+{
+ int i, y;
+ unsigned int sensibilite;
+ unsigned int max = 8, min = 0;
+
+ for (i=0;i<=Vnbennemis;i++)
+ {
+ if(ennemis[i].classe==GUERRIER_GOBELIN)
+ {
+ ennemis[i].force = 15;
+ ennemis[i].magie = 0;
+ ennemis[i].defense = 10;
+ ennemis[i].defensemagique = 5;
+ ennemis[i].pv = 1000;
+ ennemis[i].pm = 0;
+ ennemis[i].pminitiaux = 0;
+ ennemis[i].pvinitiaux = 1000;
+ ennemis[i].etat = VIE;
+ for (y=0;y<4;y++)
+ {
+ sensibilite = (rand() % (max - min + 1)) + min;
+ if (sensibilite == SENSIBILITE)
+ {
+ ennemis[i].sensibilite[y] = ACTIVE;
+ ennemis[i].resistance[y] = DESACTIVE;
+ ennemis[i].invulnerabilite[y] = DESACTIVE;
+ ennemis[i].absorbtion[y] = DESACTIVE;
+ }
+ else if (sensibilite == RESISTANCE)
+ {
+ ennemis[i].resistance[y] = ACTIVE;
+ ennemis[i].sensibilite[y] = DESACTIVE;
+ ennemis[i].invulnerabilite[y] = DESACTIVE;
+ ennemis[i].absorbtion[y] = DESACTIVE;
+ }
+ else if (sensibilite == INVULNERABILITE)
+ {
+ ennemis[i].resistance[y] = DESACTIVE;
+ ennemis[i].sensibilite[y] = DESACTIVE;
+ ennemis[i].invulnerabilite[y] = ACTIVE;
+ ennemis[i].absorbtion[y] = DESACTIVE;
+ }
+ else if (sensibilite == ABSORBTION)
+ {
+ ennemis[i].sensibilite[y] = DESACTIVE;
+ ennemis[i].resistance[y] = DESACTIVE;
+ ennemis[i].invulnerabilite[y] = DESACTIVE;
+ ennemis[i].absorbtion[y] = ACTIVE;
+ }
+ else
+ {
+ ennemis[i].sensibilite[y] = DESACTIVE;
+ ennemis[i].resistance[y] = DESACTIVE;
+ ennemis[i].invulnerabilite[y] = DESACTIVE;
+ ennemis[i].absorbtion[y] = DESACTIVE;
+ }
+ }
+ }
+ }
+}
+
+void Fremplircompetencesallie (PERSONNAGES persos[])
+{
+ int i;
+
+ for(i=0;i<3;i++)
+ {
+ if(persos[i].classe==PALADIN)
+ {
+ persos[i].xp = 0;
+ persos[i].nv = 0;
+ persos[i].force = 20;
+ persos[i].magie = 5;
+ persos[i].defense = 15;
+ persos[i].defensemagique = 10;
+ persos[i].pv = 1500;
+ persos[i].pvinitiaux = 1500;
+ persos[i].pminitiaux = 40;
+ persos[i].pm = 40;
+ persos[i].etat = VIE;
+ }
+ else if (persos[i].classe == PRETRE)
+ {
+ persos[i].xp = 0;
+ persos[i].nv = 0;
+ persos[i].force = 5;
+ persos[i].magie = 20;
+ persos[i].defense = 10;
+ persos[i].defensemagique = 20;
+ persos[i].pv = 1000;
+ persos[i].pvinitiaux = 1000;
+ persos[i].pminitiaux = 40;
+ persos[i].pm = 40;
+ persos[i].etat = VIE;
+ }
+ else if (persos[i].classe == VOLEUR)
+ {
+ persos[i].xp = 0;
+ persos[i].nv = 0;
+ persos[i].force = 14;
+ persos[i].magie = 11;
+ persos[i].defense = 15;
+ persos[i].defensemagique = 15;
+ persos[i].pv = 1250;
+ persos[i].pvinitiaux = 1250;
+ persos[i].pminitiaux = 40;
+ persos[i].pm = 40;
+ persos[i].etat = VIE;
+ }
+ }
+}
+