1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */ 2 3 #ifndef PLASMAREPULSER_H 4 #define PLASMAREPULSER_H 5 6 #include "Weapon.h" 7 #include <list> 8 #include <set> 9 10 class ShieldProjectile; 11 class CRepulseGfx; 12 13 class CPlasmaRepulser: public CWeapon 14 { 15 CR_DECLARE(CPlasmaRepulser) 16 public: 17 CPlasmaRepulser(CUnit* owner, const WeaponDef* def); 18 ~CPlasmaRepulser(); 19 20 void Init(); 21 void DependentDied(CObject* o); 22 bool HaveFreeLineOfFire(const float3& pos, bool userTarget, const CUnit* unit) const; 23 24 void Update(); 25 void SlowUpdate(); 26 27 void NewProjectile(CWeaponProjectile* p); 28 float NewBeam(CWeapon* emitter, float3 start, float3 dir, float length, float3& newDir); 29 bool BeamIntercepted(CWeapon* emitter, float3 start, float damageMultiplier = 1.0f); // returns true if we are a repulsing shield 30 SetEnabled(bool b)31 void SetEnabled(bool b) { isEnabled = b; } SetCurPower(float p)32 void SetCurPower(float p) { curPower = p; } 33 IsEnabled()34 bool IsEnabled() const { return isEnabled; } GetCurPower()35 float GetCurPower() const { return curPower; } GetHitFrames()36 int GetHitFrames() const { return hitFrames; } 37 38 private: FireImpl(bool scriptCall)39 void FireImpl(bool scriptCall) {} 40 41 private: 42 // these are strictly unsynced 43 ShieldProjectile* shieldProjectile; 44 std::set<CWeaponProjectile*> repulsedProjectiles; 45 46 float curPower; 47 48 float radius; 49 float sqRadius; 50 51 int hitFrames; 52 int rechargeDelay; 53 54 bool isEnabled; 55 }; 56 57 #endif 58