summaryrefslogtreecommitdiff
path: root/game/server/tf/halloween/zombie/zombie_behavior/zombie_special_attack.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/tf/halloween/zombie/zombie_behavior/zombie_special_attack.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/server/tf/halloween/zombie/zombie_behavior/zombie_special_attack.cpp')
-rw-r--r--game/server/tf/halloween/zombie/zombie_behavior/zombie_special_attack.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/game/server/tf/halloween/zombie/zombie_behavior/zombie_special_attack.cpp b/game/server/tf/halloween/zombie/zombie_behavior/zombie_special_attack.cpp
new file mode 100644
index 0000000..ee2ca3c
--- /dev/null
+++ b/game/server/tf/halloween/zombie/zombie_behavior/zombie_special_attack.cpp
@@ -0,0 +1,68 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//
+//
+//=============================================================================
+#include "cbase.h"
+
+#include "tf_player.h"
+#include "tf_gamerules.h"
+#include "tf_fx.h"
+
+#include "../zombie.h"
+#include "zombie_special_attack.h"
+
+ActionResult< CZombie > CZombieSpecialAttack::OnStart( CZombie *me, Action< CZombie > *priorAction )
+{
+ me->GetBodyInterface()->StartActivity( ACT_SPECIAL_ATTACK1 );
+
+ m_stompTimer.Start( 1 );
+
+ return Continue();
+}
+
+
+ActionResult< CZombie > CZombieSpecialAttack::Update( CZombie *me, float interval )
+{
+ if ( m_stompTimer.HasStarted() && m_stompTimer.IsElapsed() )
+ {
+ DoSpecialAttack( me );
+ m_stompTimer.Invalidate();
+ }
+
+ if ( me->IsActivityFinished() )
+ {
+ return Done();
+ }
+
+ return Continue();
+}
+
+
+void CZombieSpecialAttack::DoSpecialAttack( CZombie *me )
+{
+ CPVSFilter filter( me->GetAbsOrigin() );
+ TE_TFParticleEffect( filter, 0.0, "bomibomicon_ring", me->GetAbsOrigin(), vec3_angle );
+
+ int nTargetTeam = TEAM_ANY;
+ if ( me->GetTeamNumber() != TF_TEAM_HALLOWEEN )
+ {
+ nTargetTeam = me->GetTeamNumber() == TF_TEAM_RED ? TF_TEAM_BLUE : TF_TEAM_RED;
+ }
+
+ CUtlVector< CTFPlayer* > pushedPlayers;
+ TFGameRules()->PushAllPlayersAway( me->GetAbsOrigin(), 200.f, 500.f, nTargetTeam, &pushedPlayers );
+
+ CBaseEntity *pAttacker = me->GetOwnerEntity() ? me->GetOwnerEntity() : me;
+ for ( int i=0; i<pushedPlayers.Count(); ++i )
+ {
+ Vector toVictim = pushedPlayers[i]->WorldSpaceCenter() - me->WorldSpaceCenter();
+ toVictim.NormalizeInPlace();
+
+ // hit!
+ CTakeDamageInfo info( pAttacker, pAttacker, me->GetAttackDamage(), DMG_SLASH );
+ info.SetDamageCustom( TF_DMG_CUSTOM_SPELL_SKELETON );
+ CalculateMeleeDamageForce( &info, toVictim, me->WorldSpaceCenter(), 5.0f );
+ pushedPlayers[i]->TakeDamage( info );
+ }
+}