diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5c7247b --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,7 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0020c10 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,64 @@ +{ + "files.associations": { + "cmath": "cpp", + "stdexcept": "cpp", + "numeric": "cpp", + "iostream": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "cctype": "cpp", + "chrono": "cpp", + "clocale": "cpp", + "compare": "cpp", + "concepts": "cpp", + "condition_variable": "cpp", + "csignal": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "map": "cpp", + "set": "cpp", + "string": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "random": "cpp", + "ratio": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "numbers": "cpp", + "ostream": "cpp", + "semaphore": "cpp", + "sstream": "cpp", + "stop_token": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "typeinfo": "cpp" + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..05054c5 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: g++ build active file", + "command": "/usr/bin/g++", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/StudentTest1.cpp b/StudentTest1.cpp index 57bc33d..f41c100 100644 --- a/StudentTest1.cpp +++ b/StudentTest1.cpp @@ -100,13 +100,14 @@ TEST_SUITE("Point class tests") { } -TEST_SUITE("Classes initialization tests and Team modification( add(),stillAlive() )") { - +TEST_SUITE("Classes initialization tests and Team modification( add(),stillAlive() )") +{ TEST_CASE("Cowboy initialization") { Cowboy cowboy{"Bob", Point{2, 3}}; CHECK(cowboy.hasboolets()); CHECK_EQ(cowboy.getName(), "Bob"); CHECK_EQ(cowboy.getLocation().distance(Point{2, 3}), 0); + cout << "cowboy.getLocation():" << cowboy.getLocation().print() << endl; CHECK_NE(cowboy.getLocation().distance(Point{3, 2}), 0); CHECK(cowboy.isAlive()); @@ -141,8 +142,12 @@ TEST_SUITE("Classes initialization tests and Team modification( add(),stillAlive TEST_CASE("Team initialization") { auto cowboy = create_cowboy(2, 3); + //cout << cowboy->print() << endl; auto ninja = create_yninja(2, 3); + //cout << ninja->print() << endl; + Team team{cowboy}; + CHECK_EQ(team.stillAlive(), 1); Team2 team2{ninja}; diff --git a/sources/Character.cpp b/sources/Character.cpp new file mode 100644 index 0000000..c290595 --- /dev/null +++ b/sources/Character.cpp @@ -0,0 +1,70 @@ +#include "Character.hpp" + +using namespace std; +using namespace ariel; + +Character::Character(string name, Point location, int hitPoint) : _name(name), _location(location), _hitPoints(hitPoint), _captain(false), _teamate(false) +{ + +} + +string Character::getName() const +{ + return _name; +} + +int Character::getHitPoint() const +{ + return _hitPoints; +} + +Point Character::getLocation() const +{ + return _location; +} + +void Character::setLocation(Point& location) +{ + _location = location; + return; +} + +bool Character::isAlive() const +{ + return (_hitPoints>0 ? true : false); +} + +double Character::distance(Character *other) const +{ + if (other!=nullptr) + { + return _location.distance(other->getLocation()); + } + else + { + throw invalid_argument("null character!"); + } +} + +void Character::hit(int amount) +{ + if (amount >= 0) + { + if(_hitPoints - amount < 0) + { + _hitPoints = 0; + cout << _name << "is dead, and inactive :(" << endl; + } + else + { + _hitPoints = _hitPoints - amount; + } + + } + else + { + throw invalid_argument("Hit Points can't be negative"); + } + + cout << _hitPoints << "@@@@@@@@@@@" << endl; +} \ No newline at end of file diff --git a/sources/Character.hpp b/sources/Character.hpp new file mode 100644 index 0000000..4a2254c --- /dev/null +++ b/sources/Character.hpp @@ -0,0 +1,37 @@ +#pragma once +#include +#include +#include +using namespace std; + +#include "Point.hpp" + +using namespace ariel; +namespace ariel +{ + class Character + { + protected: + string _name; + Point _location; + int _hitPoints; + + public: + bool _captain; + bool _teamate; + //bool _active; + + Character(string name, Point location, int hitPoint); + + string getName() const; + int getHitPoint() const; + Point getLocation() const; + void setLocation(Point& location); + virtual ~Character() {} + bool isAlive() const; + double distance(Character *other) const; + void hit(int amount); + virtual string print() const = 0; + + }; +} \ No newline at end of file diff --git a/sources/Cowboy.cpp b/sources/Cowboy.cpp new file mode 100644 index 0000000..d8bc711 --- /dev/null +++ b/sources/Cowboy.cpp @@ -0,0 +1,73 @@ +#include "Cowboy.hpp" + +using namespace std; +using namespace ariel; + +Cowboy::Cowboy(string name, Point location) : Character(name, location,110), _bullets(6) +{ + +} +//## copy constructor?? + +void Cowboy::shoot(Character *other) +{ + if (other==nullptr) + { + throw invalid_argument("Null Value"); + } + + if (other==this) + { + throw runtime_error("Self-Hit is not possible"); + } + else if (isAlive() != true) + { + throw runtime_error("Charecter is dead, and inactive 3"); + } + else if (other->isAlive() != true) + { + throw runtime_error("Charecter is dead, and inactive 4"); + } + else + { + if (_bullets > 0) + { + cout << getName() << " shooting " << other->getName() << " 10 hitPoints" << endl; + _bullets -= 1; + other->hit(10); + } + else + { + cout << "no bulltes left for" << getName() << endl; + } + } +} + +bool Cowboy::hasboolets() const +{ + return (_bullets>0 ? true : false); +} + +void Cowboy::reload() +{ + if (isAlive() != true) + { + throw runtime_error("Charecter is dead, and inactive 5"); + } + else + { + cout << "reload 6 bullets to: " << getName() << endl; + _bullets = 6; + } +} + +string Cowboy::print() const +{ + if (isAlive() != true) + { + return "Name(Cowboy): "+getName()+", Location: "+getLocation().print(); + } + + + return "Name(Cowboy): "+getName()+", Location: "+getLocation().print()+", Hit Points: "+to_string(getHitPoint()); +} \ No newline at end of file diff --git a/sources/Cowboy.hpp b/sources/Cowboy.hpp new file mode 100644 index 0000000..f900a11 --- /dev/null +++ b/sources/Cowboy.hpp @@ -0,0 +1,24 @@ +#pragma once +#include +#include +#include +using namespace std; + +#include "Character.hpp" +using namespace ariel; +namespace ariel +{ + class Cowboy: public Character + { + private: + int _bullets; + + public: + Cowboy(string name, Point location); + + void shoot(Character *other); + bool hasboolets() const; + void reload(); + string print() const override; + }; +} \ No newline at end of file diff --git a/sources/Ninja.cpp b/sources/Ninja.cpp new file mode 100644 index 0000000..3adcea5 --- /dev/null +++ b/sources/Ninja.cpp @@ -0,0 +1,91 @@ +#include "Ninja.hpp" + +using namespace std; +using namespace ariel; + +Ninja::Ninja(string name, Point location, int hitPoint, int speed) : Character(name, location, hitPoint) +{ + _speed=speed; +} + +const int Ninja::getSpeed() const +{ + return _speed; +} +void Ninja::setSpeed(int speed) +{ + _speed = speed; +} + +void Ninja::move(Character *other) +{ + if (other==nullptr) + { + throw invalid_argument("Null Value"); + } + + if (other==this) + { + throw runtime_error("Self-Hit is not possible"); + } + else if (isAlive() != true) + { + throw runtime_error("Charecter is dead, and inactive 8"); + } + else if (other->isAlive() != true) + { + throw runtime_error("Charecter is dead, and inactive 9"); + } + else + { + Point newLocation = Point::moveTowards(getLocation(), other->getLocation(), _speed); + setLocation(newLocation); + + cout << getName() << " move to " << other->getName() << endl; + cout << "distance after move: " << getLocation().distance(other->getLocation()) << endl; + } +} + +void Ninja::slash(Character *other) +{ + if (other==nullptr) + { + throw invalid_argument("Null Value"); + } + + if (other==this) + { + throw runtime_error("Self-Hit is not possible"); + } + else if (isAlive() != true) + { + throw runtime_error("Charecter is dead, and inactive 6"); + } + else if (other->isAlive() != true) + { + throw runtime_error("Charecter is dead, and inactive 7"); + } + else + { + if (_location.distance(other->getLocation()) > 1) + { + cout << getName() << " distance from " << other->getName() << " is " << getLocation().distance(other->getLocation()) << ". SLASH is not possible" << endl; + } + else + { + cout << getName() << "slash seccessfuly on " << other->getName() << " with 40 hitPoints." << endl; + other->hit(40); + } + } +} + +string Ninja::print() const +{ + if (isAlive() != true) + { + return "Name(Ninja): "+getName()+", Location: "+getLocation().print(); + } + + + return "Name(Ninja): "+getName()+", Location: "+getLocation().print()+", Hit Points: "+to_string(getHitPoint()); +} diff --git a/sources/Ninja.hpp b/sources/Ninja.hpp new file mode 100644 index 0000000..fce77b5 --- /dev/null +++ b/sources/Ninja.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include +#include +#include + +using namespace std; + +#include "Character.hpp" +using namespace ariel; +namespace ariel +{ + class Ninja: public Character + { + protected: + int _speed; + + public: + Ninja(string name, Point location, int hitPoint, int speed); + + const int getSpeed() const; + void setSpeed(int speed); + + void move(Character *other); + void slash(Character *other); + string print() const override; + + }; +} \ No newline at end of file diff --git a/sources/OldNin b/sources/OldNin new file mode 100644 index 0000000..e69de29 diff --git a/sources/OldNinja.cpp b/sources/OldNinja.cpp new file mode 100644 index 0000000..f6e6e8b --- /dev/null +++ b/sources/OldNinja.cpp @@ -0,0 +1,7 @@ +#include "OldNinja.hpp" + + +OldNinja::OldNinja(string name, Point location): Ninja(name, location, 150, 8) +{ + +} \ No newline at end of file diff --git a/sources/OldNinja.hpp b/sources/OldNinja.hpp new file mode 100644 index 0000000..3c64e7d --- /dev/null +++ b/sources/OldNinja.hpp @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include + +using namespace std; + +#include "Ninja.hpp" +using namespace ariel; +namespace ariel +{ + class OldNinja: public Ninja + { + public: + OldNinja(string name, Point location); + }; +} \ No newline at end of file diff --git a/sources/Point.cpp b/sources/Point.cpp new file mode 100644 index 0000000..4becb45 --- /dev/null +++ b/sources/Point.cpp @@ -0,0 +1,68 @@ +#include "Point.hpp" + +using namespace std; +using namespace ariel; + +Point::Point() : _x(0.0), _y(0.0) +{ + +} + +Point::Point(double x, double y) : _x(x), _y(y) +{ + +} + +double Point::getX() const +{ + return _x; +} + +double Point::getY() const +{ + return _y; +} + +double Point::distance(Point other) const +{ + //implenet distance of formola of distance between 2 points + + double p = pow(_x - other.getX(), 2); + p += pow(_y - other.getY(), 2); + double res = sqrt(p); + + cout << print() << "&&" << other.print() << res << endl; + return res; +} + +string Point::print() const +{ + return "("+to_string(_x)+","+to_string(_y)+")"; +} + +const Point Point::moveTowards(const Point ¤t,const Point &other, double distance) +{ + //std::cout << current.print() << "**" << other.print() << "**" << distance << endl; + + if (distance<0) + { + throw invalid_argument("distance can't be negative"); + + } + + double dist = current.distance(other); + //std::cout << "***DIST COMP****:" << dist << "VS" << current.distance(other) << endl; + if (dist <= distance) + { + return other; + } + else + { + double ratio = distance / dist; + double newX = current._x + ratio * (other._x - current._x); + double newY = current._y + ratio * (other._y - current._y); + + //std::cout << "*******" << Point(newX, newY).print() << endl; + return Point(newX, newY); + } +} \ No newline at end of file diff --git a/sources/Point.hpp b/sources/Point.hpp new file mode 100644 index 0000000..ca3ef08 --- /dev/null +++ b/sources/Point.hpp @@ -0,0 +1,28 @@ +#pragma once +#include +#include +#include +#include + +using namespace std; + +namespace ariel +{ + class Point + { + private: + double _x; + double _y; + + public: + Point(); + Point(double x, double y); + + double getX() const; + double getY() const; + + double distance(Point other) const; + string print() const; + const static Point moveTowards(const Point ¤t, const Point &other, double distance); + }; +} \ No newline at end of file diff --git a/sources/Team.cpp b/sources/Team.cpp new file mode 100644 index 0000000..dc02102 --- /dev/null +++ b/sources/Team.cpp @@ -0,0 +1,223 @@ +#include "Team.hpp" + +using namespace std; +using namespace ariel; + +Team::Team(Character *leader) : _leader(leader) +{ + add(_leader); + if(_leader->_captain) + { + throw runtime_error("already a captain"); + } + else + { + _leader->_captain=true; + } + +} + +Team::Team(Team &&other) noexcept : _leader(other._leader), _members(move(other._members)) +{ + other._leader = nullptr; +} + + +Team::~Team() +{ + for (Character *member : _members) + { + delete member; + } + + _members.clear(); +} + +void Team::add(Character *member) +{ + if (member->_teamate) + { + throw runtime_error("already a teamate"); + } + if (member != nullptr) + { + + if (_members.size() >= 10) + { + throw runtime_error("Team is full"); + } + else + { + _members.push_back(member); + member->_teamate = true; + } + + } + else + { + throw invalid_argument("Null Value"); + } +} + +int Team::stillAlive() const +{ + int count = 0; + + for (Character *member : _members) + { + if (member->isAlive()) + { + cout << "***" << member->getHitPoint() << count << "***" << endl; + count++; + } + } + cout << "$$$$" << count << endl; + return count; +} + + +Character *Team::getVictim(Team *other) const +{ + Character *victim = nullptr; + double minDistance = 1000000000; + + for (auto member : other->_members) + { + if (member->isAlive() && _leader->distance(member) < minDistance) + { + minDistance = _leader->distance(member); + victim = member; + } + } + + cout << "Victim is " << victim->getName() << endl; + + return victim; +} + +void Team::attack(Team *other) +{ + if (other==nullptr) + { + throw invalid_argument("Null Value"); + } + + if (other==this) + { + throw runtime_error("Self-Attack is not possible"); + } + else if (stillAlive() == 0) + { + throw runtime_error("team is dead, and inactive 1"); + } + else if (other->stillAlive() == 0) + { + throw runtime_error("team is dead, and inactive 2"); + } + else + { + if (_leader->isAlive() == false) // if leader is dead, picking a new leader + { + Character *newLeader = nullptr; + double minDistance = 1000000000; + + for (auto member : _members) + { + if (member->isAlive()==true && member->distance(_leader)distance(_leader); + newLeader = member; + } + } + + cout << "Dead Leader: " << _leader->getName() << ", New Leader: " << newLeader->getName() << endl; + _leader = newLeader; + + //now we have a new , alive leader + //and a new victim + } + + //start the attack part in the code here + cout << "Attacker Team: " << _leader->getName() << ", Victim Team: " << other->_leader->getName() << endl; + + // find the victim of the attacker team + Character *victim = getVictim(other); + //int cc = 0; + //int len = 0; + int c = 0; + + while (c<2) + { + for(Character *member : _members) + { + if (!victim->isAlive()) //if the victim is dead, we pick a new one + { + if (other->stillAlive() == 0) + break; + + victim = getVictim(other); + //cc++; + } + + if(c == 0) + { + //Cowboys attacking + Cowboy *c = dynamic_cast(member); + + if (c != nullptr && c->isAlive()) // if CowBoy + { + if (c->hasboolets()) + { + c->shoot(victim); + } + else + { + c->reload(); + } + } + } + else if (c == 1) + { + //Ninja attacking + Ninja *n = dynamic_cast(member); + + if (n != nullptr && n->isAlive()) + { + if (n->getLocation().distance(victim->getLocation()) <= 1) + { + n->slash(victim); + } + else + { + n->move(victim); + } + } + } + } + c++; + } + } +} + +void Team::print() const +{ + cout << "(Team) TeamLead: " << _leader->getName() << endl; + int count = 0; + + while (count <2) + { + count++; + for (Character *member : _members) + { + if(count == 0 && dynamic_cast(member) != nullptr) + { + cout << member->print() << endl; + } + else if(count == 1 && dynamic_cast(member) != nullptr) + { + cout << member->print() << endl; + } + } + } +} + diff --git a/sources/Team.hpp b/sources/Team.hpp new file mode 100644 index 0000000..e6a19a4 --- /dev/null +++ b/sources/Team.hpp @@ -0,0 +1,37 @@ +#pragma once +#include +#include +#include +#include +using namespace std; + +#include "Character.hpp" +#include "Cowboy.hpp" +#include "Ninja.hpp" +#include "YoungNinja.hpp" +#include "TrainedNinja.hpp" +#include "OldNinja.hpp" + +using namespace ariel; +namespace ariel +{ + class Team + { + public: + Character *_leader; + vector _members; + int _size; + Team(const Team& other); + Team(Team&& other) noexcept; + Team(Character *leader); + ~Team(); + + void add(Character *member); + int stillAlive() const; + + virtual void attack(Team *other); + virtual void print() const; + virtual Character *getVictim(Team *other) const; + + }; +} \ No newline at end of file diff --git a/sources/Team2.cpp b/sources/Team2.cpp new file mode 100644 index 0000000..69a5da2 --- /dev/null +++ b/sources/Team2.cpp @@ -0,0 +1,224 @@ +#include "Team2.hpp" + +using namespace std; +using namespace ariel; + +Team2::Team2(Character *leader) : Team(leader) +{ + +} + +void Team2::attack(Team *other) + +{ + if (other==nullptr) + { + throw invalid_argument("Null Value"); + } + + if (other==this) + { + throw runtime_error("Self-Attack is not possible"); + } + else if (stillAlive() == 0) + { + throw runtime_error("Charecter is dead, and inactive 10"); + } + else if (other->stillAlive() == 0) + { + throw runtime_error("Charecter is dead, and inactive 11"); + } + else + { + if (_leader->isAlive() == false) // if leader is dead, picking a new leader + { + Character *newLeader = nullptr; + double minDistance = 1000000000; + + for (auto member : _members) + { + if (member->isAlive()==true && member->distance(_leader)distance(_leader); + newLeader = member; + } + } + + cout << "Dead Leader: " << _leader->getName() << ", New Leader: " << newLeader->getName() << endl; + _leader = newLeader; + + //now we have a new , alive leader + //and a new victim + } + + //start the attack part in the code here + cout << "Attacker Team: " << _leader->getName() << ", Victim Team: " << other->_leader->getName() << endl; + + // find the victim of the attacker team + Character *victim = getVictim(other); + + for (Character *member : _members) + { + if (!victim->isAlive()) //if the victim is dead, we pick a new one + { + if (other->stillAlive() == 0) + break; + + victim = getVictim(other); + } + //now we have new alive victim + + Cowboy* c = dynamic_cast(member); + + if (c != nullptr && c->isAlive()) + { + if (c->hasboolets()) + c->shoot(victim); + + else + c->reload(); + } + else + { + Ninja* n = dynamic_cast(member); + if (n != nullptr && n->isAlive()) + { + if (n->getLocation().distance(victim->getLocation()) <= 1) + n->slash(victim); + + else + n->move(victim); + } + } + } + } +} + + +void Team2::print() const +{ + cout << "(Team2)TeamLead: " << _leader->getName() << endl; + + for (Character *member : _members) + { + cout << member->print() << endl; + } +} + +SmartTeam::SmartTeam(Character *leader): Team(leader) +{ + +} + +Character* SmartTeam::getStrongestVictim(Team *other) const +{ + Character *strong = nullptr; + double stronngest = 0; + + for (auto member : other->_members) + { + if (member->isAlive() && _leader->getHitPoint()< member->getHitPoint()) + { + stronngest = member->getHitPoint(); + strong = member; + } + } + + cout << "Strongest is " << strong->getName() << endl; + + return strong; +} + +void SmartTeam::attack(Team *other) +{ + if (other==nullptr) + { + throw invalid_argument("Null Value"); + } + + if (other==this) + { + throw runtime_error("Self-Attack is not possible"); + } + else if (_leader->isAlive() != true) + { + throw runtime_error("Charecter is dead, and inactive"); + } + else if (other->_leader->isAlive() != true) + { + throw runtime_error("Charecter is dead, and inactive"); + } + else + { + if (_leader->isAlive() == false) // if leader is dead, picking a new leader + { + Character *newLeader = nullptr; + double minDistance = 1000000000; + + for (auto member : _members) + { + if (member->isAlive()==true && member->distance(_leader)distance(_leader); + newLeader = member; + } + } + + cout << "Dead Leader: " << _leader->getName() << ", New Leader: " << newLeader->getName() << endl; + _leader = newLeader; + + //now we have a new , alive leader + } + + //start the attack part in the code here + cout << "Attacker Team: " << _leader->getName() << ", Victim Team: " << other->_leader->getName() << endl; + + // find the victim of the attacker team + Character *victim = getStrongestVictim(other); + + for (Character *member : _members) + { + if (!victim->isAlive()) //if the victim is dead, we pick a new one + { + if (other->stillAlive() == 0) + break; + + victim = getStrongestVictim(other); + } + //now we have new alive victim + + Cowboy* c = dynamic_cast(member); + + if (c != nullptr && c->isAlive()) + { + if (c->hasboolets()) + c->shoot(victim); + + else + c->reload(); + } + else + { + Ninja* n = dynamic_cast(member); + if (n != nullptr && n->isAlive()) + { + if (n->getLocation().distance(victim->getLocation()) <= 1) + n->slash(victim); + + else + n->move(victim); + } + } + } + } +} + +void SmartTeam::print() const +{ + cout << "(SmartTeam)TeamLead: " << _leader->getName() << endl; + + for (Character *member : _members) + { + cout << member->print() << endl; + } +} \ No newline at end of file diff --git a/sources/Team2.hpp b/sources/Team2.hpp new file mode 100644 index 0000000..0fb8adf --- /dev/null +++ b/sources/Team2.hpp @@ -0,0 +1,30 @@ +#pragma once +#include +#include +#include +#include +using namespace std; + +#include "Team.hpp" +using namespace ariel; + +namespace ariel +{ + class Team2 : public Team + { + public: + Team2(Character *leader); + void attack(Team *other) override; + void print() const override; + }; + + class SmartTeam : public Team + { + public: + SmartTeam(Character *leader); + void attack(Team *other) override; + void print() const override; + Character* getStrongestVictim(Team *other) const; + + }; +} \ No newline at end of file diff --git a/sources/TrainedNinja.cpp b/sources/TrainedNinja.cpp new file mode 100644 index 0000000..d2f3248 --- /dev/null +++ b/sources/TrainedNinja.cpp @@ -0,0 +1,6 @@ +#include "TrainedNinja.hpp" + +TrainedNinja::TrainedNinja(string name, Point location): Ninja(name, location, 120, 12) +{ + +} \ No newline at end of file diff --git a/sources/TrainedNinja.hpp b/sources/TrainedNinja.hpp new file mode 100644 index 0000000..6da9c37 --- /dev/null +++ b/sources/TrainedNinja.hpp @@ -0,0 +1,17 @@ +#pragma once +#include +#include +#include + +using namespace std; + +#include "Ninja.hpp" +using namespace ariel; +namespace ariel +{ + class TrainedNinja: public Ninja + { + public: + TrainedNinja(string name, Point location); + }; +} \ No newline at end of file diff --git a/sources/YoungNinja.cpp b/sources/YoungNinja.cpp new file mode 100644 index 0000000..befc081 --- /dev/null +++ b/sources/YoungNinja.cpp @@ -0,0 +1,6 @@ +#include "YoungNinja.hpp" + +YoungNinja::YoungNinja(string name, Point location): Ninja(name, location, 100, 14) +{ + +} \ No newline at end of file diff --git a/sources/YoungNinja.hpp b/sources/YoungNinja.hpp new file mode 100644 index 0000000..f093368 --- /dev/null +++ b/sources/YoungNinja.hpp @@ -0,0 +1,17 @@ +#pragma once +#include +#include +#include + +using namespace std; + +#include "Ninja.hpp" +using namespace ariel; +namespace ariel +{ + class YoungNinja: public Ninja + { + public: + YoungNinja(string name, Point location); + }; +} \ No newline at end of file