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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int pvpj,capj,pvpnj,capnj,choix1,de20,de8,pointscara,force,dex,constitution,sagesse,intel,charisme,ja,degatpj,degatpnj,japnj,monstre,choix2,choix3;
srand(time(NULL));
printf("Bienvenue dans le premier Jeu de BaTMan corp \n");
/* creation personnage */
choix2=1;
printf("vous allez maintenant creer un personnage\n");
printf("vous pouvez attribuer 75 points de cara sur 6 cara\n");
printf("ces cara sont : force , dexterite , constitution ,sagesse,intelligence et charisme\n");
pointscara=75;
printf("combien de points en force (entre 6 et 20)\n");
scanf("%i",&force);
pointscara=pointscara-force;
printf("combien de points en dexterite (entre 6 et 20)\n");
scanf("%i",&dex);
pointscara=pointscara-dex;
printf("combien de points en constitution(entre 6 et 20)\n");
scanf("%i",&constitution);
pointscara=pointscara-constitution;
printf("combien de points en sagesse (entre 6 et 20)\n");
scanf("%i",&sagesse);
pointscara=pointscara-sagesse;
printf("combien de points en intelligence (entre 6 et 20)\n");
scanf("%i",&intel);
pointscara=pointscara-intel;
printf("combien de points en charisme (entre 6 et 20)\n");
scanf("%i",&charisme);
pointscara=pointscara-charisme;
debut : // correspond à l'endroit ou l'utilisateur reviendra après avoir gagné ou perdu un duel
if(pointscara<0)
{
printf("vous avez voulu triche , vous etes donc puni");
force=2;
dex=2;
constitution=2;
intel=2;
sagesse=2;
charisme=2;
}
printf("votre personnage a %i en force , %i en dexterite , %i en constit , %i en sagesse,%i en intelligence , %i en charisme\n\n",force,dex,constitution,sagesse,intel,charisme);
/* mis en place des cara */
pvpj=(20+((constitution-10)/2));
capj=(15+((dex-10)/2));
ja=((force-10)/2);
degatpj=(rand()%8)+1+((force-10)/2);
/*menu attaque */
monstre=1;
printf("quel monstre voulez vous combattre?\n");
printf("1.Gobelin (20 pv , ca 16 , degat d8 , bonus a l attaque +3)\n");
printf("2.Orque (30 pv , ca 18 , degat d8+2 , bonus a l attaque +5)\n");
printf("3.Gobelours (40 pv , ca 20 degat d8+6,bonus a l attaque +7)\n");
printf("4.DRAGON (160 pv , ca 35 , degat 3d8+10, bonus a l attaque +15)\n\n");
printf("5.Aucun il me font peur et je veut quitter\n");
scanf("%i",&monstre);
while(monstre!=5)
{
if(monstre==1)
{
pvpnj=20;
capnj=16;
japnj=3;
degatpnj=(rand()%8)+1;
}
if(monstre==2)
{
pvpnj=30;
capnj=18;
japnj=5;
degatpnj=(rand()%8)+1+2;
}
if(monstre==3)
{
pvpnj=40;
capnj=35;
japnj=15;
degatpnj=(rand()%8)+1+6;
}
if(monstre==4)
{
pvpnj=160;
capnj=16;
japnj=3;
degatpnj=((rand()%8)+1)*2+15;
}
while ((pvpj>0)&&(pvpnj>0))
{
printf("1. attaquer\n");
printf("2. defendre +2 a la ca\n\n");
if (intel>10)
printf("3.lancer un sort profane\n");
if (sagesse>10)
printf("4.lancer un sort divin\n\n");
scanf("%i",&choix1);
if(choix1==1)
{
de20=(rand()%20)+1+ja;
if(de20+ja>=capnj)
{
pvpnj=pvpnj-degatpj;
printf("Touche , vous infligez %i points de dégats \n\n",degatpj);
}
else
printf("rate\n");
}
if(choix1==2)
{
capj=capj+2;
}
if(choix1==3)
{
printf("1.lancer projectile magique (1d6 point de degats +1d6 tout les 2 points au dessus de 10 en intel\n");
printf("2.lancer armure de mage(+4 +1 tous les 2 points au dessus de 10 en intel a la ca)\n");
scanf("%i",&choix2);
if(choix2==1)
pvpnj=pvpnj-(((rand()%6+1))+((intel-10)/2)*((rand()%6)+1));
if(choix2==2)
capj=capj+4+(((intel-10)/2)*1);
}
if(choix1==4)
{
printf("1.soins (recupere 1d8+1 tout les 2 points de sagesse au dessus de 10) pv)\n");
printf("2.malediction (diminue la ca du pnj de 1 tout les 2 points de sagesse au dessus de 10\n");
scanf("%i",&choix3);
if(choix3==1)
{
pvpj=pvpj+(rand()%8)+1+((sagesse-10)/2);
}
if(choix3==2)
{
capnj=capnj-1+((sagesse-10)/2);
}}
printf("au tour du PNJ\n\n");
de20=(rand()%20)+1+japnj;
if (de20+japnj>=capj)
{
pvpj=pvpj-degatpnj;
printf("le PNJ vous a touche et vous inflige %i points de degats\n\n",degatpnj);
}
else
printf("le PNJ vous a rate\n");
printf("vous avez %i pv et le PNJ a %i pv\n\n\n",pvpj,pvpnj);
printf("\n");
}
if (pvpj<=0)
printf("vous etes mort recommencez\n");
goto debut ; // renvoit l'uilisateur plus haut pour qu'il recommence, voir ligne 39
if(pvpnj<=0)
printf("vous avez vaincu le monstre\n");
goto debut ; // renvoit l'uilisateur plus haut pour qu'il recommence, voir ligne 39
}
return 0;
} |
Partager