#include "Unit.h"
#include "Lancer.h"
#include "Archer.h"
#include "Infantry.h"
#include "MemoryManager/debugNew.h"

int Testmain(int argc, char** argv){
	
	Point2D p1(1,1);

	Unit * lancer = new Lancer();
	Unit * archer = new Archer();
	Unit * infantry = new Infantry();

	Mount * m1 = new Mount();
	m1->setHealthPoint(200);
	m1->setPosition(p1);

	Mount * m2 = new Mount();
	m2->setHealthPoint(200);
	m2->setPosition(p1);

	Mount * m3 = new Mount();
	m3->setHealthPoint(200);
	m3->setPosition(p1);

	lancer->setHealthPoint(500);
	lancer->setSpeed(0.5);
	lancer->setState(unitEnumeration::WAIT);
	lancer->setWeapon(new Weapon("perforing"));
	lancer->setArmorType(unitEnumeration::MEDIUM);
	lancer->setPosition(p1);

	infantry->setHealthPoint(500);
	infantry->setSpeed(0.5);
	infantry->setState(unitEnumeration::MOVE);
	infantry->setWeapon(new Weapon("slashing"));
	infantry->setArmorType(unitEnumeration::HEAVY);
	infantry->setPosition(p1);

	archer->setHealthPoint(500);
	archer->setSpeed(0.5);
	archer->setState(unitEnumeration::WAIT);
	archer->setWeapon(new Weapon("piercing"));
	archer->setArmorType(unitEnumeration::LIGHT);
	archer->setPosition(p1);

	//lancer->mountOn(m1);
	infantry->mountOn(m2);
	//archer->mountOn(m3);



	EnnemyUnit & ennemyInfantry = *( new EnnemyUnit(infantry,EnnemyUnit::VISIBLE) );
	EnnemyUnit & ennemyLancer = *( new EnnemyUnit(lancer,EnnemyUnit::VISIBLE) );
	EnnemyUnit & ennemyArcher = *( new EnnemyUnit(archer,EnnemyUnit::VISIBLE) );


	while(lancer->getHealthPoint()>0 && infantry->getHealthPoint()>0 && archer->getHealthPoint()>0 ) {
/*
		printf("\n\nattaque de lancer sur Infantry :\n");
		lancer->attack(ennemyInfantry);
		lancer->update();
		printf("\npoints de vie infantry %i\n",infantry->getHealthPoint());

		printf("\n\nattaque de infantry sur Lancer:\n");
		infantry->attack(ennemyLancer);
		infantry->update();
		printf("\npoints de vie lancer %i\n",lancer->getHealthPoint());
*/
		printf("\n\nattaque de archer sur infantry:\n");
		archer->attack(ennemyInfantry);
		archer->update();
		printf("\npoints de vie infantry %i\n",infantry->getHealthPoint());

		printf("\n\nattaque de infantry sur archer:\n");
		infantry->attack(ennemyArcher);
		infantry->update();
		printf("\npoints de vie archer %i\n",archer->getHealthPoint());
	}


	printf("\n\n");
	printf("\npoints de vie monture m1 %i",m1->getHealthPoint());
	printf("\npoints de vie monture m2 %i",m2->getHealthPoint());
	printf("\npoints de vie monture m3 %i",m3->getHealthPoint());
	printf("\n");

	return 0;

}