6 Janvier 2020

6 Janvier 2020

int centrex=850;
int centrey=450;
int taille=55;
int action=0;
int Histoire=1;
float tour=0;
void setup(){
size(centrex*2,centrey*2);
quadrillage_D();
Importation();
Glossaire();
for(int U=0; U<Tunite_JI.length; U++){
TuniteVivant_JI[U]=false;
TuniteVivant_JII[U]=false;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int FPS;
void draw(){
background(55);
textSize(15);
//////////////////Reboot///////
if(NmbUnite1>=30){
NmbUnite1=0;}
if(NmbUnite2>=30){
NmbUnite2=0;}
if(NmbBatiment1>=NmbConstruc){
NmbBatiment1=0;
}
if(NmbBatiment2>=NmbConstruc){
NmbBatiment2=0;
}
if(Histoire==2){
text(FPS,0,taille*15.25);
Unit_Actu_Retour();
Tour_De_Jeu();
Quadrillage();
Afficher_Main();
Attaque();
Special_Os();
/////////////////////Special//////////
if(RecolteAct==true){
Recolte_D_os();
}
if(NecroAct==true){
Necro();
}
if(ConstAct==true){
Construc();
}
Boyau_Ferme();
Project_Acide();
OS_Dur();
/////////////////////Batiment/////////
for(int B=0; B<Batiment_JI.length; B++){
if(BatimentVivant_JI[B]==true){
Batiment_JI[B].Affichage();
}
}
for(int B=0; B<Batiment_JII.length; B++){
if(BatimentVivant_JII[B]==true){
Batiment_JII[B].Affichage();
}
}
/////////////////////Unité////////////
for(int I=0; I<Tunite_JI.length; I++){
if(TuniteVivant_JI[I]==true){
Tunite_JI[I].affichage();
Tunite_JI[I].Selection();
Tunite_JI[I].Deplacement();
Tunite_JI[I].ChangePhase();
}
}
for(int II=0; II<Tunite_JII.length; II++){
if(TuniteVivant_JII[II]==true){
Tunite_JII[II].affichage();
Tunite_JII[II].Selection();
Tunite_JII[II].Deplacement();
Tunite_JII[II].ChangePhase();
}
}
Unit_Actu();
for(int C=0; C<Emplacement.length; C++){
Emplacement[C].Presence();
Emplacement[C].Couleur();
}
Affiche_Ressource();
Mort();
for(int B=0; B<Base.length; B++){
Base[B].Affichage();
Base[B].Vie();
}
Main();
}
if(Histoire==1){
Presentation();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Afficher_Main(){
image(Boutton[4], taille*25,taille*0.5,64,64);
if(mouseX>=taille*25 && mouseX<=taille*25+64 && mouseY>=taille*0.5 && mouseY<=taille*0.5+64){
image(Boutton[4], taille*25-16,taille*0.5-16,64+32,64+32);
if(mousePressed==true){
if(AfficheMain==false){
AfficheMain=true;
}
else{
AfficheMain=false;
}
mousePressed=false;
}
}
}
void Mort(){
for(int U=0; U<Tunite_Total.length; U++){
if(TuniteVivant_Total[U]==true){
if(Tunite_Total[U].Vie<=0){
if(Tunite_Total[U].Nom=="Guerrier Squelette" || Tunite_Total[U].Nom=="Archer Squelette"){
Emplacement[Tunite_Total[U].NumCase].Tas_d_os++;
}
TuniteVivant_Total[U]=false;
if(U<limite_d_unit){
TuniteVivant_JI[U]=false;
}
if(U>=limite_d_unit){
TuniteVivant_JII[U-limite_d_unit]=false;
}
}
}
}
for(int B=0; B<Batiment_JI.length; B++){
if(BatimentVivant_JI[B]==true){
if(Batiment_JI[B].Vie<=0){
BatimentVivant_JI[B]=false;
}
}
}
for(int B=0; B<Batiment_JII.length; B++){
if(BatimentVivant_JII[B]==true){
if(Batiment_JII[B].Vie<=0){
BatimentVivant_JII[B]=false;
}
}
}
}

boolean BoyAct1;
boolean BoyAct2;
int Boyau1=-1;
int Boyau2=-1;
boolean ProjAcide_Act1;
boolean ProjAcide_Act2;
int ProjAcide1;
int ProjAcide2;
boolean Os_DurAct1;
boolean Os_DurAct2;
int Os_Dur1;
int Os_Dur2;
boolean SoiNecAct1;
boolean SoiNecAct2;
int SoiNec1;
int SoiNec2;
boolean SoinNecro1;
boolean SoinNecro2;
void Boyau_Ferme(){
textSize(20);
fill(255);
if(BoyAct1==true){
if(tour>=1 && tour<2){
if(Boyau1>0){
text("Boyau Ferme dans "+Boyau1+" tour",taille*23.75,taille*4.25);}
if(Boyau1==0){
for(int C=0; C<Deck_JI.length; C++){
if(Deck_JI[C].Nom=="Archer Squelette"){
Deck_JI[C].Portee="2-3";
}
}
for(int U=0; U<Tunite_JI.length; U++){
if(TuniteVivant_JI[U]==true){
if(Tunite_JI[U].Nom=="Archer Squelette"){
Tunite_JI[U].portee="2-3";
}
}
}
}
}
}
if(BoyAct2==true){
if(tour>=2 && tour<3){
if(Boyau2>0){
text("Boyau Ferme dans "+Boyau2+" tour",taille*23.75,taille*4.25);}
if(Boyau2==0){
for(int C=0; C<Deck_JII.length; C++){
if(Deck_JII[C].Nom=="Archer Squelette"){
Deck_JII[C].Portee="2-3";
}
}
for(int U=0; U<Tunite_JII.length; U++){
if(TuniteVivant_JII[U]==true){
if(Tunite_JII[U].Nom=="Archer Squelette"){
Tunite_JII[U].portee="2-3";
}
}
}
}
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
void Project_Acide(){
textSize(20);
fill(255);
if(ProjAcide_Act1==true){
if(tour>=1 && tour<2){
if(ProjAcide1>0){
text("Projection Acide dans "+ProjAcide1+" tour",taille*23.5,taille*4.75);}
if(ProjAcide1==0){
for(int C=0; C<Deck_JI.length; C++){
if(Deck_JI[C].Nom=="Zombie"){
Deck_JI[C].Portee="1-2";
}
}
for(int U=0; U<Tunite_JI.length; U++){
if(TuniteVivant_JI[U]==true){
if(Tunite_JI[U].Nom=="Zombie"){
Tunite_JI[U].portee="1-2";
}
}
}
}
}
}
if(ProjAcide_Act2==true){
if(tour>=2 && tour<3){
if(ProjAcide2>0){
text("Projection Acide dans "+ProjAcide2+" tour",taille*23.5,taille*4.75);}
if(ProjAcide2==0){
for(int C=0; C<Deck_JII.length; C++){
if(Deck_JII[C].Nom=="Zombie"){
Deck_JII[C].Portee="1-2";
}
}
for(int U=0; U<Tunite_JII.length; U++){
if(TuniteVivant_JII[U]==true){
if(Tunite_JII[U].Nom=="Zombie"){
Tunite_JII[U].portee="1-2";
}
}
}
}
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void OS_Dur(){
textSize(20);
fill(255);
if(Os_DurAct1==true){
if(tour>=1 && tour<2){
if(Os_Dur1>0){
text("Durcissement des Os dans "+Os_Dur1+" tour",taille*23.5,taille*5.25);}
if(Os_Dur1==0){
for(int C=0; C<Deck_JI.length; C++){
if(Deck_JI[C].Nom=="Guerrier Squelette" || Deck_JI[C].Nom=="Archer Squelette" ||Deck_JI[C].Nom=="Champion Squelette"){
Deck_JI[C].def++;
}
}
for(int U=0; U<Tunite_JI.length; U++){
if(TuniteVivant_JI[U]==true){
if(Tunite_JI[U].Nom=="Guerrier Squelette" || Tunite_JI[U].Nom=="Archer Squelette" || Tunite_JI[U].Nom=="Champion Squelette"){
Tunite_JI[U].def++;
}
}
}
}
}
}
if(Os_DurAct2==true){
if(tour>=1 && tour<2){
if(Os_Dur2>0){
text("Durcissement des Os dans "+Os_Dur2+" tour",taille*23.5,taille*5.25);}
if(Os_Dur2==0){
for(int C=0; C<Deck_JII.length; C++){
if(Deck_JII[C].Nom=="Guerrier Squelette" || Deck_JII[C].Nom=="Archer Squelette" ||Deck_JII[C].Nom=="Champion Squelette"){
Deck_JII[C].def++;
}
}
for(int U=0; U<Tunite_JII.length; U++){
if(TuniteVivant_JII[U]==true){
if(Tunite_JII[U].Nom=="Guerrier Squelette" || Tunite_JII[U].Nom=="Archer Squelette" || Tunite_JII[U].Nom=="Champion Squelette"){
Tunite_JII[U].def++;
}
}
}
}
}
}
}

int positionCase=0;
int U_Att=0;
int C_Deff=0;
void Attaque(){
for(int U=0; U<Tunite_Total.length; U++){
if(TuniteVivant_Total[U]==true){
if(Tunite_Total[U].Phase_Perso==2){
U_Att=U;
positionCase=Tunite_Total[U].NumCase;
//1////////1////////1////////1////////1////////1////////1////////1////////1////////1////////1////////1
if(Tunite_Total[U].portee=="1"){
image(CaseAtt[0],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso-taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso+taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
if(mousePressed==true){
if(mouseButton==LEFT){
///////
C_Deff=positionCase+1;
for(int i=0; i<4; i++){
if(C_Deff>=0 && C_Deff<300){
if(Emplacement[C_Deff].Presence!="Vide" && Emplacement[C_Deff].Presence!="Mur"){
if(mouseX>=Emplacement[C_Deff].xposition && mouseX<=Emplacement[C_Deff].xposition+taille && mouseY>=Emplacement[C_Deff].yposition && mouseY<=Emplacement[C_Deff].yposition+taille){
Degat();
}
}
}
if(C_Deff==positionCase-20){C_Deff=positionCase+20;}
if(C_Deff==positionCase-1){C_Deff=positionCase-20;}
if(C_Deff==positionCase+1){C_Deff=positionCase-1;}
}
}
}
}
//2////////2////////2////////2////////2////////2////////2////////2////////2////////2////////2////////2////////2
if(Tunite_Total[U].portee=="2"){
image(CaseAtt[0],Tunite_Total[U].xperso-taille*2+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille*2+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso-taille*2+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso+taille*2+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso-taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso-taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso+taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso+taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
if(mousePressed==true){
if(mouseButton==LEFT){
C_Deff=positionCase+2;
for(int i=0; i<12; i++){
if(C_Deff>=0 && C_Deff<300){
if(Emplacement[C_Deff].Presence!="Vide" && Emplacement[C_Deff].Presence!="Mur"){
if(mouseX>=Emplacement[C_Deff].xposition && mouseX<=Emplacement[C_Deff].xposition+taille && mouseY>=Emplacement[C_Deff].yposition && mouseY<=Emplacement[C_Deff].yposition+taille){
Degat();
}
}
}
if(C_Deff==positionCase-21){C_Deff=positionCase+21;}
if(C_Deff==positionCase+19){C_Deff=positionCase-21;}
if(C_Deff==positionCase-19){C_Deff=positionCase+19;}
if(C_Deff==positionCase+40){C_Deff=positionCase-19;}
if(C_Deff==positionCase-40){C_Deff=positionCase+40;}
if(C_Deff==positionCase-2){C_Deff=positionCase-40;}
if(C_Deff==positionCase+2){C_Deff=positionCase-2;}
}
}
}
}
//1-2////////1-2////////1-2////////1-2////////1-2////////1-2////////1-2////////1-2////////1-2////////1-2////////1-2////////1-2////////1-2
if(Tunite_Total[U].portee=="1-2"){
image(CaseAtt[0],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso-taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso+taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso-taille*2+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille*2+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso-taille*2+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso+taille*2+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso-taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso-taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso+taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso+taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
if(mousePressed==true){
if(mouseButton==LEFT){
C_Deff=positionCase+1;
for(int i=0; i<12; i++){
if(C_Deff>=0 && C_Deff<300){
if(Emplacement[C_Deff].Presence!="Vide" && Emplacement[C_Deff].Presence!="Mur"){
if(mouseX>=Emplacement[C_Deff].xposition && mouseX<=Emplacement[C_Deff].xposition+taille && mouseY>=Emplacement[C_Deff].yposition && mouseY<=Emplacement[C_Deff].yposition+taille){
Degat();
}
}
}
if(C_Deff==positionCase-21){C_Deff=positionCase+21;}
if(C_Deff==positionCase+19){C_Deff=positionCase-21;}
if(C_Deff==positionCase-19){C_Deff=positionCase+19;}
if(C_Deff==positionCase+40){C_Deff=positionCase-19;}
if(C_Deff==positionCase-40){C_Deff=positionCase+40;}
if(C_Deff==positionCase-2){C_Deff=positionCase-40;}
if(C_Deff==positionCase+2){C_Deff=positionCase-2;}
if(C_Deff==positionCase+20){C_Deff=positionCase+2;}
if(C_Deff==positionCase-20){C_Deff=positionCase+20;}
if(C_Deff==positionCase-1){C_Deff=positionCase-20;}
if(C_Deff==positionCase+1){C_Deff=positionCase-1;}
}
}
}
}
//2-3////////2-3////////2-3////////2-3////////2-3////////2-3////////2-3////////2-3////////2-3////////2-3////////2-3////////2-3////////2-3
if(Tunite_Total[U].portee=="2-3"){
image(CaseAtt[0],Tunite_Total[U].xperso-taille*2+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille*2+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso-taille*2+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso+taille*2+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso-taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso-taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso+taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso+taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
//Portee3
image(CaseAtt[0],Tunite_Total[U].xperso-taille*3+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille*3+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso-taille*3+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso+taille*3+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso-taille*2+1,Tunite_Total[U].yperso-taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso-taille*2+1,Tunite_Total[U].yperso+taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso-taille*2+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso+taille*2+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille*2+1,Tunite_Total[U].yperso-taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille*2+1,Tunite_Total[U].yperso+taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso-taille*2+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso+taille*2+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
if(mousePressed==true){
if(mouseButton==LEFT){
C_Deff=positionCase+2;
for(int i=0; i<19; i++){
if(C_Deff>=0 && C_Deff<300){
if(Emplacement[C_Deff].Presence!="Vide" && Emplacement[C_Deff].Presence!="Mur"){
if(mouseX>=Emplacement[C_Deff].xposition && mouseX<=Emplacement[C_Deff].xposition+taille && mouseY>=Emplacement[C_Deff].yposition && mouseY<=Emplacement[C_Deff].yposition+taille){
Degat();
}
}
}
if(C_Deff==positionCase-41){C_Deff=positionCase+41;}
if(C_Deff==positionCase+39){C_Deff=positionCase-41;}
if(C_Deff==positionCase-39){C_Deff=positionCase+39;}
if(C_Deff==positionCase+22){C_Deff=positionCase-39;}
if(C_Deff==positionCase-22){C_Deff=positionCase+22;}
if(C_Deff==positionCase+18){C_Deff=positionCase-22;}
if(C_Deff==positionCase-18){C_Deff=positionCase+18;}
if(C_Deff==positionCase+60){C_Deff=positionCase-18;}
if(C_Deff==positionCase-60){C_Deff=positionCase+60;}
if(C_Deff==positionCase+3){C_Deff=positionCase-60;}
if(C_Deff==positionCase-3){C_Deff=positionCase+3;}
if(C_Deff==positionCase+21){C_Deff=positionCase-3;}
if(C_Deff==positionCase-21){C_Deff=positionCase+21;}
if(C_Deff==positionCase+19){C_Deff=positionCase-21;}
if(C_Deff==positionCase-19){C_Deff=positionCase+19;}
if(C_Deff==positionCase+40){C_Deff=positionCase-19;}
if(C_Deff==positionCase-40){C_Deff=positionCase+40;}
if(C_Deff==positionCase-2){C_Deff=positionCase-40;}
if(C_Deff==positionCase+2){C_Deff=positionCase-2;}
}
}
}
}
}
}
}
}////////////Degat////////////////////////////Degat///////////////////////////Degat/////////////////////////////////////////////////
int Degat;
void Degat(){
if(U_Att<limite_d_unit && Emplacement[C_Deff].Presence=="Joueur 2"){
for(int U=0; U<Tunite_JII.length; U++){
if(TuniteVivant_JII[U]==true){
if(Tunite_JI[U_Att].Phase_Perso==2){
if(Tunite_JII[U].xperso==Emplacement[C_Deff].xposition && Tunite_JII[U].yperso==Emplacement[C_Deff].yposition){
Degat=int(Tunite_JI[U_Att].att-Tunite_JII[U].def);
if(Degat<=0){
Degat=1;}
Tunite_JII[U].Vie-=Degat;
if(Tunite_JII[U].Vie<=0){
if(Tunite_JI[U_Att].Nom=="Champion Squelette"){
Tunite_JI[U_Att].att+=0.5;}
if(Tunite_JI[U_Att].Nom=="Zombie" || Tunite_JI[U_Att].Nom=="Goule" || Tunite_JI[U_Att].Nom=="Seigneur Vampire"){
Tunite_JI[NmbUnite1]= new Unite(Tunite_JII[U].xperso,Tunite_JII[U].yperso, taille,taille, 2,3, 2,0,"1",IconUnite[3],"Unite", "Zombie", 1);
TuniteVivant_JI[NmbUnite1]= true;
Tunite_JI[NmbUnite1].Tour_action=0;
NmbUnite1++;}
mousePressed=false;
if(Base[0].Faction=="Mort-Vivant"){
Base[0].RessII++;
}
}
action=0;
Tunite_JI[U_Att].Phase_Perso=0;
Tunite_JI[U_Att].mouvement=0;
}
}
}
}
}
if(U_Att>=limite_d_unit && Emplacement[C_Deff].Presence=="Joueur 1"){
for(int U=0; U<Tunite_JI.length; U++){
if(TuniteVivant_JI[U]==true){
if(Tunite_JII[U_Att-limite_d_unit].Phase_Perso==2){
if(Tunite_JI[U].xperso==Emplacement[C_Deff].xposition && Tunite_JI[U].yperso==Emplacement[C_Deff].yposition){
Degat=int(Tunite_JII[U_Att-limite_d_unit].att-Tunite_JI[U].def);
if(Degat<=0){
Degat=1;}
Tunite_JI[U].Vie-=Degat;
if(Tunite_JI[U].Vie<=0){
if(Tunite_JII[U_Att-limite_d_unit].Nom=="Champion Squelette"){
Tunite_JII[U_Att-limite_d_unit].att+=0.5;}
if(Tunite_JII[U_Att-limite_d_unit].Nom=="Zombie" || Tunite_JII[U_Att-limite_d_unit].Nom=="Goule" || Tunite_JII[U_Att-limite_d_unit].Nom=="Seigneur Vampire"){
Tunite_JII[NmbUnite2]= new Unite(Tunite_JI[U].xperso,Tunite_JI[U].yperso, taille,taille, 2,3, 2,0,"1",IconUnite[3],"Unite", "Zombie",2);
TuniteVivant_JII[NmbUnite2]= true;
Tunite_JII[NmbUnite2].Tour_action=0;
NmbUnite2++;}
if(Base[1].Faction=="Mort-Vivant"){
Base[1].RessII++;
}
mousePressed=false;
}
action=0;
Tunite_JII[U_Att-limite_d_unit].Phase_Perso=0;
Tunite_JII[U_Att-limite_d_unit].mouvement=0;
}
}
}
}
}
if(U_Att<limite_d_unit && Emplacement[C_Deff].Presence=="Base 2"){
Degat=int(Tunite_JI[U_Att].att-1);
if(Degat<=0){
Degat=1;}
Base[1].Vie-=Degat;
action=0;
Tunite_JI[U_Att].Phase_Perso=0;
Tunite_JI[U_Att].mouvement=0;
}
if(U_Att>=limite_d_unit && Emplacement[C_Deff].Presence=="Base 1"){
Degat=int(Tunite_JII[U_Att-limite_d_unit].att-1);
if(Degat<=0){
Degat=1;}
Base[0].Vie-=Degat;
action=0;
Tunite_JII[U_Att-limite_d_unit].Phase_Perso=0;
Tunite_JII[U_Att-limite_d_unit].mouvement=0;
}
if(U_Att<limite_d_unit && Emplacement[C_Deff].Presence=="Batiment 2"){
for(int B=0; B<Batiment_JII.length; B++){
if(BatimentVivant_JII[B]==true){
for(int X=0; X<taille*2; X+=taille){
for(int Y=0; Y<taille*2; Y+=taille){
if(Emplacement[C_Deff].xposition==Batiment_JII[B].xperso+X && Emplacement[C_Deff].yposition==Batiment_JII[B].yperso+Y){
Degat=int(Tunite_JI[U_Att].att-Batiment_JII[B].def);
if(Degat<=0){
Degat=1;}
Batiment_JII[B].Vie-=Degat;
action=0;
Tunite_JI[U_Att].Phase_Perso=0;
Tunite_JI[U_Att].mouvement=0;
}
}
}
}
}
}
if(U_Att>=limite_d_unit && Emplacement[C_Deff].Presence=="Batiment 1"){
for(int B=0; B<Batiment_JII.length; B++){
if(BatimentVivant_JI[B]==true){
for(int X=0; X<taille*2; X+=taille){
for(int Y=0; Y<taille*2; Y+=taille){
if(Emplacement[C_Deff].xposition==Batiment_JI[B].xperso+X && Emplacement[C_Deff].yposition==Batiment_JI[B].yperso+Y){
Degat=int(Tunite_JII[U_Att-limite_d_unit].att-Batiment_JI[B].def);
if(Degat<=0){
Degat=1;}
Batiment_JI[B].Vie-=Degat;
action=0;
Tunite_JII[U_Att-limite_d_unit].Phase_Perso=0;
Tunite_JII[U_Att-limite_d_unit].mouvement=0;
}
}
}
}
}
}
}

int NmbConstruc=8;
int NmbBatiment1;
int NmbBatiment2;
Batisse[] Batiment_JI= new Batisse[NmbConstruc];
Batisse[] Batiment_JII= new Batisse[NmbConstruc];
Batisse[] Batiment_Totale= new Batisse[NmbConstruc*2];
boolean[] BatimentVivant_JI= new boolean[NmbConstruc];
boolean[] BatimentVivant_JII= new boolean[NmbConstruc];
boolean[] BatimentVivant_Totale= new boolean[NmbConstruc*2];
class Batisse{
int xperso;
int yperso;
int Taille=taille*2;
int VieMax;
int Vie;
int def;
PImage Icon;
String Nom;
int J;
int Temps;
int NumCase;Batisse(int Nxperso, int Nyperso, int NVieMax, int Ndef, PImage NIcon, String NNom, int NJ, int NTemps){
xperso=Nxperso;
yperso=Nyperso;
VieMax=NVieMax;
Vie=VieMax;
def=Ndef;
Icon=NIcon;
Nom=NNom;
J=NJ;
Temps=NTemps;
}void Affichage(){
strokeWeight(2);
if(J==1){
fill(100,0,0,63);
stroke(200,0,0);
}
if(J==2){
fill(0,0,100,63);
stroke(0,0,200);
}
rect(xperso,yperso,taille*2,taille*2);
if(Temps>0){
fill(255);
image(IBatiment[0],xperso,yperso,taille*2,taille*2);
textSize(25);
text("Tour : "+Temps, xperso+taille/8,yperso+(taille*2));
}
if(Temps==0){
image(Icon,xperso,yperso,taille*2,taille*2);
}
noFill();
stroke(255);
strokeWeight(1);
}
}

int Limit_deck=20;
int Limit_ChoixDeck=0;
int Limit_Main=5;
int NmbGloss=17;
Carte[] Glossaire= new Carte[NmbGloss];
Carte[] Deck_JI= new Carte[Limit_deck];
Carte[] Deck_JII= new Carte[Limit_deck];
Carte[] Main_JI= new Carte[Limit_Main];
Carte[] Main_JII=new Carte[Limit_Main];
boolean[] DeckV1= new boolean[Limit_deck];
boolean[] DeckV2= new boolean[Limit_deck];
boolean[] MainV1= new boolean[Limit_Main];
boolean[] MainV2= new boolean[Limit_Main];
int[] NmbCarte_DebutDeck= new int[NmbGloss];
boolean AfficheMain=false;
int pioche=0;
int DeckPost_JI=0;
int DeckPost_JII=0;


class Carte{
int xposition;
int yposition;
int Cout1;
int Cout2;
PImage icon;
int xtaille_unit;
int ytaille_unit;
int VieMax;
int Vit;
String Portee;
int att;
int def;
String Faction;
String Type;
String Nom;
PImage Icon_unit;Carte(int Nxposition, int Nyposition, int Nxtaille_unit, int Nytaille_unit, int NCout1, int NCout2, int NVieMax, int NVit, int Natt, int Ndef, String NPortee, PImage Nicon, String NFaction, String NType, String NNom, PImage NIcon_unit){
xposition=Nxposition;
yposition=Nyposition;
xtaille_unit=Nxtaille_unit;
ytaille_unit=Nytaille_unit;
VieMax=NVieMax;
Vit=NVit;
Cout1=NCout1;
Cout2=NCout2;
Portee=NPortee;
att=Natt;
def=Ndef;
icon=Nicon;
Faction=NFaction;
Type=NType;
Nom=NNom;
Icon_unit=NIcon_unit;
}
}

Case[] Emplacement= new Case[300];class Case{
int xposition;
int yposition;
String Presence="Vide";
int NmbPresenceUnite;
int Tas_d_os;
int CaseNumero;
Boolean TextureAct=false;
PImage Texture;Case(int Nxposition, int Nyposition, int NCaseNumero){
xposition=Nxposition;
yposition=Nyposition;
CaseNumero=NCaseNumero;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Presence(){
////////////////////Presence/////////////////////////////////////////////////////
if(Presence!="Mur"){
Presence="Vide";
for(int U=0; U<Tunite_Total.length; U++){
if(TuniteVivant_Total[U]==true){
if(xposition==Tunite_Total[U].xperso && yposition==Tunite_Total[U].yperso){
if(U<limite_d_unit){
Presence="Joueur 1";
Tunite_Total[U].NumCase=CaseNumero;
}
if(U>=limite_d_unit){
Presence="Joueur 2";
Tunite_Total[U].NumCase=CaseNumero;
}
NmbPresenceUnite=U;
}
}
}
for(int B=0; B<Base.length; B++){
for(int X=0; X<taille*3; X+=taille){
for(int Y=0; Y<taille*3; Y+=taille){
if(xposition==Base[B].xperso+X && yposition==Base[B].yperso+Y){
if(B==0){ Presence="Base 1"; }
if(B==1){ Presence="Base 2"; }
}
}
}
}
for(int B=0; B<Batiment_JI.length; B++){
if(BatimentVivant_JI[B]==true){
for(int X=0; X<taille*2; X+=taille){
for(int Y=0; Y<taille*2; Y+=taille){
if(xposition==Batiment_JI[B].xperso+X && yposition==Batiment_JI[B].yperso+Y){
Presence="Batiment 1";
Batiment_JI[B].NumCase=CaseNumero;
}
}
}
}
}
for(int B=0; B<Batiment_JII.length; B++){
if(BatimentVivant_JII[B]==true){
for(int X=0; X<taille*2; X+=taille){
for(int Y=0; Y<taille*2; Y+=taille){
if(xposition==Batiment_JII[B].xperso+X && yposition==Batiment_JII[B].yperso+Y){
Presence="Batiment 2";
Batiment_JII[B].NumCase=CaseNumero;
}
}
}
}
}
}
///////////////Affichage//////////////////////////////////////////
if(Tas_d_os>0){
image(IconAdd[0],xposition+taille-34,yposition+taille-34,34,34);
}
if(mouseX>=xposition && mouseX<=xposition+taille){
if(mouseY>=yposition && mouseY<=yposition+taille){
fill(255);
textSize(20);
text("Case :",taille*20.5,taille*3);
textSize(15);
text(Presence,taille*20.75,taille*3.85);
if(Presence=="Joueur 1" || Presence=="Joueur 2"){
for(int i=0; i<Tunite_Total.length; i++){
if(TuniteVivant_Total[i]==true){
if(Tunite_Total[i].NumCase==CaseNumero){
text("Nom: "+Tunite_Total[i].Nom,taille*20.75,taille*4.20);
text("Vie: "+Tunite_Total[i].Vie,taille*20.75,taille*4.55);
text("Vitesse: "+Tunite_Total[i].vit,taille*20.75,taille*4.90);
text("Attaque: "+Tunite_Total[i].att,taille*20.75,taille*5.25);
text("Defense: "+Tunite_Total[i].def,taille*20.75,taille*5.65);
text("Portéé: "+Tunite_Total[i].portee,taille*20.75,taille*6);
}
}
}
}
if(Presence=="Batiment 1" ||Presence=="Batiment 2"){
for(int B=0; B<Batiment_JI.length; B++){
if(BatimentVivant_JI[B]==true){
if(Batiment_JI[B].NumCase==CaseNumero || Batiment_JI[B].NumCase+1 ==CaseNumero || Batiment_JI[B].NumCase+20==CaseNumero || Batiment_JI[B].NumCase+21==CaseNumero){
text("Nom: "+Batiment_JI[B].Nom,taille*20.75,taille*4.20);
text("Vie: "+Batiment_JI[B].Vie,taille*20.75,taille*4.55);
}
}
}
for(int B=0; B<Batiment_JII.length; B++){
if(BatimentVivant_JII[B]==true){
if(Batiment_JII[B].NumCase==CaseNumero || Batiment_JII[B].NumCase+1 ==CaseNumero || Batiment_JII[B].NumCase+20==CaseNumero || Batiment_JII[B].NumCase+21==CaseNumero){
text("Nom: "+Batiment_JII[B].Nom,taille*20.75,taille*4.20);
text("Vie: "+Batiment_JII[B].Vie,taille*20.75,taille*4.55);
}
}
}
}
if(Presence=="Base 1"){
text("Nom: Base du Joueur 1",taille*20.75,taille*4.20);
text("Vie: "+Base[0].Vie,taille*20.75,taille*4.55);
text("Defense: 1",taille*20.75,taille*4.90);
}
if(Presence=="Base 2"){
text("Nom: Base du Joueur 2",taille*20.75,taille*4.20);
text("Vie: "+Base[1].Vie,taille*20.75,taille*4.55);
text("Defense: 1",taille*20.75,taille*4.90);
}
text("Tas d'os x"+Tas_d_os,taille*20.75,taille*3.50);
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Couleur(){
noFill();
strokeWeight(2);
if(Presence=="Joueur 1"){
stroke(200,0,0);
rect(xposition,yposition,taille,taille);
}
if(Presence=="Joueur 2"){
stroke(0,0,200);
rect(xposition,yposition,taille,taille);
}
}
}

Commandant[] Base=new Commandant[2];
class Commandant{
int xperso;
int yperso;
int Taille=taille*3;
int RessI;
int RessII;
String Faction;
int VieMax;
int Vie;
int J;Commandant(int Nxperso, int Nyperso, int NRessI, int NRessII, String NFaction, int NVieMax){
xperso=Nxperso;
yperso=Nyperso;
RessI=NRessI;
RessII=NRessII;
Faction=NFaction;
VieMax=NVieMax;
Vie=VieMax;
}void Affichage(){
strokeWeight(2);
if(J==1){
fill(100,0,0,63);
stroke(200,0,0);
}
if(J==2){
fill(0,0,100,63);
stroke(0,0,200);
}
rect(xperso,yperso,taille*3,taille*3);
if(Faction=="Mort-Vivant"){
image(IBase[0],xperso,yperso,taille*3,taille*3);
}
noFill();
stroke(255);
strokeWeight(1);
}void Vie(){
if(Vie<=0){
textSize(30);
background(0);
fill(255,0,0,255);
if(J==1){
text("Victoire haut la main du Joueur 2.", taille*2,taille*7);}
if(J==2){
text("Victoire écrasante du Joueur 1.", taille*2,taille*7);}
}
}
}
void Affiche_Ressource(){
textSize(20);
fill(255);
stroke(255);
if(tour>=1 && tour<2){
text("Ressource 1: "+Base[0].RessI, taille*24.25,taille*2.25);
text("Ressource 2: "+Base[0].RessII, taille*24.25,taille*2.75);
text("Faction : "+Base[0].Faction, taille*24.25,taille*3.25);
text("Joueur 1", taille*25,taille*3.75);
}
if(tour>=2 && tour<3){
text("Ressource 1: "+Base[1].RessI, taille*24.25,taille*2.25);
text("Ressource 2: "+Base[1].RessII, taille*24.25,taille*2.75);
text("Faction : "+Base[1].Faction, taille*24.25,taille*3.25);
text("Joueur 2", taille*25,taille*3.75);
}
noFill();
}

boolean ConstAct=false;
void Construc(){
for(int C=0; C<Emplacement.length; C++){
if(C+1<300 && C+20<300 && C+21<300){
if(mouseX>=Emplacement[C].xposition && mouseX<=Emplacement[C].xposition+taille && mouseY>=Emplacement[C].yposition && mouseY<=Emplacement[C].yposition+taille){
fill(150,150,0,63);
strokeWeight(4);
stroke(150,150,0);
rect(Emplacement[C].xposition,Emplacement[C].yposition,taille*2,taille*2);
if(mousePressed==true){
if(tour>=1 && tour<2){
Batiment_JI[NmbBatiment1]=new Batisse(Emplacement[C].xposition,Emplacement[C].yposition, 10, 1, IBatiment[1], "Ferme à Charnier", 1, 2);
BatimentVivant_JI[NmbBatiment1]=true;
NmbBatiment1++;
}
if(tour>=2 && tour<3){
Batiment_JII[NmbBatiment2]=new Batisse(Emplacement[C].xposition,Emplacement[C].yposition, 10, 1, IBatiment[1], "Ferme à Charnier", 2, 2);
BatimentVivant_JII[NmbBatiment2]=true;
NmbBatiment2++;
}
Emplacement[C].Tas_d_os=0;
ConstAct=false;
action=0;
}
}
}
}
}

int Faction_Deck;
String ChFaction;
int Ress1;
int Ress2;
int Pcamera;
int CarteRestante=Limit_deck;
void Presentation(){
textSize(18);
if(Faction_Deck==0){
image(Boutton[4],taille*3,taille*3,taille*2,taille*2);
if(mouseX>=taille*3 && mouseX<=taille*5 && mouseY>=taille*3 && mouseY<=taille*5){
image(Boutton[4],taille*2.5,taille*2.5,taille*3,taille*3);
text("Deck Mort-Vivant Personnalisé",taille*1.5,taille*6.5);
if(mousePressed==true){Faction_Deck=1;}}
mousePressed=false;
}
textSize(30);
if(Faction_Deck==1){
textSize(25);
text("Carte restante: "+CarteRestante,50,centrey*2-60);
CarteRestante=Limit_deck-Limit_ChoixDeck;
ChFaction="Mort-Vivant";
Ress1=10;
Ress2=5;
textSize(30);
for(int C=0; C<Glossaire.length; C++){
image(Glossaire[C].icon, 50+300*(C-Pcamera),20,250,400);
image(TflecheDirectionnel[1], 70+300*(C-Pcamera),440,48,48);
image(TflecheDirectionnel[3], 235+300*(C-Pcamera),440,48,48);
text(NmbCarte_DebutDeck[C],165+300*(C-Pcamera),475);
//Flèche De Gauche////Soustrait//
if(mouseX>=70+300*(C-Pcamera) && mouseX<=70+48+300*(C-Pcamera) && mouseY>=440 && mouseY<=440+48){
image(TflecheDirectionnel[5], 70+300*C,440,48,48);
if(mousePressed==true){
NmbCarte_DebutDeck[C]--;
Limit_ChoixDeck--;
if(NmbCarte_DebutDeck[C]<0){
NmbCarte_DebutDeck[C]=0;
Limit_ChoixDeck++;}
mousePressed=false;
}
}
//Flèche de Droite////Additionne//
if(mouseX>=235+300*(C-Pcamera) && mouseX<=235+48+300*(C-Pcamera) && mouseY>=440 && mouseY<=440+48){
image(TflecheDirectionnel[7], 235+300*C,440,48,48);
if(mousePressed==true){
NmbCarte_DebutDeck[C]++;
Limit_ChoixDeck++;
if(Limit_ChoixDeck>Limit_deck){
NmbCarte_DebutDeck[C]=NmbCarte_DebutDeck[C]-1;
Limit_ChoixDeck--;}
mousePressed=false;
}
}
}
}
if(keyPressed==true){
if(key==ENTER){
Pcamera=0;
Position=0;
///Joueur 2///////////////////////////////////////////////////////////////////////////////////////////////
if(tour==2){
Base[1]= new Commandant(taille*17,taille*6, Ress1,Ress2, ChFaction, 15);
Base[1].J=2;
Base[1].RessI--;
for(int i=0; i<NmbCarte_DebutDeck.length; i++){
for(int N=0; N<NmbCarte_DebutDeck[i]; N++){
Deck_En_Cour[Position]=Glossaire[i];
Position++;
}
}
for(int i=0; i<Elimine.length; i++){
Elimine[i]=-1;
}
for(int D=0; D<Deck_JII.length; D++){
Actuel_Carte=D;
Random();
println(Random);
Deck_JII[Actuel_Carte]=Deck_En_Cour[Random];
DeckV2[Actuel_Carte]=true;
Elimine[Actuel_Carte]=Random;
}
for(int D=0; D<Limit_Main; D++){
tour=2;
Deck();
}
Histoire=2;
tour=1.2;
}
if(tour==0){
///Joueur 1///////////////////////////////////////////////////////////////////////////////////////////////
Base[0]= new Commandant(taille*0,taille*6, Ress1,Ress2, ChFaction, 15);
Base[0].J=1;
for(int i=0; i<NmbCarte_DebutDeck.length; i++){
for(int N=0; N<NmbCarte_DebutDeck[i]; N++){
Deck_En_Cour[Position]=Glossaire[i];
Position++;
}
}
for(int i=0; i<Elimine.length; i++){
Elimine[i]=-1;
}
for(int D=0; D<Deck_JI.length; D++){
Actuel_Carte=D;
Random();
println(Random);
Deck_JI[Actuel_Carte]=Deck_En_Cour[Random];
DeckV1[Actuel_Carte]=true;
Elimine[Actuel_Carte]=Random;
}
for(int D=0; D<Limit_Main; D++){
tour=1;
Deck();
}
tour=2;
keyPressed=false;
Faction_Deck=0;
for(int i=0; i<NmbCarte_DebutDeck.length; i++){
NmbCarte_DebutDeck[i]=0;
}
Limit_ChoixDeck=0;
}
}
}
if(keyPressed==true){
if(keyCode==RIGHT){
Pcamera++;}
if(keyCode==LEFT){
Pcamera--;
if(Pcamera<0){Pcamera=0;}}
keyPressed=false;
keyCode=0;
}
}
Carte[] Deck_En_Cour= new Carte[Limit_deck];
int Actuel_Carte=0;
int Random;
int Position=0;
int[] Elimine= new int[Limit_deck+1];void Random(){
Random=int(random(0,Limit_deck));
print(Random);
for(int E=0; E<Elimine.length; E++){
if(Random==Elimine[E]){
Random();
}
}
}

void Glossaire(){
/////MORT-VIVANT/////MORT-VIVANT/////MORT-VIVANT/////MORT-VIVANT/////MORT-VIVANT/////MORT-VIVANT/////MORT-VIVANT/////MORT-VIVANT/////MORT-VIVANT/////
////////UNITE////////UNITE////////UNITE////////UNITE//////
Glossaire[0]= new Carte(0,0, taille,taille, 1,0, 3,4, 2,0,"1", TICarte[1], "Mort-Vivant", "Unite", "Guerrier Squelette",IconUnite[0]);
Glossaire[1]= new Carte(0,0, taille,taille, 2,0, 2,4, 2,0,"2", TICarte[2], "Mort-Vivant", "Unite", "Archer Squelette",IconUnite[1]);
Glossaire[2]= new Carte(0,0, taille,taille, 5,4, 8,3, 2,1,"1", TICarte[3], "Mort-Vivant", "Unite", "Champion Squelette",IconUnite[2]);
Glossaire[3]= new Carte(0,0, taille,taille, 2,1, 2,3, 2,0,"1", TICarte[4], "Mort-Vivant", "Unite", "Zombie",IconUnite[3]);
Glossaire[4]= new Carte(0,0, taille,taille, 3,3, 5,4, 3,0,"1", TICarte[5], "Mort-Vivant", "Unite", "Goule",IconUnite[4]);
Glossaire[5]= new Carte(0,0, taille,taille, 3,4, 4,3, 5,0,"2", TICarte[6], "Mort-Vivant", "Unite", "Liche",IconUnite[5]);
Glossaire[6]= new Carte(0,0, taille,taille, 5,4, 3,4, 1,0,"1", TICarte[7], "Mort-Vivant", "Unite", "Nécromancien",IconUnite[6]);
Glossaire[7]= new Carte(0,0, taille,taille, 3,1, 3,5, 0,0,"1", TICarte[8], "Mort-Vivant", "Unite", "Fossoyeur",IconUnite[7]);
Glossaire[8]= new Carte(0,0, taille,taille, 2,2, 3,6, 2,0,"1", TICarte[9], "Mort-Vivant", "Unite", "Chien Zombie",IconUnite[8]);
////////SORT////////SORT////////SORT////////SORT//////
Glossaire[9]= new Carte(0,0, taille,taille, 2,0, 0,0, 0,0," ", TICarte[10], "Mort-Vivant", "Sort", "Fauchage",IconUnite[0]);
Glossaire[10]= new Carte(0,0, taille,taille, 0,2, 0,0, 0,0," ", TICarte[11], "Mort-Vivant", "Sort", "Récolte d'Os",IconUnite[0]);
Glossaire[11]= new Carte(0,0, taille,taille, 0,1, 0,0, 0,0," ", TICarte[12], "Mort-Vivant", "Sort", "Nécromancie",IconUnite[0]);
////////BATIMENT////////BATIMENT////////BATIMENT////////BATIMENT//////
Glossaire[12]= new Carte(0,0, taille,taille, 4,3, 10,2, 0,1," ", TICarte[13], "Mort-Vivant", "Batiment", "Ferme à Charnier",IBatiment[1]);
////////Amélioration////////Amélioration////////Amélioration////////Amélioration//////
Glossaire[13]= new Carte(0,0, taille,taille, 3,1, 0,3, 0,0," ", TICarte[14], "Mort-Vivant", "Amélioration", "Boyau Ferme",IBatiment[1]);
Glossaire[14]= new Carte(0,0, taille,taille, 2,5, 0,3, 0,0," ", TICarte[15], "Mort-Vivant", "Amélioration", "Projection Acide",IBatiment[1]);
Glossaire[15]= new Carte(0,0, taille,taille, 2,5, 0,3, 0,0," ", TICarte[16], "Mort-Vivant", "Amélioration", "Durcissement des Os",IBatiment[1]);
Glossaire[16]= new Carte(0,0, taille,taille, 3,6, 0,3, 0,0," ", TICarte[17], "Mort-Vivant", "Amélioration", "Soin Nécrotique",IBatiment[1]);
}

PImage ImgTps;
PImage[] TflecheDirectionnel= new PImage [8];
PImage[] TChiffre= new PImage[10];
PImage[] Val_Ann=new PImage[4];
PImage[] TFBasique= new PImage[6];
PImage[] TICarte= new PImage[42];
PImage[] Boutton= new PImage[5];
PImage[] IconUnite= new PImage[15];
PImage[] IBase= new PImage[2];
PImage[] IconAdd= new PImage[1];
PImage[] CaseAtt= new PImage[2];
PImage[] Bord= new PImage[9];
PImage[] IBatiment= new PImage[2];
void Importation(){
//Flèche directionnel
ImgTps=loadImage("Flèche directionnel 2.png");
for(int i=0; i<TflecheDirectionnel.length; i++){
TflecheDirectionnel[i]=ImgTps.get(0,64*i,64,64);
}
//Chiffre
ImgTps=loadImage("Chiffre.png");
for(int i=0; i<TChiffre.length; i++){
TChiffre[i]=ImgTps.get(0,64*i,64,64);
}//Valide Annule
ImgTps=loadImage("Valide_Annule.png");
for(int i=0; i<Val_Ann.length; i++){
Val_Ann[i]=ImgTps.get(0,64*i,64,64);
}//Forme Basique
ImgTps=loadImage("Forme Basique.png");
for(int i=0; i<TFBasique.length; i++){
TFBasique[i]=ImgTps.get(0,64*i,64,64);
}//Carte
TICarte[0]=loadImage("C_Défault.png");
//Mort_Vivant////////////////////////////////////////////////////////////////
//Unité/////////////////////////////////////
TICarte[1]=loadImage("CU_Guerrier-Squelette.png");
TICarte[2]=loadImage("CU_Archer Squelette.png");
TICarte[3]=loadImage("CU_Champion Squelette.png");
TICarte[4]=loadImage("CU_Zombie.png");
TICarte[5]=loadImage("CU_Goule.png");
TICarte[6]=loadImage("CU_Liche.png");
TICarte[7]=loadImage("CU_Nécromancien.png");
TICarte[8]=loadImage("CU_Fossoyeur.png");
TICarte[9]=loadImage("CU_Chien Zombie.png");
TICarte[10]=loadImage("CS_Fauchage.png");
TICarte[11]=loadImage("CS_Récolte d'Os.png");
TICarte[12]=loadImage("CS_Nécromancie.png");
TICarte[13]=loadImage("CB_Ferme à Charnier.png");
TICarte[14]=loadImage("CA_Boyau Ferme.png");
TICarte[15]=loadImage("CA_Projection Acide.png");
TICarte[16]=loadImage("CA_Durcissement des Os.png");
TICarte[17]=loadImage("CA_Soin Nécrotique.png");//case d'attaque
CaseAtt[0]=loadImage("Case.png");
CaseAtt[1]=loadImage("Case V.png");
Boutton[4]=loadImage("Paquet de carte.png");//Icone Unite
IconUnite[0]=loadImage("Ic_Guerrier Squelette.png");
IconUnite[1]=loadImage("Ic_Arc Squelette.png");
IconUnite[2]=loadImage("Ic_Champion Squelette.png");
IconUnite[3]=loadImage("Ic_Zombie.png");
IconUnite[4]=loadImage("Ic_Ghoul.png");
IconUnite[5]=loadImage("Ic_Liche.png");
IconUnite[6]=loadImage("Ic_Necromancien.png");
IconUnite[7]=loadImage("Ic_Bestiole.png");
IconUnite[8]=loadImage("Ic_Chien Zombie.png");
IconUnite[10]=loadImage("Ic_Guerrier Saint.png");
IconUnite[11]=loadImage("Ic_Arc Humain.png");//Icone Base
IBase[0]=loadImage("IcB_Mausolé.png");IconAdd[0]=loadImage("Crâne.png");//Bord
ImgTps=loadImage("Eau bord.png");
for(int i=0; i<9; i++){
Bord[i]=ImgTps.get(0,48*i,48,48);
}//Icon Batiment
IBatiment[0]=loadImage("Travaux.png");
IBatiment[1]=loadImage("Ferme Charnier 1.png");
}

void Main(){
if(AfficheMain==true){
if(tour>=1.1 && tour<2){
for(int C=0; C<Limit_Main; C++){
if(MainV1[C]==true){
image(Main_JI[C].icon,taille*6*C+(taille/4)*C,taille*3,taille*6,taille*10);
if(mouseX>=taille*6*C+(taille/4)*C && mouseX<=taille*6*C+(taille/4)*C+taille*6){
if(mouseY>=taille*3 && mouseY<=taille*3+taille*10){
noFill();
stroke(150,150,0);
strokeWeight(10);
rect(taille*6*C+(taille/4)*C,taille*3,taille*6,taille*10);
if(mousePressed==true){
if(Base[0].RessI-Main_JI[C].Cout1>=0 && Base[0].RessII-Main_JI[C].Cout2>=0){
/////Unité/////
if(Main_JI[C].Type=="Unite"){
Tunite_JI[NmbUnite1]= new Unite(/*Position*/taille*3,taille*7,/*taille*/Main_JI[C].xtaille_unit,Main_JI[C].xtaille_unit,/*Vie*/Main_JI[C].VieMax,/*Vitesse*/Main_JI[C].Vit,/*Stats*/Main_JI[C].att,Main_JI[C].def,/*Portee*/Main_JI[C].Portee,Main_JI[C].Icon_unit, Main_JI[C].Type, Main_JI[C].Nom, 1);
TuniteVivant_JI[NmbUnite1]= true;
NmbUnite1++;
if(NmbUnite1>=limite_d_unit){
NmbUnite1=0;
}
}
/////Sort/////
if(Main_JI[C].Type=="Sort"){
if(Main_JI[C].Nom=="Fauchage"){
Fauchage();
}
if(Main_JI[C].Nom=="Récolte d'Os"){
RecolteAct=true;
action=1;
}
if(Main_JI[C].Nom=="Nécromancie"){
NecroAct=true;
action=1;
}
}
/////Batiment/////
if(Main_JI[C].Type=="Batiment"){
if(Main_JI[C].Nom=="Ferme à Charnier"){
ConstAct=true;
action=1;
}
}
/////Amélioration/////
if(Main_JI[C].Type=="Amélioration"){
if(Main_JI[C].Nom=="Boyau Ferme"){
Boyau1=3;
BoyAct1=true;
}
if(Main_JI[C].Nom=="Projection Acide"){
ProjAcide_Act1=true;
ProjAcide1=3;
}
if(Main_JI[C].Nom=="Durcissement des OS"){
Os_DurAct1=true;
Os_Dur1=3;
}
if(Main_JI[C].Nom=="Soin Nécrotique"){
SoiNecAct1=true;
SoiNec1=3;
}
DeckV1[C]=false;
}
AfficheMain=false;
mousePressed=false;
Base[0].RessI-=Main_JI[C].Cout1;
Base[0].RessII-=Main_JI[C].Cout2;
MainV1[C]=false;
}
}
}
}
}
}
}
if(tour>=2 && tour<3){
for(int C=0; C<Limit_Main; C++){
if(MainV2[C]==true){
image(Main_JII[C].icon,taille*6*C+(taille/4)*C,taille*3,taille*6,taille*10);
if(mouseX>=taille*6*C+(taille/4)*C && mouseX<=taille*6*C+(taille/4)*C+taille*6){
if(mouseY>=taille*3 && mouseY<=taille*3+taille*10){
noFill();
stroke(150,150,0);
strokeWeight(10);
rect(taille*6*C+(taille/4)*C,taille*3,taille*6,taille*10);
if(mousePressed==true){
if(Base[1].RessI-Main_JII[C].Cout1>=0 && Base[1].RessII-Main_JII[C].Cout2>=0){
/////Unité/////
if(Main_JII[C].Type=="Unite"){
Tunite_JII[NmbUnite2]= new Unite(/*Position*/taille*16,taille*7,/*taille*/Main_JII[C].xtaille_unit,Main_JII[C].xtaille_unit,/*Vie*/Main_JII[C].VieMax,/*Vitesse*/Main_JII[C].Vit,/*Stats*/Main_JII[C].att,Main_JII[C].def,/*Portee*/Main_JII[C].Portee,Main_JII[C].Icon_unit, Main_JII[C].Type, Main_JII[C].Nom, 2);
TuniteVivant_JII[NmbUnite2]= true;
NmbUnite2++;
if(NmbUnite2>=limite_d_unit){
NmbUnite2=0;
}
}
/////Sort/////
if(Main_JII[C].Type=="Sort"){
if(Main_JII[C].Nom=="Fauchage"){
Fauchage();
}
if(Main_JII[C].Nom=="Récolte d'Os"){
RecolteAct=true;
action=1;
}
if(Main_JII[C].Nom=="Nécromancie"){
NecroAct=true;
action=1;
}
}
/////Batiment/////
if(Main_JII[C].Type=="Batiment"){
if(Main_JII[C].Nom=="Ferme à Charnier"){
ConstAct=true;
action=1;
}
}
/////Amélioration/////
if(Main_JII[C].Type=="Amélioration"){
if(Main_JII[C].Nom=="Boyau Ferme"){
BoyAct2=true;
Boyau2=3;
}
if(Main_JII[C].Nom=="Projection Acide"){
ProjAcide_Act2=true;
ProjAcide2=3;
}
if(Main_JII[C].Nom=="Durcissement des OS"){
Os_DurAct2=true;
Os_Dur2=3;
}
if(Main_JII[C].Nom=="Soin Nécrotique"){
SoiNecAct2=true;
SoiNec2=3;
}
DeckV2[C]=false;
}
AfficheMain=false;
mousePressed=false;
Base[1].RessI-=Main_JII[C].Cout1;
Base[1].RessII-=Main_JII[C].Cout2;
MainV2[C]=false;
}
}
}
}
}
}
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Deck(){
pioche=1;
if(tour==1){
for(int C=0; C<Limit_Main; C++){
if(MainV1[C]==false && pioche>=1){
Main_JI[C]=Deck_JI[DeckPost_JI];
DeckPost_JI++;
pioche--;
MainV1[C]=true;
if(DeckPost_JI>=Deck_JI.length){
Melange();
}
}
}
tour=1.1;
}
if(tour==2){
for(int C=0; C<Limit_Main; C++){
if(MainV2[C]==false && pioche>=1){
Main_JII[C]=Deck_JII[DeckPost_JII];
DeckPost_JII++;
pioche--;
MainV2[C]=true;
if(DeckPost_JII>=Deck_JII.length){
Melange();
}
}
}
tour=2.1;
}
}

int NmbEmplacement=0;
void quadrillage_D(){
noFill();
stroke(255);
strokeWeight(1);
for(int ycolonne=0; ycolonne<15; ycolonne++){
for (int xligne=0; xligne<20; xligne++){
rect(xligne*taille,ycolonne*taille,taille,taille);
Emplacement[NmbEmplacement]= new Case(xligne*taille,ycolonne*taille,NmbEmplacement);
NmbEmplacement++;
}
}
}
void Quadrillage(){
noFill();
stroke(255);
strokeWeight(1);
Mapping();
for(int ycolonne=0; ycolonne<15; ycolonne++){
for (int xligne=0; xligne<20; xligne++){
rect(xligne*taille,ycolonne*taille,taille,taille);
}
}
}
void Mapping(){
//Sup Coin H/G
image(Bord[0],taille*5,taille*2,taille,taille);
Emplacement[5+20*2].Presence="Mur";
//Sup Coin B/G
image(Bord[2],taille*5,taille*5,taille,taille);
Emplacement[5+20*5].Presence="Mur";
//Sup Coin H/D
image(Bord[1],taille*14,taille*2,taille,taille);
Emplacement[14+20*2].Presence="Mur";
//Sup Coin B/D
image(Bord[3],taille*14,taille*5,taille,taille);
Emplacement[14+20*5].Presence="Mur";//Sup Long G
for(int i=1; i<3; i++){
image(Bord[5],taille*5,taille*(i+2),taille,taille);
Emplacement[5+20*(i+2)].Presence="Mur";
}
//Sup Long D
for(int i=1; i<3; i++){
image(Bord[4],taille*14,taille*(i+2),taille,taille);
Emplacement[14+20*(i+2)].Presence="Mur";
}
//Sup Lond H
for(int i=1; i<9; i++){
image(Bord[7],taille*(5+i),taille*2,taille,taille);
Emplacement[(5+i)+20*2].Presence="Mur";
}
//Sup Lond B
for(int i=1; i<9; i++){
image(Bord[6],taille*(5+i),taille*5,taille,taille);
Emplacement[(5+i)+20*5].Presence="Mur";
}
//Sup Plein
for(int y=1; y<3; y++){
for(int x=1; x<9; x++){
image(Bord[8],taille*(x+5),taille*(y+2),taille,taille);
Emplacement[(5+x)+20*(y+2)].Presence="Mur";}
}//Inf Coin H/G
image(Bord[0],taille*5,taille*9,taille,taille);
Emplacement[5+20*9].Presence="Mur";
//Inf Coin B/G
image(Bord[2],taille*5,taille*12,taille,taille);
Emplacement[5+20*12].Presence="Mur";
//Inf Coin H/D
image(Bord[1],taille*14,taille*9,taille,taille);
Emplacement[14+20*9].Presence="Mur";
//Inf Coin B/D
image(Bord[3],taille*14,taille*12,taille,taille);
Emplacement[14+20*12].Presence="Mur";//Inf Long D
for(int i=1; i<3; i++){
image(Bord[5],taille*5,taille*(i+9),taille,taille);
Emplacement[5+20*(i+9)].Presence="Mur";
}
//Inf Long G
for(int i=1; i<3; i++){
image(Bord[4],taille*14,taille*(i+9),taille,taille);
Emplacement[14+20*(i+9)].Presence="Mur";
}
//Inf Lond H
for(int i=1; i<9; i++){
image(Bord[7],taille*(5+i),taille*9,taille,taille);
Emplacement[(5+i)+20*9].Presence="Mur";
}
//Inf Lond B
for(int i=1; i<9; i++){
image(Bord[6],taille*(5+i),taille*12,taille,taille);
Emplacement[(5+i)+20*12].Presence="Mur";
}
//Inf Plein
for(int y=1; y<3; y++){
for(int x=1; x<9; x++){
image(Bord[8],taille*(x+5),taille*(y+9),taille,taille);
Emplacement[(5+x)+20*(y+9)].Presence="Mur";}
}
}

void Fauchage(){
for(int U=0; U<Tunite_Total.length; U++){
if(TuniteVivant_Total[U]==true){
if(tour>=1 && tour<2){
if(U<limite_d_unit){
TuniteVivant_JI[U]=false;
Tunite_JI[U].Vie=0;
Base[0].RessII++;
}
}
if(tour>=2 && tour<3){
if(U>=limite_d_unit){
TuniteVivant_JII[U-limite_d_unit]=false;
Tunite_JII[U-limite_d_unit].Vie=0;
Base[1].RessII++;
}
}
}
}
}
boolean RecolteAct=false;
boolean NecroAct=false;
void Recolte_D_os(){
for(int C=0; C<Emplacement.length; C++){
if(Emplacement[C].Tas_d_os>0){
if(mouseX>=Emplacement[C].xposition && mouseX<=Emplacement[C].xposition+taille && mouseY>=Emplacement[C].yposition && mouseY<=Emplacement[C].yposition+taille){
noFill();
strokeWeight(3);
stroke(150,150,0);
rect(Emplacement[C].xposition,Emplacement[C].yposition,taille,taille);
if(mousePressed==true){
if(tour>=1 && tour<2){
Base[0].RessI+=Emplacement[C].Tas_d_os;
}
if(tour>=2 && tour<3){
Base[1].RessI+=Emplacement[C].Tas_d_os;
}
Emplacement[C].Tas_d_os=0;
RecolteAct=false;
action=0;
}
}
}
}
}
void Necro(){
for(int C=0; C<Emplacement.length; C++){
if(Emplacement[C].Tas_d_os>0){
if(mouseX>=Emplacement[C].xposition && mouseX<=Emplacement[C].xposition+taille && mouseY>=Emplacement[C].yposition && mouseY<=Emplacement[C].yposition+taille){
noFill();
strokeWeight(3);
stroke(150,150,0);
rect(Emplacement[C].xposition,Emplacement[C].yposition,taille,taille);
if(mousePressed==true){
if(tour>=1 && tour<2){
Tunite_JI[NmbUnite1]= new Unite(Emplacement[C].xposition,Emplacement[C].yposition, taille,taille, 3,4, 2,0,"1",IconUnite[0],"Unite", "Guerrier Squellete",1);
TuniteVivant_JI[NmbUnite1]= true;
Tunite_JI[NmbUnite1].Tour_action=0;
NmbUnite1++;
}
if(tour>=2 && tour<3){
Tunite_JII[NmbUnite2]= new Unite(Emplacement[C].xposition,Emplacement[C].yposition, taille,taille, 3,4, 2,0,"1",IconUnite[0],"Unite", "Guerrier Squellete",2);
TuniteVivant_JII[NmbUnite2]= true;
Tunite_JII[NmbUnite2].Tour_action=0;
NmbUnite2++;
}
Emplacement[C].Tas_d_os=0;
NecroAct=false;
action=0;
}
}
}
}
}

void Special_Os(){
for(int U=0; U<Tunite_Total.length; U++){
if(TuniteVivant_Total[U]==true){
/////Necromancien/////
if(Tunite_Total[U].Phase_Perso==3){
U_Att=U;
for(int C=0; C<Emplacement.length; C++){
if(Tunite_Total[U].xperso==Emplacement[C].xposition && Tunite_Total[U].yperso==Emplacement[C].yposition){
positionCase=C;
}
image(CaseAtt[1],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso-taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso+taille+1,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
if(mousePressed==true){
if(mouseButton==LEFT){
///////
C_Deff=positionCase+1;
for(int i=0; i<4; i++){
if(C_Deff>=0 && C_Deff<300){
if(Emplacement[C_Deff].Presence=="Vide" && Emplacement[C_Deff].Tas_d_os>0){
if(mouseX>=Emplacement[C_Deff].xposition && mouseX<=Emplacement[C_Deff].xposition+taille && mouseY>=Emplacement[C_Deff].yposition && mouseY<=Emplacement[C_Deff].yposition+taille){
if(Tunite_Total[U].Nom=="Necromancien"){
if(Tunite_Total[U].Competence==1){
Releve_Mort();}
if(Tunite_Total[U].Nom=="Fossoyeur"){
Collecte();}
}
}
}
if(Emplacement[C_Deff].Presence=="Joueur 1" || Emplacement[C_Deff].Presence=="Joueur 2"){
if(mouseX>=Emplacement[C_Deff].xposition && mouseX<=Emplacement[C_Deff].xposition+taille && mouseY>=Emplacement[C_Deff].yposition && mouseY<=Emplacement[C_Deff].yposition+taille){
if(Tunite_Total[U].Nom=="Necromancien"){
if(Tunite_Total[U].Competence==2){
SoinNecro();
}
}
}
}
if(C_Deff==positionCase-20){C_Deff=positionCase+20;}
if(C_Deff==positionCase-1){C_Deff=positionCase-20;}
if(C_Deff==positionCase+1){C_Deff=positionCase-1;}
}
}
}
}
}
}
}
}
}void Releve_Mort(){
Emplacement[C_Deff].Tas_d_os--;
if(U_Att<limite_d_unit){
Tunite_JI[NmbUnite1]= new Unite(Emplacement[C_Deff].xposition,Emplacement[C_Deff].yposition, taille,taille, 3,4, 2,0,"1",IconUnite[0],"Unite", "Guerrier Squellete",1);
TuniteVivant_JI[NmbUnite1]= true;
NmbUnite1++;
action=0;
Tunite_JI[U_Att].Phase_Perso=0;
Tunite_JI[U_Att].mouvement=0;
}
if(U_Att>=limite_d_unit){
Tunite_JII[NmbUnite1]= new Unite(Emplacement[C_Deff].xposition,Emplacement[C_Deff].yposition, taille,taille, 3,4, 2,0,"1",IconUnite[0],"Unite", "Guerrier Squellete",2);
TuniteVivant_JII[NmbUnite1]= true;
NmbUnite2++;
action=0;
Tunite_JII[U_Att-limite_d_unit].Phase_Perso=0;
Tunite_JII[U_Att-limite_d_unit].mouvement=0;
}
}
void Collecte(){
if(U_Att<limite_d_unit){
Emplacement[C_Deff].Tas_d_os--;
Base[0].RessI++;
action=0;
Tunite_JI[U_Att].Phase_Perso=0;
Tunite_JI[U_Att].mouvement=0;
}
if(U_Att>=limite_d_unit){
Emplacement[C_Deff].Tas_d_os--;
Base[1].RessI++;
action=0;
Tunite_JII[U_Att-limite_d_unit].Phase_Perso=0;
Tunite_JII[U_Att-limite_d_unit].mouvement=0;
}
}
void SoinNecro(){
if(U_Att<limite_d_unit && Emplacement[C_Deff].Presence=="Joueur 1"){
for(int U=0; U<Tunite_JI.length; U++){
if(TuniteVivant_JI[U]==true){
if(Tunite_JI[U_Att].Phase_Perso==3){
if(Tunite_JI[U].xperso==Emplacement[C_Deff].xposition && Tunite_JI[U].yperso==Emplacement[C_Deff].yposition){
Degat=4;
if(Degat+Tunite_JI[U].Vie<=Tunite_JI[U].VieMax){
Tunite_JI[U].Vie+=Degat;
}
else{
Degat=(Degat+Tunite_JI[U].Vie)-Tunite_JI[U].VieMax;
Tunite_JI[U].Vie+=Degat;
}
}
}
}
}
}
if(U_Att>=limite_d_unit && Emplacement[C_Deff].Presence=="Joueur 2"){
for(int U=0; U<Tunite_JII.length; U++){
if(TuniteVivant_JII[U]==true){
if(Tunite_JII[U_Att-limite_d_unit].Phase_Perso==3){
if(Tunite_JII[U].xperso==Emplacement[C_Deff].xposition && Tunite_JII[U].yperso==Emplacement[C_Deff].yposition){
Degat=4;
if(Degat+Tunite_JII[U].Vie<=Tunite_JII[U].VieMax){
Tunite_JII[U].Vie+=Degat;
}
else{
Degat=(Degat+Tunite_JII[U].Vie)-Tunite_JII[U].VieMax;
Tunite_JII[U].Vie+=Degat;
}
}
}
}
}
}
}

int limite_d_unit=30;
void Unit_Actu(){
for(int U=0; U<Tunite_JI.length; U++){
if(TuniteVivant_JI[U]==true){
Tunite_Total[U]= Tunite_JI[U];
TuniteVivant_Total[U]= true;
}
}
for(int U=0; U<Tunite_JII.length; U++){
if(TuniteVivant_JII[U]==true){
Tunite_Total[U+limite_d_unit]= Tunite_JII[U];
TuniteVivant_Total[U+limite_d_unit]= true;
}
}
}
void Unit_Actu_Retour(){
for(int U=0; U<Tunite_Total.length; U++){
if(TuniteVivant_Total[U]==true){
if(U<limite_d_unit){
Tunite_JI[U]=Tunite_Total[U];
}
if(U>=limite_d_unit){
Tunite_JII[U-limite_d_unit]=Tunite_Total[U];
}
}
}
}

void Tour_De_Jeu(){
if(keyPressed==true){
if(key=='p'){
for(int U=0; U<Tunite_JII.length;U++){
if(TuniteVivant_JII[U]==true){
Tunite_JII[U].Tour_action=0;
Tunite_JII[U].mouvement=0;
Tunite_JII[U].Phase_Perso=0;
}
}
for(int U=0; U<Tunite_JI.length;U++){
if(TuniteVivant_JI[U]==true){
Tunite_JI[U].Tour_action=0;
Tunite_JI[U].mouvement=0;
Tunite_JI[U].Phase_Perso=0;
}
}
tour+=0.8;
if(tour>=3){ tour=1;}
Deck();
//////////////Joueur 1////////////////////////
if(tour==1.1){
Base[0].RessI++;
for(int U=0; U<Tunite_JI.length;U++){
if(TuniteVivant_JI[U]==true){
Tunite_JI[U].Tour_action=1;
}
}
for(int B=0; B<Batiment_JI.length; B++){
if(BatimentVivant_JI[B]==true){
if(Batiment_JI[B].Temps==0){
if(Batiment_JI[B].Nom=="Ferme à Charnier"){
Base[0].RessI++;
}
}
if(Batiment_JI[B].Temps>0){
Batiment_JI[B].Temps--;
}
}
}
if(Boyau1>=0){ Boyau1--;}
if(ProjAcide1>=0){ ProjAcide1--;}
if(Os_Dur1>=0){ Os_Dur1--;}
tour=1.2;
}
//////////////Joueur 2////////////////////////
if(tour==2.1){
Base[1].RessI++;
for(int U=0; U<Tunite_JII.length;U++){
if(TuniteVivant_JII[U]==true){
Tunite_JII[U].Tour_action=1;
}
}
for(int B=0; B<Batiment_JII.length; B++){
if(BatimentVivant_JII[B]==true){
if(Batiment_JII[B].Temps==0){
if(Batiment_JII[B].Nom=="Ferme à Charnier"){
Base[1].RessI++;
}
}
if(Batiment_JII[B].Temps>0){
Batiment_JII[B].Temps--;
}
}
}
if(Boyau2>=0){ Boyau2--;}
if(ProjAcide2>=0){ ProjAcide2--;}
if(Os_Dur2>=0){ Os_Dur2--;}
tour=2.2;
}
keyPressed=false;
key=0;
}
}
}
///////////////////////////////////////////////////////////////////////
void Melange(){
for(int i=0; i<Elimine.length; i++){
Elimine[i]=-1;
}
//////////////Joueur 1/////////////////////
if(tour==1){
DeckPost_JI=0;
for(int D=0; D<Deck_En_Cour.length; D++){
Deck_En_Cour[D]=Deck_JI[D];
}
for(int D=0; D<Deck_JI.length; D++){
if(DeckV1[Actuel_Carte]==true){
Actuel_Carte=D;
Random();
println(Random);
Deck_JI[Actuel_Carte]=Deck_En_Cour[Random];
DeckV1[Actuel_Carte]=true;
Elimine[Actuel_Carte]=Random;
}
}
}
//////////////Joueur 1/////////////////////
if(tour==2){
DeckPost_JII=0;
for(int D=0; D<Deck_En_Cour.length; D++){
Deck_En_Cour[D]=Deck_JII[D];
}
for(int D=0; D<Deck_JII.length; D++){
if(DeckV2[Actuel_Carte]==true){
Actuel_Carte=D;
Random();
println(Random);
Deck_JII[Actuel_Carte]=Deck_En_Cour[Random];
DeckV2[Actuel_Carte]=true;
Elimine[Actuel_Carte]=Random;
}
}
}
}

Unite[] Tunite_JI= new Unite[limite_d_unit];
Unite[] Tunite_JII=new Unite[limite_d_unit];
Unite[] Tunite_Total= new Unite[limite_d_unit*2];
boolean[] TuniteVivant_JI= new boolean[limite_d_unit];
boolean[] TuniteVivant_JII=new boolean[limite_d_unit];
boolean[] TuniteVivant_Total= new boolean[limite_d_unit*2];
int NmbUnite1=0;
int NmbUnite2=0;
class Unite{
int xperso;
int yperso;
int taille;
int xOriPerso;
int yOriPerso;
int Vie;
int VieMax;
int Cout1;
int Cout2;
int vit=5;
String portee;
float att;
int def;
int mouvement;
PImage icon;
float Phase_Perso;
int Tour_action=1;
String Type;
String Nom;
int NumCase;
int Competence;
int J;Unite(int Nxperso, int Nyperso, int Nxtaille, int Nytaille, int NVieMax, int Nvit, float Natt, int Ndef, String Nportee, PImage Nicon, String NType, String NNom, int NJ){
xperso=Nxperso;
yperso=Nyperso;
taille=Nxtaille;
VieMax=NVieMax;
Vie=VieMax;
vit=Nvit;
att=Natt;
def=Ndef;
portee=Nportee;
Type=NType;
icon=Nicon;
Nom=NNom;
J=NJ;
}void affichage(){
image(icon,xperso+1,yperso+1,taille-1,taille-1);
if(Tour_action<=0 && Phase_Perso<=0){
fill(150,85);
rect(xperso,yperso,taille,taille);
}
if(Phase_Perso>=1){
noFill();
strokeWeight(6);
stroke(200,200,0);
rect(xperso,yperso,taille,taille);
strokeWeight(1);
stroke(255);
}
}void Selection(){
if(Tour_action>0){
if(action==0){
if(mouvement<=0){
if(mouseX>=xperso && mouseX<=xperso+taille){
if(mouseY>=yperso && mouseY<= yperso+taille){
if(mousePressed==true){
mouvement=vit;
action=1;
Phase_Perso=1;
Tour_action=Tour_action-1;
xOriPerso=xperso;
yOriPerso=yperso;
}
}
}
}
}
}
}void Deplacement(){
if(mouvement>0){
if(keyPressed==true){
//Haut///////////////////////////////Haut//
if(keyCode==UP){
if(Emplacement[NumCase-20].Presence=="Vide"){
yperso=yperso-taille;
mouvement=mouvement-1;
if(yperso<0){
yperso=0;
mouvement=mouvement+1;
}
}
}
//Bas/////////////////////////////////Bas//
if(keyCode==DOWN){
if(Emplacement[NumCase+20].Presence=="Vide"){
yperso=yperso+taille;
mouvement=mouvement-1;
if(yperso>=taille*15){
yperso=taille*14;
mouvement=mouvement+1;
}
}
}
//Gauche///////////////////////////Gauche//
if(keyCode==LEFT){
if(Emplacement[NumCase-1].Presence=="Vide"){
xperso=xperso-taille;
mouvement=mouvement-1;
if(xperso<0){
xperso=0;
mouvement++;
}
}
}
//Droite///////////////////////////Droite//
if(keyCode==RIGHT){
if(Emplacement[NumCase+1].Presence=="Vide"){
xperso=xperso+taille;
mouvement=mouvement-1;
if(xperso>=taille*20){
xperso=taille*19;
mouvement++;
}
}
}
keyCode=0;
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ChangePhase(){
if(action>0){
if(Phase_Perso>0){
if(mousePressed==true && mouseButton==RIGHT){
xperso=xOriPerso;
yperso=yOriPerso;
action=0;
Phase_Perso=0;
mouvement=0;
Tour_action++;
mouseButton=0;
}
}
if(Phase_Perso==1){
if(keyPressed==true && key=='1'){
Phase_Perso=2;
if(Nom=="Nécromancien"){
Competence=1;
Phase_Perso=3;
}
if(Nom=="Fossoyeur"){
Phase_Perso=3;
}
key=0;
keyPressed=false;
}
}
if(Phase_Perso==1){
if(keyPressed==true && key=='2'){
Phase_Perso=2;
if(Nom=="Nécromancien"){
if(J==1 && SoinNecro1==true){
Competence=2;
Phase_Perso=3;
}
if(J==2 && SoinNecro2==true){
Competence=2;
Phase_Perso=3;
}
}
key=0;
keyPressed=false;
}
}
if(Phase_Perso>=1){
if(keyPressed==true && key==ENTER){
action=0;
Phase_Perso=0;
mouvement=0;
key=0;
keyPressed=false;
}
}
}
}
}

Créez votre site web gratuitement ! Ce site internet a été réalisé avec Webnode. Créez le votre gratuitement aujourd'hui ! Commencer