#ifndef ENGINECORE_H #define ENGINECORE_H #include "util.h" #include #include #include #include #include using namespace std; //a drawable object featering an image and a position class DObject { protected: SDL_Surface* image; public: double x; double y; DObject(); DObject(string filename, double newx, double newy); DObject(SDL_Surface* newImage, double newx, double newy); DObject(const DObject &o); virtual ~DObject(); virtual void draw(SDL_Surface* screen); }; bool ooB(const DObject* o, SDL_Surface* screen); double armorF(double damage, double armor); class Levelable { protected: double exp; int level; public: double next; double lin; double quad; double cube; Levelable(); int addExp(double moreExp); int getLevel(); double getExp(); double* getExpPointer(); }; class Projectile: public DObject { public: Projectile(SDL_Surface* newimage, double newx, double newy, double newdamage, double newcollisionsize, double newxSpeed, double newySpeed); Projectile(const Projectile& P); Projectile(string filename,vector& sounds); virtual ~Projectile(){}; double damage; double armorPiercing; double collisionSize; double xSpeed; double ySpeed; void frame(double time); void rotateAccordingly(); }; class Item: public DObject { public: double cost; bool sellable; Item(const Item& item); Item(const DObject& dObject); Item(){}; SDL_Surface* getImage(); }; class Weapon: public Item { protected: vector startTimer; vector prototypes; public: bool playSound; vector > sounds; bool active; string name; double energyUsage; vector cooldown; vector currentTimer; Weapon(const Weapon& w); Weapon(string filename); ~Weapon(); vector frame(double time); void mirror(); double getDPS() const; double getDPE() const; }; class Upgradeable { protected: double value; public: string name; double cost; int level; int maxLevel; void setValue(double nvalue); double getValue() const; Upgradeable(); Upgradeable(double d); operator double() const; Upgradeable& operator=(const double& d); void upgrade(); void save(ofstream& o); void load(ifstream& i); }; ifstream& operator>>(ifstream& ins, Upgradeable& u); class Ship: public DObject { public: Ship(string filename,int x, int y); Ship(){}; Ship(const Ship& s); virtual ~Ship(); string name; double hp; Upgradeable maxhp; Upgradeable armor; Upgradeable moveSpeed; double collisionSize; vector weapons; vector > slotPositions; int hit(const Projectile& P); // void draw(SDL_Surface* screen); virtual vector frame(double time); }; class EnemyShip: public Ship { public: vector > path; double gold; double exp; double score; unsigned int current; EnemyShip(const EnemyShip& s); EnemyShip(string filename); vector frame(double time); void assignValue(); }; class UserShip: public Ship { public: SDL_Surface* getImage(); double cost; double energy; Upgradeable maxEnergy; Upgradeable energyProduction; Upgradeable handling; double xSpeed; double ySpeed; int weaponSlots; vector maxSize; int right; int down; int shooting; UserShip(string filename); void draw(SDL_Surface* screen); vector getUpgradeables(); void reset(); vector frame(double time, SDL_Surface* screen); }; double estimateValue(const Weapon& w); double estimateValue(const UserShip& s); #endif