1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#include <iostream>
#include <cstdlib>
#include <ctime>
#include "DecoratorWarElement.h"
#include "DecoratorArcher.h"
#include "DecoratorColor.h"
time_t aStart, aEnd; ///@@@ time performance
using namespace std;
int main(int argc, char *argv[])
{
srand (time(NULL));
/*
BaseAliment *c=new Aliment(1.5,"Gauffre");
cout<< (*c)<<endl;
c=new DecorateurGout(*c,0.2,"Sucre");
cout<<*c<<endl;
c=new DecorateurGout(*c,0.3,"Nutella");
cout<<*c<<endl;
*/
std::cout<<"Hello World !!"<<std::endl;
DestructibleElement * aDestructibleElement1 = new DestructibleElement(100); // Points of life 100
aDestructibleElement1 = new DecoratorWarElement(*aDestructibleElement1,200, 60); //Points of life upgrade 200 / Power 60
std::cout<<"Points of life of Element1 before first attack -> " <<aDestructibleElement1->getPointsOfLife()<<std::endl;
std::cout<<"Power of Element1 before first attack -> " <<aDestructibleElement1->getPower()<<std::endl;
aDestructibleElement1 = new DecoratorColor(*aDestructibleElement1, "Pink");
// std::cout<<"Color of Element1 before first attack -> " <<aDestructibleElement1->getColor()<<std::endl;
std::cout<<"Points of life of colored Element1 before first attack -> " <<aDestructibleElement1->getPointsOfLife()<<std::endl;
/*
aDestructibleElement2 = new DecoratorArcher(*aDestructibleElement2, 200, 60); //Points of life 200 / Power 60
//Shows aDestructibleElement2 points of life
std::cout<< "Points of life of Element2 before first attack -> "<<aDestructibleElement2->getPointsOfLife()<<std::endl;
//aDestructibleElement1 attacks aDestructibleElement2
aDestructibleElement1->attack(aDestructibleElement2);
std::cout<< "Points of life of Element2 after first attack -> "<<aDestructibleElement2->getPointsOfLife()<<std::endl;
*/
//freeing the allocated memory
delete aDestructibleElement1;
// delete aDestructibleElement2;
return EXIT_SUCCESS;
} |
Partager