Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
2.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. // halloween_boss_base.h
  3. // Shared code for the Halloween Bosses
  4. // Michael Booth, October 2011
  5. #ifndef HALLOWEEN_BOSS_BASE_H
  6. #define HALLOWEEN_BOSS_BASE_H
  7. #include "tf_shareddefs.h"
  8. #include "NextBot.h"
  9. #include "NextBotBehavior.h"
  10. #include "NextBotGroundLocomotion.h"
  11. #include "headless_hatman_body.h"
  12. #include "Path/NextBotPathFollow.h"
  13. class CTFPlayer;
  14. //----------------------------------------------------------------------------
  15. class CHalloweenBaseBoss : public NextBotCombatCharacter
  16. {
  17. public:
  18. DECLARE_CLASS( CHalloweenBaseBoss, NextBotCombatCharacter );
  19. CHalloweenBaseBoss();
  20. virtual ~CHalloweenBaseBoss();
  21. virtual void Spawn( void );
  22. virtual int OnTakeDamage( const CTakeDamageInfo &rawInfo ) OVERRIDE;
  23. virtual int OnTakeDamage_Alive( const CTakeDamageInfo &info );
  24. virtual void Event_Killed( const CTakeDamageInfo &info ) OVERRIDE;
  25. virtual void UpdateOnRemove();
  26. virtual void Update( void );
  27. void Break( void ); // bust into gibs
  28. struct AttackerInfo
  29. {
  30. CHandle< CTFPlayer > m_attacker;
  31. float m_timestamp;
  32. bool m_wasLastHitFromMeleeWeapon;
  33. };
  34. const CUtlVector< AttackerInfo > &GetAttackerVector( void ) const;
  35. void RememberAttacker( CTFPlayer *player, bool wasMeleeHit, float damage );
  36. bool WasSpawnedByCheats( void ) const;
  37. virtual float GetCritInjuryMultiplier( void ) const; // when we are hit by a crit, damage is mutiplied by this
  38. float GetInjuryRate( void ) const; // return average recent damage taken per second
  39. float GetMaxInjuryRate( void ) const; // return maximum damage taken per second
  40. virtual int GetLevel() const { return 0; }
  41. virtual HalloweenBossType GetBossType() const { return HALLOWEEN_BOSS_INVALID; }
  42. static CHalloweenBaseBoss* SpawnBossAtPos( HalloweenBossType bossType, const Vector& vSpawnPos, int nTeam = TF_TEAM_HALLOWEEN, CBaseEntity* pOwner = NULL );
  43. bool IsSpell() const { return GetTeamNumber() != TF_TEAM_HALLOWEEN; }
  44. enum HalloweenStatsEventType
  45. {
  46. HALLOWEEN_EVENT_BOSS_SPAWN = 0,
  47. };
  48. private:
  49. CUtlVector< AttackerInfo > m_attackerVector; // list of everyone who injured me, and when
  50. void UpdateDamagePerSecond( void );
  51. struct DamageRateInfo
  52. {
  53. float m_timestamp;
  54. float m_damage;
  55. };
  56. CUtlVector< DamageRateInfo > m_damageVector;
  57. float m_damagePerSecond;
  58. float m_maxDamagePerSecond;
  59. bool m_wasSpawnedByCheats;
  60. };
  61. inline float CHalloweenBaseBoss::GetInjuryRate( void ) const
  62. {
  63. return m_damagePerSecond;
  64. }
  65. inline float CHalloweenBaseBoss::GetMaxInjuryRate( void ) const
  66. {
  67. return m_maxDamagePerSecond;
  68. }
  69. inline float CHalloweenBaseBoss::GetCritInjuryMultiplier( void ) const
  70. {
  71. return TF_DAMAGE_CRIT_MULTIPLIER;
  72. }
  73. inline bool CHalloweenBaseBoss::WasSpawnedByCheats( void ) const
  74. {
  75. return m_wasSpawnedByCheats;
  76. }
  77. inline const CUtlVector< CHalloweenBaseBoss::AttackerInfo > &CHalloweenBaseBoss::GetAttackerVector( void ) const
  78. {
  79. return m_attackerVector;
  80. }
  81. #endif // HALLOWEEN_BOSS_BASE_H