/* $Id: bonusshield.hpp,v 1.8 2005/10/05 14:46:44 chfreund Exp $ */ #ifndef _BONUSSHIELD_HPP_ #define _BONUSSHIELD_HPP_ /**********************************************************/ #include "bonus.hpp" #include "shieldcorona.hpp" /**********************************************************/ //! bonus, that creates a protective shield class BonusShield : public Bonus { public: BonusShield( World* wp ); ~BonusShield(); //! reimplemented from base class Object inline Sint32 getID() const { return BONUS_SHIELD; } //! reimplemented from base class Bonus inline bool isWeapon() const { return false; } inline void setProtectionTime( Sint32 protectionTime ) { m_protectionTime = protectionTime; } //! \name functions for the interaction with avatars //@{ //! shield boni can always be picked up inline bool canBePickedUpByAvatar( const Avatar* const avatar ) { return true; } //! do not generate blue glow virtual void beingPickedUp( const Avatar* const avatar ) {} //! adds two shield boni void add( const Bonus *const bonus ); //! update for the shield bonus in the avtar's bonus pack bool updateInBonusPack( Avatar *const avatar ); //! shield boni must be put into the bonus pack of the avatar inline bool mustBePutIntoPack() const { return true; } //! inline void absorbDamage( const Vector& direction ) { if( m_corona ) m_corona->absorbDamage( direction ); } //@} //! \name (de)serialization //@{ virtual Uint32 getSerializeBufferSize() const; virtual void serialize( Uint8*& bufferPointer ) const; virtual void deserialize( Uint8*& bufferPointer ); //@} protected: //! number of frames left until the shield loses its effect Sint32 m_protectionTime; //! pointer to the shieldcorona ShieldCorona *m_corona; }; /**********************************************************/ #endif // _BONUSSHIELD_HPP_