function Combat() 
{
var F1;
var F2;
var E1;
var E2;
var R1;
var R2;
var PV;
F1=parseFloat(window.document.nomFormulaire.Force1.value);
E1=parseFloat(window.document.nomFormulaire.Endur1.value);
F2=parseFloat(window.document.nomFormulaire.Force2.value);
E2=parseFloat(window.document.nomFormulaire.Endur2.value);
R2=false;
R1=false;
PV=0;


if (F1>=0 && F2>=0 && E1>0 && E2>0)
{

if(window.document.nomFormulaire.P1.checked==true && window.document.nomFormulaire.Cre1[0].checked==true && window.document.nomFormulaire.Cre2[0].checked==true) 
	{if(F1>E2){PV=F1-E2;}}


else if(window.document.nomFormulaire.P1.checked==true && window.document.nomFormulaire.Cre1[0].checked==true && window.document.nomFormulaire.Cre2[1].checked==true) 
	{
	if(F1>=E2){PV=F1-E2;}
	if (F2>=E1) {PV=0;}
	}


else if(window.document.nomFormulaire.P1.checked==true && window.document.nomFormulaire.Cre1[0].checked==true && window.document.nomFormulaire.Cre2[2].checked==true) 
	{
	if(F1>=E2){PV=F1*2-E2;}
	if (F2>=E1) {PV=0;}



else if(window.document.nomFormulaire.P1.checked==true && window.document.nomFormulaire.Cre1[1].checked==true && window.document.nomFormulaire.Cre2[0].checked==true) 
	{	if(F1>E2){PV=F1-E2;}	}



        }

else if(window.document.nomFormulaire.P1.checked==true && window.document.nomFormulaire.Cre1[1].checked==true && window.document.nomFormulaire.Cre2[1].checked==true) 
	{
	if(F1>=E2){PV=F1-E2;}
	}

else if(window.document.nomFormulaire.P1.checked==true && window.document.nomFormulaire.Cre1[1].checked==true && window.document.nomFormulaire.Cre2[2].checked==true) 
	{
	if(F1>=E2)
	{if (F2<=E1) {PV=F1-E2;}
	}
	}

else if(window.document.nomFormulaire.P1.checked==true && window.document.nomFormulaire.Cre1[2].checked==true && window.document.nomFormulaire.Cre2[0].checked==true) 
	{
	if(F1*2>E2){PV=2*F1-E2;}
	}

else if(window.document.nomFormulaire.P1.checked==true && window.document.nomFormulaire.Cre1[2].checked==true && window.document.nomFormulaire.Cre2[1].checked==true) 
	{
	if(F2>=E1 && F1>E2){PV=F1-E2;}
	if (F1*2>E2) {PV=F1*2-E2;}
	}

else if(window.document.nomFormulaire.P1.checked==true && window.document.nomFormulaire.Cre1[2].checked==true && window.document.nomFormulaire.Cre2[2].checked==true) 
	{
	if(F2>=E1 && F1>E2){PV=F1-E2;}
	if (F1*2>E2) {PV=F1*2-E2;}
	}








if(window.document.nomFormulaire.V1.checked==true && window.document.nomFormulaire.Cre1[2].checked==false)
		{if(window.document.nomFormulaire.V2.checked==false) {PV=F1;}}

else if(window.document.nomFormulaire.V1.checked==true && window.document.nomFormulaire.Cre1[2].checked==true)
		{if(window.document.nomFormulaire.V2.checked==false) {PV=F1*2;}}

if(window.document.nomFormulaire.V1.checked==true && window.document.nomFormulaire.V2.checked==true) 
	{
	window.document.nomFormulaire.V1.checked=false;
	window.document.nomFormulaire.V2.checked=false;
	}


if (window.document.nomFormulaire.Cre1[0].checked==true && window.document.nomFormulaire.Cre2[0].checked==true)
{
if(F1>=E2){R2=true;}
if(F2>=E1){R1=true;}
}


if (window.document.nomFormulaire.Cre1[0].checked==true && window.document.nomFormulaire.Cre2[1].checked==true)
{if(F2>=E1){R1=true;}
 else if (F1>=E2) {R2=true;}
}


if (window.document.nomFormulaire.Cre1[0].checked==true && window.document.nomFormulaire.Cre2[2].checked==true)
{if(F2>=E1){R1=true;}
 else	{E1=E1-F2;
	if(F2>=E1){R1=true;}
	if(F1>=E2){R2=true;}
	}
}


if (window.document.nomFormulaire.Cre1[1].checked==true && window.document.nomFormulaire.Cre2[0].checked==true)
{if(F1>=E2){R2=true;}
 else if (F2>=E1) {R1=true;}
}


if (window.document.nomFormulaire.Cre1[1].checked==true && window.document.nomFormulaire.Cre2[1].checked==true)
{
if(F1>=E2){R2=true;}
if(F2>=E1){R1=true;}
}


if (window.document.nomFormulaire.Cre1[1].checked==true && window.document.nomFormulaire.Cre2[2].checked==true)
{
if(F1>=E2){R2=true;}
if(F2>=E1){R1=true;}
if (R2==false && R1==false)
	{
	E1=E1-F2;
	if(F2>=E1){R1=true;}
	}
}


if (window.document.nomFormulaire.Cre1[2].checked==true && window.document.nomFormulaire.Cre2[0].checked==true)
{if(F1>=E2){R2=true;}
 else	{E2=E2-F1;
	if(F1>=E2){R2=true;}
	if(F2>=E1){R1=true;}
	}
}


if (window.document.nomFormulaire.Cre1[2].checked==true && window.document.nomFormulaire.Cre2[1].checked==true)
{
if(F1>=E2){R2=true;}
if(F2>=E1){R1=true;}
if (R2==false && R1==false)
	{
	E2=E2-F1;
	if(F1>=E2){R2=true;}
	}
}


if (window.document.nomFormulaire.Cre1[2].checked==true && window.document.nomFormulaire.Cre2[2].checked==true)
{
if(F1>=E2){R2=true;}
if(F2>=E1){R1=true;}
if (R2==false && R1==false)
	{
	E2=E2-F1;
	E1=E1-F2;
	if(F1>=E2){R2=true;}
	if(F2>=E1){R1=true;}
	}

}

if(window.document.nomFormulaire.V1.checked==true)
		{if(window.document.nomFormulaire.V2.checked==false)
		{R1=false;
		R2=false;}
		}

	if ( R1==true && R2==false)
	{alert("La créature attaquante va au cimetiere, et le joueur défenseur perd "+PV+" point(s) de vie" ); } 


	if ( R1==true && R2==true)
	{alert("Les deux créatures meurent, et le joueur défenseur perd "+PV+" point(s) de vie" );} 


	if ( R1==false && R2==false)
	{alert("Les deux créatures restent en vie, et le joueur défenseur perd "+PV+" point(s) de vie" );} 



	if ( R1==false && R2==true)
	{alert("La créature bloqueuse va au cimetiere, et le joueur défenseur perd "+PV+" point(s) de vie" );} 
}



else 
{window.alert("Veuillez remplir les champs de force/endurance");}


}
