
int centrex=850;
int taille=48;
int action=0;
int Histoire=1;
float tour=0;
int casex=19;
int casey=30;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){
Camera();
Tour_De_Jeu();
Quadrillage();
Afficher_Main();
Attaque();
Special_Os();
Deluge_Fleche();
Sort_Soin();
Casque();
Lame();
Rue_Or();
/////////////////////Special//////////
if(RecolteAct==true){
Recolte_D_os();
}
if(NecroAct==true){
Necro();
}
if(ConstAct==true){
Construc();
}
Boyau_Ferme();
Project_Acide();
OS_Dur();
SoinNecrotique();
Cristal_Soin();
Acier_UP();
/////////////////////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_Actu_Retour();
/////////////////////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].FinAction();
}
}
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].FinAction();
}
}
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();
}
for(int B=0; B<Base.length; B++){
Base[B].Vie();
}
Main();
}
if(Histoire==1){
Presentation();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Afficher_Main(){
image(Boutton[4], taille*21,taille*0.5,64,64);
if(mouseX>=taille*21 && mouseX<=taille*21+64 && mouseY>=taille*0.5 && mouseY<=taille*0.5+64){
image(Boutton[4], taille*21-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;
}
}
}
}
int Cristal1=-1;
int Cristal2=-1;
boolean CristalAct1=false;
boolean CristalAct2=false;
int Acier1=-1;
int Acier2=-2;
boolean AcierAct1=false;
boolean AcierAct2=false;
void Cristal_Soin(){
textSize(20);
fill(255);
if(CristalAct1==true){
if(tour>=1 && tour<2){
if(Cristal1>0){
text("Cristal de Soin dans "+Cristal1+" tour",taille*19.75,taille*5.25);}
if(Cristal1==0){
for(int C=0; C<Deck_JI.length; C++){
if(Deck_JI[C].Nom=="Prêtre"){
if(Deck_JI[C].J==1){
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=="Prêtre"){
Tunite_JI[U].portee="1-2";
}
}
}
}
}
}
if(CristalAct2==true){
if(tour>=2 && tour<3){
if(Cristal2>0){
text("Cristal de Soin dans "+Cristal2+" tour",taille*19.75,taille*5.25);}
if(Cristal2==0){
for(int C=0; C<Deck_JII.length; C++){
if(Deck_JII[C].Nom=="Prêtre"){
if(Deck_JII[C].J==2){
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=="Prêtre"){
Tunite_JII[U].portee="1-2";
}
}
}
}
}
}
}
void Acier_UP(){
textSize(20);
fill(255);
if(AcierAct1==true){
if(tour>=1 && tour<2){
if(Acier1>0){
text("Acier de qualité supérieur dans "+Acier1+" tour",taille*19.5,taille*5.75);}
if(Acier1==0){
Acier1--;
for(int C=0; C<Deck_JI.length; C++){
if(Deck_JI[C].Nom=="Ecuyer" || Deck_JI[C].Nom=="Cavalier" || Deck_JI[C].Nom=="Eclaireur"){
if(Deck_JI[C].J==1){
Deck_JI[C].att++;
}
}
}
for(int U=0; U<Tunite_JI.length; U++){
if(TuniteVivant_JI[U]==true){
if(Tunite_JI[U].Nom=="Ecuyer" || Tunite_JI[U].Nom=="Cavalier" || Tunite_JI[U].Nom=="Eclaireur" ){
Tunite_JI[U].att++;
}
}
}
}
}
}
if(AcierAct2==true){
if(tour>=2 && tour<3){
if(Acier2>0){
text("Acier de qualité supérieur dans "+Acier2+" tour",taille*19.5,taille*5.75);}
if(Acier2==0){
Acier2--;
for(int C=0; C<Deck_JII.length; C++){
if(Deck_JII[C].Nom=="Ecuyer" || Deck_JII[C].Nom=="Cavalier" || Deck_JII[C].Nom=="Eclaireur"){
if(Deck_JII[C].J==2){
Deck_JII[C].att++;
}
}
}
for(int U=0; U<Tunite_JII.length; U++){
if(TuniteVivant_JII[U]==true){
if(Tunite_JII[U].Nom=="Ecuyer" || Tunite_JII[U].Nom=="Cavalier" || Tunite_JII[U].Nom=="Eclaireur" ){
Tunite_JII[U].att++;
}
}
}
}
}
}
}
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*19.75,taille*5.25);}
if(Boyau1==0){
for(int C=0; C<Deck_JI.length; C++){
if(Deck_JI[C].Nom=="Archer Squelette"){
if(Deck_JI[C].J==1){
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*19.75,taille*5.25);}
if(Boyau2==0){
for(int C=0; C<Deck_JII.length; C++){
if(Deck_JII[C].Nom=="Archer Squelette"){
if(Deck_JII[C].J==2){
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*19.5,taille*5.75);}
if(ProjAcide1==0){
for(int C=0; C<Limit_deck; C++){
if(Deck_JI[C].Nom=="Zombie"){
if(Deck_JI[C].J==1){
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*19.5,taille*5.75);}
if(ProjAcide2==0){
for(int C=0; C<Limit_deck; C++){
if(Deck_JII[C].Nom=="Zombie"){
if(Deck_JII[C].J==2){
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*19.5,taille*6.25);}
if(Os_Dur1==0){
Os_Dur1--;
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"){
if(Deck_JI[C].J==1){
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){
Os_Dur2--;
text("Durcissement des Os dans "+Os_Dur2+" tour",taille*19.5,taille*6.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"){
if(Deck_JII[C].J==2){
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++;
}
}
}
}
}
}
}
void SoinNecrotique(){
textSize(20);
fill(255);
if(SoiNecAct1==true){
if(tour>=1 && tour<2){
if(SoiNec1>0){
text("Soin Nécrotique dans "+SoiNec1+" tour",taille*19.5,taille*6.75);}
if(SoiNec1==0){
SoinNecro1=true;
}
}
}
if(SoiNecAct2==true){
if(tour>=2 && tour<3){
if(SoiNec2>0){
text("Soin Nécrotique dans "+SoiNec2+" tour",taille*19.5,taille*6.75);}
if(SoiNec2==0){
SoinNecro2=true;
}
}
}
}
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-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso-taille+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso+taille+1-Pcamera,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<570){
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-Pcamera && mouseY<=Emplacement[C_Deff].yposition+taille-Pcamera){
Degat();
}
}
}
if(C_Deff==positionCase-19){C_Deff=positionCase+19;}
if(C_Deff==positionCase-1){C_Deff=positionCase-19;}
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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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<570){
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-Pcamera && mouseY<=Emplacement[C_Deff].yposition+taille-Pcamera){
Degat();
}
}
}
if(C_Deff==positionCase-20){C_Deff=positionCase+20;}
if(C_Deff==positionCase+18){C_Deff=positionCase-20;}
if(C_Deff==positionCase-18){C_Deff=positionCase+18;}
if(C_Deff==positionCase+38){C_Deff=positionCase-18;}
if(C_Deff==positionCase-38){C_Deff=positionCase+38;}
if(C_Deff==positionCase-2){C_Deff=positionCase-38;}
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-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso-taille+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[0],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso+taille+1-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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<570){
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-Pcamera && mouseY<=Emplacement[C_Deff].yposition+taille-Pcamera){
Degat();
}
}
}
if(C_Deff==positionCase-20){C_Deff=positionCase+20;}
if(C_Deff==positionCase+18){C_Deff=positionCase-20;}
if(C_Deff==positionCase-18){C_Deff=positionCase+18;}
if(C_Deff==positionCase+38){C_Deff=positionCase-18;}
if(C_Deff==positionCase-38){C_Deff=positionCase+38;}
if(C_Deff==positionCase-2){C_Deff=positionCase-38;}
if(C_Deff==positionCase+2){C_Deff=positionCase-2;}
if(C_Deff==positionCase+19){C_Deff=positionCase+2;}
if(C_Deff==positionCase-19){C_Deff=positionCase+15;}
if(C_Deff==positionCase-1){C_Deff=positionCase-19;}
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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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-Pcamera,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<20; i++){
if(C_Deff>=0 && C_Deff<570){
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-Pcamera && mouseY<=Emplacement[C_Deff].yposition+taille-Pcamera){
Degat();
}
}
}
if(C_Deff==positionCase-39){C_Deff=positionCase+39;}
if(C_Deff==positionCase+37){C_Deff=positionCase-39;}
if(C_Deff==positionCase-37){C_Deff=positionCase+37;}
if(C_Deff==positionCase+21){C_Deff=positionCase-37;}
if(C_Deff==positionCase-21){C_Deff=positionCase+21;}
if(C_Deff==positionCase+17){C_Deff=positionCase-21;}
if(C_Deff==positionCase-17){C_Deff=positionCase+17;}
if(C_Deff==positionCase+57){C_Deff=positionCase-17;}
if(C_Deff==positionCase-57){C_Deff=positionCase+57;}
if(C_Deff==positionCase+3){C_Deff=positionCase-57;}
if(C_Deff==positionCase-3){C_Deff=positionCase+3;}
if(C_Deff==positionCase+20){C_Deff=positionCase-3;}
if(C_Deff==positionCase-20){C_Deff=positionCase+20;}
if(C_Deff==positionCase+18){C_Deff=positionCase-20;}
if(C_Deff==positionCase-18){C_Deff=positionCase+18;}
if(C_Deff==positionCase+38){C_Deff=positionCase-18;}
if(C_Deff==positionCase-38){C_Deff=positionCase+38;}
if(C_Deff==positionCase-2){C_Deff=positionCase-38;}
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].NumCase==C_Deff){
Degat=int(Tunite_JI[U_Att].att-Tunite_JII[U].def);
//Cavalier
if(Tunite_JI[U_Att].Nom=="Cavalier" && Tunite_JI[U_Att].mouvement<=0){ Degat=Degat*2;}
if(Degat<=0){
Degat=1;}
//Eclaireur
if(Tunite_JII[U].Nom=="Eclaireur"){ Random=int(random(1,3));
if(Random==1 || Random==3){ Tunite_JII[U].Vie-=Degat; } }
//affectation de dégat
else{Tunite_JII[U].Vie-=Degat;}
//Spécial
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].NumCase==C_Deff){
Degat=int(Tunite_JII[U_Att-limite_d_unit].att-Tunite_JI[U].def);
//Cavalier
if(Tunite_JII[U_Att-limite_d_unit].Nom=="Cavalier" && Tunite_JII[U_Att-limite_d_unit].mouvement<=0){ Degat=Degat*2;}
if(Degat<=0){
Degat=1;}
//Eclaireur
if(Tunite_JI[U].Nom=="Eclaireur"){ Random=int(random(1,3));
if(Random==1 || Random==3){ Tunite_JI[U].Vie-=Degat; } }
//affectation de dégat
else{Tunite_JI[U].Vie-=Degat;}
//Spécial
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){
if(Batiment_JII[B].Taille=="3*3"){
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-Pcamera==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(Batiment_JII[B].Taille=="2*1"){
for(int X=0; X<taille*2; X+=taille){
if(Emplacement[C_Deff].xposition==Batiment_JII[B].xperso+X && Emplacement[C_Deff].yposition-Pcamera==Batiment_JII[B].yperso){
Degat=int(Tunite_JI[U_Att-limite_d_unit].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(Batiment_JII[B].Taille=="3*1"){
for(int X=0; X<taille*3; X+=taille){
if(Emplacement[C_Deff].xposition==Batiment_JII[B].xperso+X && Emplacement[C_Deff].yposition-Pcamera==Batiment_JII[B].yperso){
Degat=int(Tunite_JI[U_Att-limite_d_unit].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_JI.length; B++){
if(BatimentVivant_JI[B]==true){
if(Batiment_JI[B].Taille=="3*3"){
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-Pcamera==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;
}
}
}
}
if(Batiment_JI[B].Taille=="2*1"){
for(int X=0; X<taille*2; X+=taille){
if(Emplacement[C_Deff].xposition==Batiment_JI[B].xperso+X && Emplacement[C_Deff].yposition-Pcamera==Batiment_JI[B].yperso){
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;
}
}
}
if(Batiment_JI[B].Taille=="3*1"){
for(int X=0; X<taille*3; X+=taille){
if(Emplacement[C_Deff].xposition==Batiment_JI[B].xperso+X && Emplacement[C_Deff].yposition-Pcamera==Batiment_JI[B].yperso){
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;
String Taille="3*3";
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);
}
if(Taille=="3*3"){
rect(xperso,yperso-Pcamera,taille*2,taille*2);
}
if(Taille=="2*1"){
rect(xperso,yperso-Pcamera,taille*2,taille);
}
if(Taille=="3*1"){
rect(xperso,yperso-Pcamera,taille*3,taille);
}
if(Temps>0){
fill(255);
if(Taille=="3*3"){
image(IBatiment[0],xperso,yperso-Pcamera,taille*2,taille*2);
textSize(25);
text("Tour : "+Temps, xperso+taille/8,yperso+(taille*2)-Pcamera);
}
if(Taille=="2*1"){
image(IBatiment[0],xperso,yperso-Pcamera,taille*2,taille);
textSize(25);
text("Tour : "+Temps, xperso+taille/8,yperso+(taille)-Pcamera);
}
if(Taille=="3*1"){
image(IBatiment[0],xperso,yperso-Pcamera,taille*3,taille);
textSize(25);
text("Tour : "+Temps, xperso+taille/4,yperso+(taille)-Pcamera);
}
}
if(Temps==0){
if(Taille=="3*3"){
image(Icon,xperso,yperso-Pcamera,taille*2,taille*2);
}
if(Taille=="2*1"){
image(Icon,xperso,yperso-Pcamera,taille*2,taille);
}
if(Taille=="3*1"){
image(Icon,xperso,yperso-Pcamera,taille*3,taille);
}
}
noFill();
stroke(255);
strokeWeight(1);
}
}
void Camera(){
if(keyPressed==true){
if(key=='s'){
Pcamera+=taille;
keyPressed=false;
keyCode=0;
if(Pcamera>taille*14){Pcamera=taille*14;}}
if(key=='z'){
Pcamera-=taille;
keyPressed=false;
keyCode=0;
if(Pcamera<0){Pcamera=0;}}
}
}
int Limit_deck=20;
int Limit_ChoixDeck=0;
int Limit_Main=5;
int NmbGloss=58;
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;
int J;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[570];class Case{
int xposition;
int yposition;
String Presence="Vide";
int NmbPresenceUnite;
int Tas_d_os;
int CaseNumero;
Boolean TextureAct=false;
PImage Texture;
int NOr;Case(int Nxposition, int Nyposition, int NCaseNumero){
xposition=Nxposition;
yposition=Nyposition;
CaseNumero=NCaseNumero;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Presence(){
////////////////////Presence/////////////////////////////////////////////////////
if(Presence!="Mur" && Presence!="Or") {
Presence="Vide";
for(int U=0; U<Tunite_Total.length; U++){
if(TuniteVivant_Total[U]==true){
if(xposition==Tunite_Total[U].xperso && yposition-Pcamera==Tunite_Total[U].yperso-Pcamera){
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-Pcamera==Base[B].yperso+Y-Pcamera){
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){
if(Batiment_JI[B].Taille=="3*3"){
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-Pcamera==Batiment_JI[B].yperso+Y-Pcamera){
Presence="Batiment 1";
Batiment_JI[B].NumCase=CaseNumero;
}
}
}
}
if(Batiment_JI[B].Taille=="2*1"){
for(int X=0; X<taille*2; X+=taille){
if(xposition==Batiment_JI[B].xperso+X && yposition-Pcamera==Batiment_JI[B].yperso-Pcamera){
Presence="Batiment 1";
Batiment_JI[B].NumCase=CaseNumero;
}
}
}
if(Batiment_JI[B].Taille=="3*1"){
for(int X=0; X<taille*3; X+=taille){
if(xposition==Batiment_JI[B].xperso+X && yposition-Pcamera==Batiment_JI[B].yperso-Pcamera){
Presence="Batiment 1";
Batiment_JI[B].NumCase=CaseNumero;
}
}
}
}
}
///////////////////////////////////////////////////////////////
for(int B=0; B<Batiment_JII.length; B++){
if(BatimentVivant_JII[B]==true){
if(Batiment_JII[B].Taille=="3*3"){
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-Pcamera==Batiment_JII[B].yperso+Y-Pcamera){
Presence="Batiment 2";
Batiment_JII[B].NumCase=CaseNumero;
}
}
}
}
if(Batiment_JII[B].Taille=="2*1"){
for(int X=0; X<taille*2; X+=taille){
if(xposition==Batiment_JII[B].xperso+X && yposition-Pcamera==Batiment_JII[B].yperso-Pcamera){
Presence="Batiment 2";
Batiment_JII[B].NumCase=CaseNumero;
}
}
}
if(Batiment_JII[B].Taille=="3*1"){
for(int X=0; X<taille*3; X+=taille){
if(xposition==Batiment_JII[B].xperso+X && yposition-Pcamera==Batiment_JII[B].yperso-Pcamera){
Presence="Batiment 2";
Batiment_JII[B].NumCase=CaseNumero;
}
}
}
}
}
}
///////////////Affichage//////////////////////////////////////////
if(Tas_d_os>0){
image(IconAdd[0],xposition+taille-34,yposition+taille-34-Pcamera,34,34);
}
if(mouseX>=xposition && mouseX<=xposition+taille){
if(mouseY>=yposition-Pcamera && mouseY<=yposition+taille-Pcamera){
fill(255);
textSize(20);
text("Case :",taille*20.5,taille*7);
textSize(15);
text(Presence,taille*20.75,taille*7.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*8.20);
text("Vie: "+Tunite_Total[i].Vie,taille*20.75,taille*8.55);
text("Vitesse: "+Tunite_Total[i].vit,taille*20.75,taille*8.90);
text("Attaque: "+int(Tunite_Total[i].att),taille*20.75,taille*9.25);
text("Defense: "+int(Tunite_Total[i].def),taille*20.75,taille*9.65);
text("Portéé: "+Tunite_Total[i].portee,taille*20.75,taille*10);
}
}
}
}
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*8.20);
text("Vie: "+Batiment_JI[B].Vie,taille*20.75,taille*8.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*8.20);
text("Vie: "+Batiment_JII[B].Vie,taille*20.75,taille*8.55);
}
}
}
}
if(Presence=="Base 1"){
text("Nom: Base du Joueur 1",taille*20.75,taille*8.20);
text("Vie: "+Base[0].Vie,taille*20.75,taille*8.55);
text("Defense: 1",taille*20.75,taille*8.90);
}
if(Presence=="Base 2"){
text("Nom: Base du Joueur 2",taille*20.75,taille*8.20);
text("Vie: "+Base[1].Vie,taille*20.75,taille*8.55);
text("Defense: 1",taille*20.75,taille*8.90);
}
text("Tas d'os x"+Tas_d_os,taille*20.75,taille*7.50);
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Couleur(){
noFill();
strokeWeight(2);
if(Presence=="Joueur 1"){
stroke(200,0,0);
rect(xposition,yposition-Pcamera,taille,taille);
}
if(Presence=="Joueur 2"){
stroke(0,0,200);
rect(xposition,yposition-Pcamera,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-Pcamera,taille*3,taille*3);
if(Faction=="Mort-Vivant"){
image(IBase[0],xperso,yperso-Pcamera,taille*3,taille*3);
}
if(Faction=="Humain"){
image(IBase[1],xperso,yperso-Pcamera,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);}
action=1;
}
}
}
void Affiche_Ressource(){
textSize(20);
fill(255);
stroke(255);
if(tour>=1 && tour<2){
text("Ressource 1: "+Base[0].RessI, taille*20.25,taille*3.25);
text("Ressource 2: "+Base[0].RessII, taille*20.25,taille*3.75);
text("Faction : "+Base[0].Faction, taille*20.25,taille*4.25);
text("Joueur 1", taille*21,taille*4.75);
}
if(tour>=2 && tour<3){
text("Ressource 1: "+Base[1].RessI, taille*20.25,taille*3.25);
text("Ressource 2: "+Base[1].RessII, taille*20.25,taille*3.75);
text("Faction : "+Base[1].Faction, taille*20.25,taille*4.25);
text("Joueur 2", taille*21,taille*4.75);
}
noFill();
}
boolean ConstAct=false;
String ConstBatiment=" ";
int[] Xconst= new int[3];
int[] Yconst= new int[3];
int PhaseConst=0;
void Construc(){
for(int C=0; C<Emplacement.length; C++){
if(ConstBatiment=="Ferme Charnier" || ConstBatiment=="Ferme H"){
if(C+1<570 && C+19<570 && C+20<570){
if(Emplacement[C].Presence=="Vide" && Emplacement[C+1].Presence=="Vide" && Emplacement[C+19].Presence=="Vide" && Emplacement[C+20].Presence=="Vide"){
if(mouseX>=Emplacement[C].xposition && mouseX<=Emplacement[C].xposition+taille && mouseY>=Emplacement[C].yposition-Pcamera && mouseY<=Emplacement[C].yposition+taille-Pcamera){
fill(150,150,0,63);
strokeWeight(4);
stroke(150,150,0);
rect(Emplacement[C].xposition,Emplacement[C].yposition-Pcamera,taille*2,taille*2);
if(mousePressed==true){
if(tour>=1 && tour<2){
if(ConstBatiment=="Ferme Charnier"){
Batiment_JI[NmbBatiment1]=new Batisse(Emplacement[C].xposition,Emplacement[C].yposition, 10, 1, IBatiment[1], "Ferme à Charnier", 1, 2);}
if(ConstBatiment=="Ferme H"){
Batiment_JI[NmbBatiment1]=new Batisse(Emplacement[C].xposition,Emplacement[C].yposition, 10, 1, IBatiment[2], "Ferme Humaine", 1, 2);}
BatimentVivant_JI[NmbBatiment1]=true;
NmbBatiment1++;
}
if(tour>=2 && tour<3){
if(ConstBatiment=="Ferme Charnier"){
Batiment_JII[NmbBatiment2]=new Batisse(Emplacement[C].xposition,Emplacement[C].yposition, 10, 1, IBatiment[1], "Ferme à Charnier", 2, 2);}
if(ConstBatiment=="Ferme H"){
Batiment_JII[NmbBatiment2]=new Batisse(Emplacement[C].xposition,Emplacement[C].yposition, 10, 1, IBatiment[2], "Ferme Humaine", 2, 2);}
BatimentVivant_JII[NmbBatiment2]=true;
NmbBatiment2++;
}
Emplacement[C].Tas_d_os=0;
ConstAct=false;
action=0;
}
}
} }
}
if(ConstBatiment=="Mine"){
if(Emplacement[C].Presence=="Or"){
strokeWeight(4);
stroke(150,150,0);
rect(Emplacement[C].xposition,Emplacement[C].yposition-Pcamera,taille,taille);
if(mouseX>=Emplacement[C].xposition && mouseX<=Emplacement[C].xposition+taille && mouseY>=Emplacement[C].yposition-Pcamera && mouseY<=Emplacement[C].yposition+taille-Pcamera){
if(Emplacement[C].NOr==1){
image(minerai,taille*0-10,taille*0-Pcamera-10,taille*2+20,taille*2+20);
if(mousePressed==true){
if(tour>=1 && tour<2){
Batiment_JI[NmbBatiment1]=new Batisse(taille*0,taille*0, 10, 1, IBatiment[3], "Mine", 1, 2);
BatimentVivant_JI[NmbBatiment1]=true;
NmbBatiment1++;}
if(tour>=2 && tour<3){
Batiment_JII[NmbBatiment2]=new Batisse(taille*0,taille*0, 10, 1, IBatiment[3], "Mine", 2, 2);
BatimentVivant_JII[NmbBatiment2]=true;
NmbBatiment2++;}
Emplacement[0].Tas_d_os=0;
Emplacement[1].Tas_d_os=0;
Emplacement[19].Tas_d_os=0;
Emplacement[20].Tas_d_os=0;
ConstAct=false;
action=0;
}
}
if(Emplacement[C].NOr==2){
image(minerai,taille*17-10,taille*0-Pcamera-10,taille*2+20,taille*2+20);
if(mousePressed==true){
if(tour>=1 && tour<2){
Batiment_JI[NmbBatiment1]=new Batisse(taille*17,taille*0, 10, 1, IBatiment[3], "Mine", 1, 2);
BatimentVivant_JI[NmbBatiment1]=true;
NmbBatiment1++;}
if(tour>=2 && tour<3){
Batiment_JII[NmbBatiment2]=new Batisse(taille*17,taille*0, 10, 1, IBatiment[3], "Mine", 2, 2);
BatimentVivant_JII[NmbBatiment2]=true;
NmbBatiment2++;}
Emplacement[17].Tas_d_os=0;
Emplacement[18].Tas_d_os=0;
Emplacement[17+19].Tas_d_os=0;
Emplacement[18+19].Tas_d_os=0;
ConstAct=false;
action=0;
}
}
if(Emplacement[C].NOr==3){
image(minerai,taille*0-10,taille*28-Pcamera-10,taille*2+20,taille*2+20);
if(mousePressed==true){
if(tour>=1 && tour<2){
Batiment_JI[NmbBatiment1]=new Batisse(taille*0,taille*28, 10, 1, IBatiment[3], "Mine", 1, 2);
BatimentVivant_JI[NmbBatiment1]=true;
NmbBatiment1++;}
if(tour>=2 && tour<3){
Batiment_JII[NmbBatiment2]=new Batisse(taille*0,taille*28, 10, 1, IBatiment[3], "Mine", 2, 2);
BatimentVivant_JII[NmbBatiment2]=true;
NmbBatiment2++;}
Emplacement[19*28].Tas_d_os=0;
Emplacement[1].Tas_d_os=0;
Emplacement[19].Tas_d_os=0;
Emplacement[20].Tas_d_os=0;
ConstAct=false;
action=0;
}
}
if(Emplacement[C].NOr==4){
image(minerai,taille*17-10,taille*28-Pcamera-10,taille*2+20,taille*2+20);
if(mousePressed==true){
if(tour>=1 && tour<2){
Batiment_JI[NmbBatiment1]=new Batisse(taille*17,taille*28, 10, 1, IBatiment[3], "Mine", 1, 2);
BatimentVivant_JI[NmbBatiment1]=true;
NmbBatiment1++;}
if(tour>=2 && tour<3){
Batiment_JII[NmbBatiment2]=new Batisse(taille*17,taille*28, 10, 1, IBatiment[3], "Mine", 2, 2);
BatimentVivant_JII[NmbBatiment2]=true;
NmbBatiment2++;}
Emplacement[0].Tas_d_os=0;
Emplacement[1].Tas_d_os=0;
Emplacement[19].Tas_d_os=0;
Emplacement[20].Tas_d_os=0;
ConstAct=false;
action=0;
}
}
}
}
}
if(ConstBatiment=="Mur"){
if(Emplacement[C].Presence=="Vide" && Emplacement[C-1].Presence=="Vide"){
strokeWeight(4);
stroke(250,250,0);
fill(150,150,0,64);
if(mouseX>=Emplacement[C].xposition && mouseX<=Emplacement[C].xposition+taille && mouseY>=Emplacement[C].yposition-Pcamera && mouseY<=Emplacement[C].yposition+taille-Pcamera){
if(PhaseConst==0){
rect(Emplacement[C].xposition,Emplacement[C].yposition-Pcamera,taille,taille);
if(mousePressed==true && mouseButton==LEFT){
Xconst[0]=Emplacement[C].xposition;
Yconst[0]=Emplacement[C].yposition;
PhaseConst=1;
}
}
}
if(Emplacement[C].xposition==Xconst[0] && Emplacement[C].yposition==Yconst[0]){
if(PhaseConst==1){
rect(Emplacement[C].xposition,Emplacement[C].yposition-Pcamera,taille,taille);
rect(Emplacement[C-1].xposition,Emplacement[C].yposition-Pcamera,taille,taille);
if(Emplacement[C-2].Presence=="Vide"){ rect(Emplacement[C-2].xposition,Emplacement[C].yposition-Pcamera,taille,taille); }
if(mousePressed==true){
if(tour>=1 && tour<2){
if(mouseX>=Emplacement[C-1].xposition && mouseX<=Emplacement[C-1].xposition+taille && mouseY>=Emplacement[C-1].yposition-Pcamera && mouseY<=Emplacement[C-1].yposition+taille-Pcamera){
Batiment_JI[NmbBatiment1]=new Batisse(Emplacement[C-1].xposition,Emplacement[C-1].yposition, 8, 1, IBatiment[4], "Mur", 1, 2);
Batiment_JI[NmbBatiment1].Taille="2*1";
BatimentVivant_JI[NmbBatiment1]=true;
NmbBatiment1++;
ConstAct=false;
action=0;
Emplacement[C].Tas_d_os=0;
Emplacement[C-1].Tas_d_os=0;
}
if(Emplacement[C-2].Presence=="Vide"){
if(mouseX>=Emplacement[C-2].xposition && mouseX<=Emplacement[C-2].xposition+taille && mouseY>=Emplacement[C-2].yposition-Pcamera && mouseY<=Emplacement[C-2].yposition+taille-Pcamera){
Batiment_JI[NmbBatiment1]=new Batisse(Emplacement[C-2].xposition,Emplacement[C-2].yposition, 8, 1, IBatiment[4], "Mur", 1, 2);
Batiment_JI[NmbBatiment1].Taille="3*1";
BatimentVivant_JI[NmbBatiment1]=true;
NmbBatiment1++;
ConstAct=false;
action=0;
Emplacement[C].Tas_d_os=0;
Emplacement[C-1].Tas_d_os=0;
Emplacement[C-2].Tas_d_os=0;
}
}
}
//////////////////////J2///////////////////////////////////////////
if(tour>=2 && tour<3){
if(mouseX>=Emplacement[C-1].xposition && mouseX<=Emplacement[C-1].xposition+taille && mouseY>=Emplacement[C-1].yposition-Pcamera && mouseY<=Emplacement[C-1].yposition+taille-Pcamera){
Batiment_JII[NmbBatiment2]=new Batisse(Emplacement[C-1].xposition,Emplacement[C-1].yposition, 8, 1, IBatiment[4], "Mur", 1, 2);
Batiment_JII[NmbBatiment2].Taille="2*1";
BatimentVivant_JII[NmbBatiment2]=true;
NmbBatiment2++;
ConstAct=false;
action=0;
Emplacement[C].Tas_d_os=0;
Emplacement[C-1].Tas_d_os=0;
}
if(Emplacement[C-2].Presence=="Vide"){
if(mouseX>=Emplacement[C-2].xposition && mouseX<=Emplacement[C-2].xposition+taille && mouseY>=Emplacement[C-2].yposition-Pcamera && mouseY<=Emplacement[C-2].yposition+taille-Pcamera){
Batiment_JII[NmbBatiment2]=new Batisse(Emplacement[C-2].xposition,Emplacement[C-2].yposition, 8, 1, IBatiment[4], "Mur", 1, 2);
Batiment_JII[NmbBatiment2].Taille="3*1";
BatimentVivant_JII[NmbBatiment2]=true;
NmbBatiment2++;
ConstAct=false;
action=0;
Emplacement[C].Tas_d_os=0;
Emplacement[C-1].Tas_d_os=0;
Emplacement[C-2].Tas_d_os=0;
}
}
}
}
}
}
}
if(mousePressed==true && mouseButton==RIGHT){
Xconst[0]=-1;
Yconst[0]=-1;
PhaseConst=0;
}
}
}
}
int Faction_Deck;
String ChFaction;
int Ress1;
int Ress2;
int Pcamera;
int CarteRestante=Limit_deck;void Presentation(){
textSize(18);
//Choix de deck
if(Faction_Deck==0){
image(Boutton[4],taille*3,taille*3,taille*2,taille*2);
image(Boutton[4],taille*6,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("Faction Mort-Vivant",taille*2.25,taille*6.5);
if(mousePressed==true){Faction_Deck=1;}}
if(mouseX>=taille*6 && mouseX<=taille*8 && mouseY>=taille*3 && mouseY<=taille*5){
image(Boutton[4],taille*5.5,taille*2.5,taille*3,taille*3);
text("Faction Humain",taille*5.60,taille*6.5);
if(mousePressed==true){Faction_Deck=2;}}
mousePressed=false;
}textSize(30);//Mort Vivant/////////////////////////////////////////////////////////////////////////////////////////
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=10;
textSize(30);
for(int C=0; C<17; 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;
}
}
}
}
//Humain////////////////////////////////////////////////////////////////////////////////////////////////
if(Faction_Deck==2){
textSize(25);
text("Carte restante: "+CarteRestante,50,centrey*2-60);
CarteRestante=Limit_deck-Limit_ChoixDeck;
ChFaction="Humain";
Ress1=25;
Ress2=25;
textSize(30);
for(int C=0; C<15; C++){
image(Glossaire[C+41].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+41],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+41]--;
Limit_ChoixDeck--;
if(NmbCarte_DebutDeck[C+41]<0){
NmbCarte_DebutDeck[C+41]=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+41]++;
Limit_ChoixDeck++;
if(Limit_ChoixDeck>Limit_deck){
NmbCarte_DebutDeck[C+41]=NmbCarte_DebutDeck[C+41]-1;
Limit_ChoixDeck--;}
mousePressed=false;
}
}
}
}
//Changement de Joueur et lancement de partie
if(keyPressed==true){
if(key==ENTER){
if(CarteRestante==0){
Pcamera=0;
Position=0;
///Joueur 2///////////////////////////////////////////////////////////////////////////////////////////////
if(tour==2){
Base[1]= new Commandant(taille*8,taille*0, 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;
Deck_JII[Actuel_Carte].J=2;
}
for(int D=0; D<Limit_Main; D++){
tour=2;
Deck();
}
Histoire=2;
tour=1.2;
Pcamera=taille*14;
}
if(tour==0){
///Joueur 1///////////////////////////////////////////////////////////////////////////////////////////////
Base[0]= new Commandant(taille*8,taille*27, 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;
Deck_JI[Actuel_Carte].J=1;
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, 1,0, 2,4, 2,0,"2", TICarte[2], "Mort-Vivant", "Unite", "Archer Squelette",IconUnite[1]);
Glossaire[2]= new Carte(0,0, taille,taille, 5,5, 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,3, 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,1, 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,4, 0,3, 0,0," ", TICarte[15], "Mort-Vivant", "Amélioration", "Projection Acide",IBatiment[1]);
Glossaire[15]= new Carte(0,0, taille,taille, 2,4, 0,3, 0,0," ", TICarte[16], "Mort-Vivant", "Amélioration", "Durcissement des OS",IBatiment[1]);
Glossaire[16]= new Carte(0,0, taille,taille, 3,3, 0,3, 0,0," ", TICarte[17], "Mort-Vivant", "Amélioration", "Soin Nécrotique",IBatiment[1]);/////HUMAIN/////HUMAIN/////HUMAIN/////HUMAIN/////HUMAIN/////HUMAIN/////HUMAIN/////HUMAIN/////HUMAIN/////HUMAIN/////HUMAIN/////HUMAIN/////HUMAIN/////
////////UNITE////////UNITE////////UNITE////////UNITE//////
Glossaire[41]= new Carte(0,0, taille,taille, 1,0, 3,4, 2,0,"1", TICarte[41], "Humain", "Unite", "Ecuyer",IconUnite[20]);
Glossaire[42]= new Carte(0,0, taille,taille, 1,0, 2,4, 2,0,"2", TICarte[42], "Humain", "Unite", "Archer",IconUnite[21]);
Glossaire[43]= new Carte(0,0, taille,taille, 4,2, 4,6, 2,0,"1", TICarte[43], "Humain", "Unite", "Cavalier",IconUnite[22]);
Glossaire[44]= new Carte(0,0, taille,taille, 2,4, 3,4, 0,0,"1", TICarte[44], "Humain", "Unite", "Prêtre",IconUnite[23]);
Glossaire[45]= new Carte(0,0, taille,taille, 2,6, 4,5, 2,0,"1", TICarte[45], "Humain", "Unite", "Eclaireur",IconUnite[24]);
////////SORT////////SORT////////SORT////////SORT//////
Glossaire[46]= new Carte(0,0, taille,taille, 2,2, 0,0, 0,0," ", TICarte[49], "Humain", "Sort", "Déluge de flèche",IconUnite[20]);
Glossaire[47]= new Carte(0,0, taille,taille, 2,1, 0,0, 0,0," ", TICarte[47], "Humain", "Sort", "Sort de soin",IconUnite[20]);
Glossaire[48]= new Carte(0,0, taille,taille, 0,2, 0,0, 0,0," ", TICarte[48], "Humain", "Sort", "Casque",IconUnite[20]);
Glossaire[49]= new Carte(0,0, taille,taille, 0,2, 0,0, 0,0," ", TICarte[46], "Humain", "Sort", "Nouvelle Lame",IconUnite[20]);
Glossaire[50]= new Carte(0,0, taille,taille, 4,1, 0,0, 0,0," ", TICarte[50], "Humain", "Sort", "Rué vers l'or",IconUnite[20]);
////////BATIMENT////////BATIMENT////////BATIMENT////////BATIMENT//////
Glossaire[51]= new Carte(0,0, taille,taille, 4,1, 10,2, 0,1," ", TICarte[51], "Humain", "Batiment", "Ferme",IBatiment[2]);
Glossaire[52]= new Carte(0,0, taille,taille, 5,0, 10,2, 0,1," ", TICarte[52], "Humain", "Batiment", "Mine",IBatiment[3]);
Glossaire[53]= new Carte(0,0, taille,taille, 5,0, 10,2, 0,1," ", TICarte[53], "Humain", "Batiment", "Mur",IBatiment[3]);
////////Amélioration////////Amélioration////////Amélioration////////Amélioration//////
Glossaire[54]= new Carte(0,0, taille,taille, 4,2, 0,3, 0,0," ", TICarte[54], "Humain", "Amélioration", "Cristal de soin",IBatiment[1]);
Glossaire[55]= new Carte(0,0, taille,taille, 4,2, 0,3, 0,0," ", TICarte[55], "Humain", "Amélioration", "Acier de qualité supérieur",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[60];
PImage[] Boutton= new PImage[5];
PImage[] IconUnite= new PImage[30];
PImage[] IBase= new PImage[2];
PImage[] IconAdd= new PImage[1];
PImage[] CaseAtt= new PImage[2];
PImage[] Bord= new PImage[9];
PImage[] IBatiment= new PImage[5];
PImage minerai;
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////////////////////////////////////////////////////////////////
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");
//Humain//////////////////////////////////////////////////////////////////////
TICarte[41]=loadImage("CU_Ecuyer.png");
TICarte[42]=loadImage("CU_Archer.png");
TICarte[43]=loadImage("CU_Cavalier.png");
TICarte[44]=loadImage("CU_Prêtre.png");
TICarte[45]=loadImage("CU_Eclaireur.png");
TICarte[46]=loadImage("CS_Acier Trempé.png");
TICarte[47]=loadImage("CS_Bénédiction.png");
TICarte[48]=loadImage("CS_Casque.png");
TICarte[49]=loadImage("CS_Déluge de Flèche.png");
TICarte[50]=loadImage("CS_Rué vers l'or.png");
TICarte[51]=loadImage("CB_Ferme.png");
TICarte[52]=loadImage("CB_Mine d'Or.png");
TICarte[53]=loadImage("CB_Mur.png");
TICarte[54]=loadImage("CA_Cristal de soin.png");
TICarte[55]=loadImage("CA_Acier de qualité supérieur.png");//case d'attaque
CaseAtt[0]=loadImage("Case.png");
CaseAtt[1]=loadImage("Case V.png");Boutton[4]=loadImage("Paquet de carte.png");//Icone Unite
//Mort_Vivant////////////////////////////////////////////////////////////////
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");
//Humain//////////////////////////////////////////////////////////////////////
IconUnite[20]=loadImage("Ic_Ecuyer.png");
IconUnite[21]=loadImage("Ic_Arc Humain.png");
IconUnite[22]=loadImage("Ic_Cheval.png");
IconUnite[23]=loadImage("Ic_Prêtre.png");
IconUnite[24]=loadImage("Ic_Eclaireur.png");//Icone Base
IBase[0]=loadImage("IcB_Mausolé.png");
IBase[1]=loadImage("IcB_Chateau.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");
IBatiment[2]=loadImage("Ferme (1).png");
IBatiment[3]=loadImage("Mine.png");
IBatiment[4]=loadImage("Mur.png");minerai=loadImage("Roche.png");
}
int Spawnx;
int Spawny;
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*5.25*C+(taille/8)*C,taille*3,taille*5.25,taille*8);
if(mouseX>=taille*5.25*C+(taille/8)*C && mouseX<=taille*5.25*C+(taille/8)*C+taille*5.25){
if(mouseY>=taille*3 && mouseY<=taille*3+taille*8){
noFill();
stroke(150,150,0);
strokeWeight(10);
rect(taille*5.25*C+(taille/8)*C,taille*3,taille*5.25,taille*8);
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"){
if(Emplacement[9+19*26].Presence=="Vide"){ Spawnx=taille*9; Spawny=taille*26;}
else{if(Emplacement[8+19*26].Presence=="Vide"){ Spawnx=taille*8; Spawny=taille*26;}
else{if(Emplacement[10+19*26].Presence=="Vide"){ Spawnx=taille*10; Spawny=taille*26;}
else{if(Emplacement[7+19*28].Presence=="Vide"){ Spawnx=taille*7; Spawny=taille*28;}
else{if(Emplacement[11+19*28].Presence=="Vide"){ Spawnx=taille*11; Spawny=taille*28;} } } } }
Tunite_JI[NmbUnite1]= new Unite(/*Position*/Spawnx,Spawny,/*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;
}
if(Main_JI[C].Nom=="Déluge de flèche"){
DelugeAct=true;
action=1;
}
if(Main_JI[C].Nom=="Sort de soin"){
S_Soin=true;
action=1;
}
if(Main_JI[C].Nom=="Nouvelle Lame"){
LameAct=true;
action=1;
}
if(Main_JI[C].Nom=="Casque"){
CasqueAct=true;
action=1;
}
if(Main_JI[C].Nom=="Rué vers l'or"){
Rue=true;
action=1;
}
}
/////Batiment//////////////////////////////////////////////////////////////////////
if(Main_JI[C].Type=="Batiment"){
ConstAct=true;
action=1;
Xconst[0]=-1;
Yconst[0]=-1;
PhaseConst=0;
if(Main_JI[C].Nom=="Ferme à Charnier"){
ConstBatiment="Ferme Charnier";
}
if(Main_JI[C].Nom=="Mine"){
ConstBatiment="Mine";
}
if(Main_JI[C].Nom=="Ferme"){
ConstBatiment="Ferme H";
}
if(Main_JI[C].Nom=="Mur"){
ConstBatiment="Mur";
}
}
/////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;
}
if(Main_JI[C].Nom=="Cristal de Soin"){
CristalAct1=true;
Cristal1=3;
}
if(Main_JI[C].Nom=="Acier de qualité supérieur"){
AcierAct1=true;
Acier1=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*5.25*C+(taille/8)*C,taille*3,taille*5.25,taille*8);
if(mouseX>=taille*5.25*C+(taille/8)*C && mouseX<=taille*5.25*C+(taille/4)*C+taille*5.25){
if(mouseY>=taille*3 && mouseY<=taille*3+taille*8){
noFill();
stroke(150,150,0);
strokeWeight(10);
rect(taille*5.25*C+(taille/8)*C,taille*3,taille*5.25,taille*8);
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"){
if(Emplacement[9+19*3].Presence=="Vide"){ Spawnx=taille*9; Spawny=taille*3;}
else{if(Emplacement[8+19*3].Presence=="Vide"){ Spawnx=taille*8; Spawny=taille*3;}
else{if(Emplacement[10+19*3].Presence=="Vide"){ Spawnx=taille*10; Spawny=taille*3;}
else{if(Emplacement[7+19*1].Presence=="Vide"){ Spawnx=taille*7; Spawny=taille*1;}
else{if(Emplacement[11+19*1].Presence=="Vide"){ Spawnx=taille*11; Spawny=taille*1;} } } } }
Tunite_JII[NmbUnite2]= new Unite(/*Position*/Spawnx,Spawny,/*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;
}
if(Main_JII[C].Nom=="Déluge de flèche"){
DelugeAct=true;
action=1;
}
if(Main_JII[C].Nom=="Sort de soin"){
S_Soin=true;
action=1;
}
if(Main_JII[C].Nom=="Nouvelle Lame"){
LameAct=true;
action=1;
}
if(Main_JII[C].Nom=="Casque"){
CasqueAct=true;
action=1;
}
if(Main_JII[C].Nom=="Rué vers l'or"){
Rue=true;
action=1;
}
}
/////Batiment///////////////////////////////////////////////////////////////////////////////
if(Main_JII[C].Type=="Batiment"){
ConstAct=true;
action=1;
Xconst[0]=-1;
Yconst[0]=-1;
PhaseConst=0;
if(Main_JII[C].Nom=="Ferme à Charnier"){
ConstBatiment="Ferme Charnier";
}
if(Main_JII[C].Nom=="Mine"){
ConstBatiment="Mine";
}
if(Main_JII[C].Nom=="Ferme"){
ConstBatiment="Ferme H";
}
if(Main_JII[C].Nom=="Mur"){
ConstBatiment="Mur";
}
}
/////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;
}
if(Main_JII[C].Nom=="Cristal de Soin"){
CristalAct2=true;
Cristal2=3;
}
if(Main_JII[C].Nom=="Acier de qualité supérieur"){
AcierAct2=true;
Acier2=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<casey; ycolonne++){
for (int xligne=0; xligne<casex; 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<casey; ycolonne++){
for (int xligne=0; xligne<casex; xligne++){
rect(xligne*taille,ycolonne*taille-Pcamera,taille,taille);
}
}
AffMinerai();
}
void Mapping(){
//Sup Coin H/G
image(Bord[0],taille*3,taille*6-Pcamera,taille,taille);
Emplacement[3+19*6].Presence="Mur";
//Sup Coin B/G
image(Bord[2],taille*3,taille*23-Pcamera,taille,taille);
Emplacement[3+19*23].Presence="Mur";
//Sup Coin H/D
image(Bord[1],taille*7,taille*6-Pcamera,taille,taille);
Emplacement[7+19*6].Presence="Mur";
//Sup Coin B/D
image(Bord[3],taille*7,taille*23-Pcamera,taille,taille);
Emplacement[7+19*23].Presence="Mur";
//Sup Long G
for(int i=1; i<17; i++){
image(Bord[5],taille*3,taille*(i+6)-Pcamera,taille,taille);
Emplacement[3+19*(i+6)].Presence="Mur";
}
//Sup Long D
for(int i=1; i<17; i++){
image(Bord[4],taille*7,taille*(i+6)-Pcamera,taille,taille);
Emplacement[7+19*(i+6)].Presence="Mur";
}
//Sup Lond H
for(int i=1; i<4; i++){
image(Bord[7],taille*(3+i),taille*6-Pcamera,taille,taille);
Emplacement[(3+i)+19*6].Presence="Mur";
}
//Sup Lond B
for(int i=1; i<4; i++){
image(Bord[6],taille*(3+i),taille*23-Pcamera,taille,taille);
Emplacement[(3+i)+19*23].Presence="Mur";
}
//Sup Plein
for(int y=1; y<17; y++){
for(int x=1; x<4; x++){
image(Bord[8],taille*(x+3),taille*(y+6)-Pcamera,taille,taille);
Emplacement[(3+x)+19*(y+6)].Presence="Mur";}
}//Sup Coin H/G
image(Bord[0],taille*11,taille*6-Pcamera,taille,taille);
Emplacement[11+19*6].Presence="Mur";
//Sup Coin B/G
image(Bord[2],taille*11,taille*23-Pcamera,taille,taille);
Emplacement[11+19*23].Presence="Mur";
//Sup Coin H/D
image(Bord[1],taille*15,taille*6-Pcamera,taille,taille);
Emplacement[15+19*6].Presence="Mur";
//Sup Coin B/D
image(Bord[3],taille*15,taille*23-Pcamera,taille,taille);
Emplacement[15+19*23].Presence="Mur";//Sup Long G
for(int i=1; i<17; i++){
image(Bord[5],taille*11,taille*(i+6)-Pcamera,taille,taille);
Emplacement[11+19*(i+6)].Presence="Mur";
}
//Sup Long D
for(int i=1; i<17; i++){
image(Bord[4],taille*15,taille*(i+6)-Pcamera,taille,taille);
Emplacement[15+19*(i+6)].Presence="Mur";
}
//Sup Lond H
for(int i=1; i<4; i++){
image(Bord[7],taille*(11+i),taille*6-Pcamera,taille,taille);
Emplacement[(11+i)+19*6].Presence="Mur";
}
//Sup Lond B
for(int i=1; i<4; i++){
image(Bord[6],taille*(11+i),taille*23-Pcamera,taille,taille);
Emplacement[(11+i)+19*23].Presence="Mur";
}
//Sup Plein
for(int y=1; y<17; y++){
for(int x=1; x<4; x++){
image(Bord[8],taille*(x+11),taille*(y+6)-Pcamera,taille,taille);
Emplacement[(11+x)+19*(y+6)].Presence="Mur";}
}
}void AffMinerai(){
//Coin H/G
image(minerai,taille*0,taille*0-Pcamera,taille*2,taille*2);
Emplacement[0].Presence="Or";
Emplacement[0].NOr=1;
Emplacement[1].Presence="Or";
Emplacement[1].NOr=1;
Emplacement[19].Presence="Or";
Emplacement[19].NOr=1;
Emplacement[20].Presence="Or";
Emplacement[20].NOr=1;
//Coin H/D
image(minerai,taille*17,taille*0-Pcamera,taille*2,taille*2);
Emplacement[17].Presence="Or";
Emplacement[17].NOr=2;
Emplacement[18].Presence="Or";
Emplacement[18].NOr=2;
Emplacement[17+19].Presence="Or";
Emplacement[17+19].NOr=2;
Emplacement[18+19].Presence="Or";
Emplacement[18+19].NOr=2;
//Coin B/G
image(minerai,taille*0,taille*28-Pcamera,taille*2,taille*2);
Emplacement[0+19*28].Presence="Or";
Emplacement[0+19*28].NOr=3;
Emplacement[1+19*28].Presence="Or";
Emplacement[1+19*28].NOr=3;
Emplacement[19+19*28].Presence="Or";
Emplacement[19+19*28].NOr=3;
Emplacement[20+19*28].Presence="Or";
Emplacement[20+19*28].NOr=3;
//Coin B/D
image(minerai,taille*17,taille*28-Pcamera,taille*2,taille*2);
Emplacement[17+19*28].Presence="Or";
Emplacement[17+19*28].NOr=4;
Emplacement[18+19*28].Presence="Or";
Emplacement[18+19*28].NOr=4;
Emplacement[17+19+19*28].Presence="Or";
Emplacement[17+19+19*28].NOr=4;
Emplacement[18+19+19*28].Presence="Or";
Emplacement[18+19+19*28].NOr=4;
}
boolean DelugeAct=false;
boolean S_Soin=false;
boolean CasqueAct=false;
boolean LameAct=false;
boolean Rue=false;
int DelaiRue1=0;
int DelaiRue2=0;
void Deluge_Fleche(){
if(DelugeAct==true){
for(int E=0; E<Emplacement.length; E++){
if(mouseX>=Emplacement[E].xposition && mouseX<=Emplacement[E].xposition+taille && mouseY>=Emplacement[E].yposition && mouseY<=Emplacement[E].yposition+taille){
fill(250,250,0,64);
stroke(250,250,0);
strokeWeight(3);
rect(Emplacement[E].xposition,Emplacement[E].yposition,taille,taille);
if(E-1>=0 && E-1<570){rect(Emplacement[E-1].xposition,Emplacement[E-1].yposition,taille,taille); }
if(E+1>=0 && E+1<570){rect(Emplacement[E+1].xposition,Emplacement[E+1].yposition,taille,taille); }
if(E-19>=0 && E-19<570){rect(Emplacement[E-19].xposition,Emplacement[E-19].yposition,taille,taille); }
if(E+19>=0 && E+19<570){rect(Emplacement[E+19].xposition,Emplacement[E+19].yposition,taille,taille); }
if(mousePressed==true){
for(int U=0; U<Tunite_Total.length; U++){
if(TuniteVivant_Total[U]==true){
int postUnite=0;
for(int i=0; i<5 ;i++){
if(Tunite_Total[U].xperso==Emplacement[E+postUnite].xposition && Tunite_Total[U].yperso-Pcamera==Emplacement[E+postUnite].yposition){
Degat=2-Tunite_Total[U].def;
if(Degat<=0){
Degat=1;}
Tunite_Total[U].Vie-=Degat;
}
if(postUnite==-19){ if(E+19>=0 && E+19<570){ postUnite=+19;} else { postUnite=-19; } }
if(postUnite==+1){ if(E-19>=0 && E-19<570){ postUnite=-19;} else { postUnite=+19; } }
if(postUnite==-1){ if(E+1>=0 && E+1<570){ postUnite=+1;} else { postUnite=-19; } }
if(postUnite==0){ if(E-1>=0 && E-1<570){ postUnite=-1;} else{ postUnite=+1; } }
}
}
}
DelugeAct=false;
action=0;
mousePressed=false;
}
}
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Sort_Soin(){
if(S_Soin==true){
for(int E=0; E<Emplacement.length; E++){
if(mouseX>=Emplacement[E].xposition && mouseX<=Emplacement[E].xposition+taille && mouseY>=Emplacement[E].yposition && mouseY<=Emplacement[E].yposition+taille){
fill(250,250,0,64);
stroke(250,250,0);
strokeWeight(3);
rect(Emplacement[E].xposition,Emplacement[E].yposition,taille,taille);
if(mousePressed==true){
if(tour>=1 && tour<2){
for(int U=0; U<Tunite_JI.length; U++){
if(TuniteVivant_JI[U]==true){
if(Tunite_JI[U].xperso==Emplacement[E].xposition && Tunite_JI[U].yperso-Pcamera==Emplacement[E].yposition){
Degat=4;
if(Degat+Tunite_JI[U].Vie<=Tunite_JI[U].VieMax){
Tunite_JI[U].Vie+=Degat;
}
else{
Degat=-(Tunite_JI[U].Vie-Tunite_JI[U].VieMax);
Tunite_JI[U].Vie+=Degat;
}
}
}
}
}
if(tour>=2 && tour<=3){
for(int U=0; U<Tunite_JII.length; U++){
if(TuniteVivant_JII[U]==true){
if(Tunite_JII[U].xperso==Emplacement[E].xposition && Tunite_JII[U].yperso-Pcamera==Emplacement[E].yposition){
Degat=4;
if(Degat+Tunite_JII[U].Vie<=Tunite_JII[U].VieMax){
Tunite_JII[U].Vie+=Degat;
}
else{
Degat=-(Tunite_JII[U].Vie-Tunite_JII[U].VieMax);
Tunite_JII[U].Vie+=Degat;
}
}
}
}
}
S_Soin=false;
action=0;
mousePressed=false;
}
}
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Casque(){
if(CasqueAct==true){
if(tour>=1 && tour<2){
for(int U=0; U<Tunite_JI.length; U++){
if(TuniteVivant_JI[U]==true){
if(Tunite_JI[U].Nom=="Ecuyer" || Tunite_JI[U].Nom=="Archer"){
fill(250,250,0,32);
stroke(250,250,0);
strokeWeight(5);
rect(Tunite_JI[U].xperso,Tunite_JI[U].yperso-Pcamera,taille,taille);
if(mousePressed==true){
if(mouseX>=Tunite_JI[U].xperso && mouseX<=Tunite_JI[U].xperso+taille && mouseY>=Tunite_JI[U].yperso-Pcamera && mouseY<=Tunite_JI[U].yperso+taille-Pcamera){
Tunite_JI[U].def=1;
Tunite_JI[U].equipement++;
CasqueAct=false;
action=0;
mousePressed=false;
}
}
}
}
}
}
if(tour>=2 && tour<3){
for(int U=0; U<Tunite_JII.length; U++){
if(TuniteVivant_JII[U]==true){
if(Tunite_JII[U].Nom=="Ecuyer" || Tunite_JII[U].Nom=="Archer"){
fill(255,255,0,32);
stroke(255,255,0);
strokeWeight(5);
rect(Tunite_JII[U].xperso,Tunite_JII[U].yperso-Pcamera,taille,taille);
if(mousePressed==true){
if(mouseX>=Tunite_JII[U].xperso && mouseX<=Tunite_JII[U].xperso+taille && mouseY>=Tunite_JII[U].yperso-Pcamera && mouseY<=Tunite_JII[U].yperso+taille-Pcamera){
Tunite_JII[U].def=1;
Tunite_JII[U].equipement++;
CasqueAct=false;
action=0;
mousePressed=false;
}
}
}
}
}
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Lame(){
if(LameAct==true){
if(tour>=1 && tour<2){
for(int U=0; U<Tunite_JI.length; U++){
if(TuniteVivant_JI[U]==true){
if(Tunite_JI[U].Nom=="Ecuyer" || Tunite_JI[U].Nom=="Archer"){
fill(255,255,0,32);
stroke(255,255,0);
strokeWeight(5);
rect(Tunite_JI[U].xperso,Tunite_JI[U].yperso-Pcamera,taille,taille);
if(mousePressed==true){
if(mouseX>=Tunite_JI[U].xperso && mouseX<=Tunite_JI[U].xperso+taille && mouseY>=Tunite_JI[U].yperso-Pcamera && mouseY<=Tunite_JI[U].yperso+taille-Pcamera){
Tunite_JI[U].att=3;
Tunite_JI[U].equipement++;
LameAct=false;
action=0;
mousePressed=false;
}
}
}
}
}
}
if(tour>=2 && tour<3){
for(int U=0; U<Tunite_JII.length; U++){
if(TuniteVivant_JII[U]==true){
if(Tunite_JII[U].Nom=="Ecuyer" || Tunite_JII[U].Nom=="Archer"){
fill(250,250,0,64);
stroke(250,250,0);
strokeWeight(5);
rect(Tunite_JII[U].xperso,Tunite_JII[U].yperso-Pcamera,taille,taille);
if(mousePressed==true){
if(mouseX>=Tunite_JII[U].xperso && mouseX<=Tunite_JII[U].xperso+taille && mouseY>=Tunite_JII[U].yperso-Pcamera && mouseY<=Tunite_JII[U].yperso+taille-Pcamera){
Tunite_JII[U].att=3;
Tunite_JII[U].equipement++;
LameAct=false;
action=0;
mousePressed=false;
}
}
}
}
}
}
}
}
void Rue_Or(){
if(Rue==true){
if(tour>=1 && tour<2){
DelaiRue1=2;
}
if(tour>=2 && tour<3){
DelaiRue2=2;
}
Rue=false;
action=0;
mousePressed=false;
}
}
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-Pcamera && mouseY<=Emplacement[C].yposition+taille-Pcamera){
noFill();
strokeWeight(3);
stroke(150,150,0);
rect(Emplacement[C].xposition,Emplacement[C].yposition-Pcamera,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;
mousePressed=false;
}
}
}
}
}
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-Pcamera && mouseY<=Emplacement[C].yposition+taille-Pcamera){
noFill();
strokeWeight(3);
stroke(150,150,0);
rect(Emplacement[C].xposition,Emplacement[C].yposition-Pcamera,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;
mousePressed=false;
}
}
}
}
}
void Special_Os(){
for(int U=0; U<Tunite_Total.length; U++){
if(TuniteVivant_Total[U]==true){
if(Tunite_Total[U].Phase_Perso==3){
U_Att=U;
positionCase=Tunite_Total[U].NumCase;
if(Tunite_Total[U].portee=="1"){
image(CaseAtt[1],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso-taille+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso+taille+1-Pcamera,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<570){
if(Emplacement[C_Deff].Tas_d_os>0){
if(mouseX>=Emplacement[C_Deff].xposition && mouseX<=Emplacement[C_Deff].xposition+taille && mouseY>=Emplacement[C_Deff].yposition-Pcamera && mouseY<=Emplacement[C_Deff].yposition+taille-Pcamera){
if(Tunite_Total[U].Nom=="Necromancien" && Emplacement[C_Deff].Presence=="Vide"){
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-Pcamera && mouseY<=Emplacement[C_Deff].yposition+taille-Pcamera){
if(Tunite_Total[U].Nom=="Necromancien"){
if(Tunite_Total[U].Competence==2){
Soin();
}
}
if(Tunite_Total[U].Nom=="Prêtre"){
Soin();
}
}
}
}
if(C_Deff==positionCase-19){C_Deff=positionCase+19;}
if(C_Deff==positionCase-1){C_Deff=positionCase-19;}
if(C_Deff==positionCase+1){C_Deff=positionCase-1;}
}
}
}
}
if(Tunite_Total[U].portee=="1-2"){
image(CaseAtt[1],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso-taille+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso+taille+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso-taille*2+1,Tunite_Total[U].yperso+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+taille*2+1,Tunite_Total[U].yperso+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso-taille*2+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+1,Tunite_Total[U].yperso+taille*2+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso-taille+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso-taille+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso-taille+1,Tunite_Total[U].yperso+taille+1-Pcamera,Tunite_Total[U].taille-1,Tunite_Total[U].taille-1);
image(CaseAtt[1],Tunite_Total[U].xperso+taille+1,Tunite_Total[U].yperso+taille+1-Pcamera,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<570){
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-Pcamera && mouseY<=Emplacement[C_Deff].yposition+taille-Pcamera){
if(Tunite_Total[U].Nom=="Prêtre"){
Soin();
}
}
}
}
if(C_Deff==positionCase-20){C_Deff=positionCase+20;}
if(C_Deff==positionCase+18){C_Deff=positionCase-20;}
if(C_Deff==positionCase-18){C_Deff=positionCase+18;}
if(C_Deff==positionCase+38){C_Deff=positionCase-18;}
if(C_Deff==positionCase-38){C_Deff=positionCase+38;}
if(C_Deff==positionCase-2){C_Deff=positionCase-38;}
if(C_Deff==positionCase+2){C_Deff=positionCase-2;}
if(C_Deff==positionCase+19){C_Deff=positionCase+2;}
if(C_Deff==positionCase-19){C_Deff=positionCase+15;}
if(C_Deff==positionCase-1){C_Deff=positionCase-19;}
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 Soin(){
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=Tunite_JI[U_Att].soin;
if(Degat+Tunite_JI[U].Vie<=Tunite_JI[U].VieMax){
Tunite_JI[U].Vie+=Degat;
}
else{
Degat=-(Tunite_JI[U].Vie-Tunite_JI[U].VieMax);
Tunite_JI[U].Vie+=Degat;
}
action=0;
Tunite_JI[U_Att].Phase_Perso=0;
Tunite_JI[U_Att].mouvement=0;
}
}
}
}
mousePressed=false;
}
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=Tunite_JII[U_Att-limite_d_unit].soin;
if(Degat+Tunite_JII[U].Vie<=Tunite_JII[U].VieMax){
Tunite_JII[U].Vie+=Degat;
}
else{
Degat=-(Tunite_JI[U].Vie-Tunite_JI[U].VieMax);
Tunite_JII[U].Vie+=Degat;
}
action=0;
Tunite_JII[U_Att-limite_d_unit].Phase_Perso=0;
Tunite_JII[U_Att-limite_d_unit].mouvement=0;
}
}
}
}
mousePressed=false;
}
}
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];
}
}
}
}
int GainII=0;
void Tour_De_Jeu(){
if(keyPressed==true){
if(key=='p'){
action=0;
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){
Pcamera=taille*14;
Base[0].RessI++;
for(int U=0; U<Tunite_JI.length;U++){
if(TuniteVivant_JI[U]==true){
Tunite_JI[U].Tour_action=1;
}
}
GainII=0;
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" || Batiment_JI[B].Nom=="Ferme Humaine"){
Base[0].RessI++;
}
else{ if(Batiment_JI[B].Nom=="Mine"){ GainII++; } }
}
if(Batiment_JI[B].Temps>0){
Batiment_JI[B].Temps--;
}
}
}
if(DelaiRue1>0){ Base[0].RessII+=(GainII*2); }
else{ Base[0].RessII+=GainII;}
DelaiRue1--;
if(Boyau1>=0){ Boyau1--;}
if(ProjAcide1>=0){ ProjAcide1--;}
if(Os_Dur1>=0){ Os_Dur1--;}
if(Cristal1>=0){ Cristal1--;}
if(Acier1>=0){ Acier1--;}
tour=1.2;
}
//////////////Joueur 2////////////////////////
if(tour==2.1){
Pcamera=0;
Base[1].RessI++;
for(int U=0; U<Tunite_JII.length;U++){
if(TuniteVivant_JII[U]==true){
Tunite_JII[U].Tour_action=1;
}
}
GainII=0;
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" || Batiment_JI[B].Nom=="Ferme Humaine"){
Base[1].RessI++;
}
else{ if(Batiment_JII[B].Nom=="Mine"){ GainII++; } }
}
if(Batiment_JII[B].Temps>0){
Batiment_JII[B].Temps--;
}
}
}
if(DelaiRue2>0){ Base[1].RessII+=(GainII*2); }
else{ Base[1].RessII+=GainII;}
DelaiRue2--;
if(Boyau2>=0){ Boyau2--;}
if(ProjAcide2>=0){ ProjAcide2--;}
if(Os_Dur2>=0){ Os_Dur2--;}
if(Cristal2>=0){ Cristal2--;}
if(Acier2>=0){ Acier2--;}
tour=2.2;
}
keyPressed=false;
key=0;
}
}
}
///////////////////////////////////////////////////////////////////////
void Melange(){
for(int i=0; i<Elimine.length; i++){
Elimine[i]=-1;
}
//////////////Joueur 1////////////
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;
int soin=0;
int[] positionx= new int[10];
int[] positiony= new int[10];
int equipement=0;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;
if(Nom=="Prêtre"){soin=6;}
if(Nom=="Nécromancien"){soin=3;}
equipement=0;
}void affichage(){
image(icon,xperso+1,yperso+1-Pcamera,taille-1,taille-1);
if(Tour_action<=0 && Phase_Perso<=0){
fill(150,85);
strokeWeight(1);
rect(xperso,yperso-Pcamera,taille,taille);
}
if(Phase_Perso>=1){
noFill();
strokeWeight(6);
stroke(200,200,0);
rect(xperso,yperso-Pcamera,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-Pcamera && mouseY<= yperso+taille-Pcamera){
if(mousePressed==true){
mouvement=vit;
action=1;
Phase_Perso=1;
Tour_action=Tour_action-1;
for(int i=0; i<10; i++){
positionx[i]=-1;
positiony[i]=-1;
}
xOriPerso=xperso;
yOriPerso=yperso;
positionx[0]=xperso;
positiony[0]=yperso;
}
}
}
}
}
}
}void Deplacement(){
if(mouvement>0){
if(keyPressed==true){
//Haut///////////////////////////////Haut//
if(keyCode==UP){
if(Emplacement[NumCase-19].Presence=="Vide"){
yperso=yperso-taille;
mouvement=mouvement-1;
if(yperso-Pcamera<0){
yperso=0;
mouvement=mouvement+1;
}
for(int p=0; p<10; p++){
if(xperso==positionx[p] && yperso==positiony[p]){
mouvement=vit-p;
}
}
positionx[vit-mouvement]=xperso;
positiony[vit-mouvement]=yperso;
}
}
//Bas/////////////////////////////////Bas//
if(keyCode==DOWN){
if(Emplacement[NumCase+19].Presence=="Vide"){
yperso=yperso+taille;
mouvement=mouvement-1;
if(yperso>=taille*30){
yperso=taille*19;
mouvement=mouvement+1;
}
for(int p=0; p<10; p++){
if(xperso==positionx[p] && yperso==positiony[p]){
mouvement=vit-p;
}
}
positionx[vit-mouvement]=xperso;
positiony[vit-mouvement]=yperso;
}
}
//Gauche///////////////////////////Gauche//
if(keyCode==LEFT){
if(Emplacement[NumCase-1].Presence=="Vide"){
xperso=xperso-taille;
mouvement=mouvement-1;
if(xperso<0){
xperso=0;
mouvement++;
}
for(int p=0; p<10; p++){
if(xperso==positionx[p] && yperso==positiony[p]){
mouvement=vit-p;
}
}
positionx[vit-mouvement]=xperso;
positiony[vit-mouvement]=yperso;
}
}
//Droite///////////////////////////Droite//
if(keyCode==RIGHT){
if(Emplacement[NumCase+1].Presence=="Vide"){
xperso=xperso+taille;
mouvement=mouvement-1;
if(xperso>=taille*19){
xperso=taille*18;
mouvement++;
}
for(int p=0; p<10; p++){
if(xperso==positionx[p] && yperso==positiony[p]){
mouvement=vit-p;
}
}
positionx[vit-mouvement]=xperso;
positiony[vit-mouvement]=yperso;
}
}
keyCode=0;
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void FinAction(){
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" || Nom=="Fossoyeur" || Nom=="Prêtre"){
Competence=1;
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;
}
}
}
}
}