Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /-----------------------------------------------------------------------------
- // Ability: Fire Breath
- //-----------------------------------------------------------------------------
- #ifdef CLIENT_DLL
- #define CDOTA_Ability_Creature_Fire_Breath C_DOTA_Ability_Creature_Fire_Breath
- #endif
- schema class CDOTA_Ability_Creature_Fire_Breath : public CDOTABaseAbility
- {
- DECLARE_ENTITY_CLASS( CDOTA_Ability_Creature_Fire_Breath, CDOTABaseAbility, "creature_fire_breath" );
- public:
- void OnSpellStart( void ) OVERRIDE;
- bool OnProjectileHit( EHANDLE hTarget, const Vector &vLocation ) OVERRIDE;
- #ifdef SERVER_DLL
- virtual void OnChannelThink( float flInterfClampedVal ) OVERRIDE;
- #endif
- public:
- int speed;
- int projectile_count;
- float rotation_angle;
- float damage;
- float radius;
- CountdownTimer ctTimer;
- Vector m_vecStartRot;
- Vector m_vecEndRot;
- };
- LINK_ENTITY_TO_CLASS( creature_fire_breath, CDOTA_Ability_Creature_Fire_Breath );
- //-----------------------------------------------------------------------------
- void CDOTA_Ability_Creature_Fire_Breath::OnSpellStart( void )
- {
- #ifdef SERVER_DLL
- DOTA_ABILITY_RETRIEVE_VALUE( rotation_angle );
- DOTA_ABILITY_RETRIEVE_VALUE( radius );
- DOTA_ABILITY_RETRIEVE_VALUE( speed );
- DOTA_ABILITY_RETRIEVE_VALUE( damage );
- DOTA_ABILITY_RETRIEVE_VALUE( projectile_count );
- QAngle angles = GetCaster()->GetAbsAngles();
- Vector vecFwd;
- AngleVectors( angles, &vecFwd );
- matrix3x4_t matRot;
- Vector vecRotAxis = Vector ( 0, 0, 1 );
- MatrixBuildRotationAboutAxis ( vecRotAxis, -rotation_angle/2, matRot );
- VectorRotate( vecFwd, matRot, m_vecStartRot );
- MatrixBuildRotationAboutAxis ( vecRotAxis, rotation_angle/2, matRot );
- VectorRotate( vecFwd, matRot, m_vecEndRot );
- float flTiming = GetChannelTime() / float( projectile_count );
- ctTimer.Start( flTiming );
- DOTA_EmitSound( DOTA_EMIT_SOUND_FLAGS_NEARBY | DOTA_EMIT_SOUND_FLAGS_VISIBLE, "Creature.FireBreath.Cast", GetCaster() );
- #endif
- }
- //-----------------------------------------------------------------------------
- #ifdef SERVER_DLL
- void CDOTA_Ability_Creature_Fire_Breath::OnChannelThink( float flInterfClampedVal )
- {
- BaseClass::OnChannelThink( flInterfClampedVal );
- if ( !ctTimer.IsElapsed() )
- return;
- ctTimer.Reset();
- Vector vDirection = VectorLerp( m_vecStartRot, m_vecEndRot, RemapValClamped( GetGameTime(), GetChannelStartTime(), GetChannelStartTime() + GetChannelTime(), 0.0f, 1.0f ));
- VectorNormalize( vDirection );
- sLinearProjectileCreateInfo info;
- info.pszEffectName = "particles/neutral_fx/mini_rosh_fire.vpcf";
- info.bStickyFoWReveal = true;
- info.pAbility = this;
- info.vVelocity = vDirection * speed;
- info.vSpawnOrigin = GetCaster()->GetAbsOrigin();
- info.fDistance = GetCastRange();
- info.fStartRadius = radius;
- info.fEndRadius = radius;
- info.hSource = GetCaster();
- info.iUnitTargetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY;
- info.iUnitTargetType = DOTA_UNIT_TARGET_HERO | DOTA_UNIT_TARGET_BASIC;
- info.iUnitTargetFlags = DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES;
- info.iVisionTeamNumber = GetCaster()->GetTeamNumber();
- g_DOTAProjectileManager.CreateLinearProjectile( info );
- }
- #endif
- //-----------------------------------------------------------------------------
- bool CDOTA_Ability_Creature_Fire_Breath::OnProjectileHit( EHANDLE hTarget, const Vector &vLocation )
- {
- #ifdef SERVER_DLL
- CDOTA_BaseNPC *pTarget = ToDOTABaseNPC( hTarget );
- if ( pTarget && !pTarget->IsInvulnerable() && !pTarget->IsAncient() )
- {
- ApplyDamage( GetCaster(), pTarget, this, damage, DAMAGE_TYPE_MAGICAL );
- }
- #endif
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement