00001
00002
00003
00004
00005
00006
00007
00008 #ifndef UNITWEAPONS_H_
00009 #define UNITWEAPONS_H_
00010
00011 #include <aspect.h>
00012 #include <enums.h>
00013
00014 #include <target.h>
00015
00016 #include <weaponMgr.h>
00017 #include <vector>
00018
00019 namespace FastEcslent {
00020
00021 class DistanceMgr;
00022 class Entity;
00023
00024 class Weapon: public UnitAspect {
00025 private:
00026 Target target;
00027
00028 std::vector<Entity*> getUnitsInRadius(Entity* ent, double radius, bool enemy);
00029 std::vector<FastEcslent::Entity*> getUnitsInRectangle(Entity* src, Entity* tgt, double length, double width, bool enemy);
00030 bool isPointInRectangle(Ogre::Vector3 sp1, Ogre::Vector3 sp2, Ogre::Vector3 sp3, Ogre::Vector3 sp4, Ogre::Vector3 point);
00031 double getAreaTriangle(Ogre::Vector3 tp1, Ogre::Vector3 tp2, Ogre::Vector3 tp3);
00032 int STANDSTILL;
00033 int BEINGATTACKED;
00034 double m_cooldown;
00035 double m_beingAttacked;
00036
00037 double m_onfire;
00038 public:
00039 const WeaponType* weaponType;
00040
00041 double damageMultiplier;
00042 double hitpoints;
00043 double armor;
00044
00045 DistanceMgr* distanceMgr;
00046 WeaponMgr* weaponMgr;
00047
00048 Weapon(Entity *ent, UnitAspectType ast, const WeaponType *wType);
00049 Weapon(Entity *ent, UnitAspectType ast);
00050 void dealDamageToTarget(Target tgt, double dt);
00051
00055 void dealEnemySplashDamageToTarget(Target tgt, double dt, double radius);
00059 void dealLineSplashDamageToTarget(Target tgt, double dt, double length, double width);
00060
00061
00062 void setTarget();
00063 Target getTarget();
00064 void takeDamage(double amt);
00065 void takeDamage(double amt, double dt);
00066 virtual void tick(double dt);
00067 virtual void init();
00068
00069 double isBeingAttacked(){return m_beingAttacked>0?true:false;};
00070 void resetBeingAttack(){m_beingAttacked = 0;};
00071
00072
00073 };
00074
00075
00076
00077 }
00078
00079
00080 #endif