summaryrefslogtreecommitdiff
path: root/competences.c
blob: 7acd8b94c36f527198a21f4c1129e4b2afc9b0be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#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;
                }
            }
        }
    }
}