예제 #1
0
Tracking::Target VisionTablesFrisbeeAimer::GetMediumRightTarget() {
	return GetTarget("medium_right");
}
예제 #2
0
 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
 {
     PreventDefaultAction();
     GetTarget()->CastSpell(GetTarget(), SPELL_PRIEST_ITEM_EFFICIENCY, true, NULL, aurEff);
 }
예제 #3
0
 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
 {
     PreventDefaultAction();
     GetTarget()->CastSpell(_procTarget, SPELL_PRIEST_MANA_LEECH_PROC, true, NULL, aurEff);
 }
예제 #4
0
 void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     Unit* target = GetTarget();
     if (!target->HasAura(DK_SPELL_BLOOD_PRESENCE))
         target->RemoveAura(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED);
 }
예제 #5
0
 void HandleDummyTick(AuraEffect const* aurEff)
 {
     GetTarget()->CastSpell((Unit*)NULL, aurEff->GetAmount(), true);
 }
 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     if (Unit* target = GetTarget())
         target->CastSpell(target, SPELL_JOKKUM_SUMMON, true);
 }
 void HandlePeriodic(AuraEffect const* /* aurEff */)
 {
     if (++_counter == 5)
         GetTarget()->CastSpell((Unit*)NULL, SPELL_DESPAWN_RIFT, true);
 }
예제 #8
0
 void OnPeriodic(AuraEffect const* /*aurEff*/)
 {
     GetTarget()->RemoveAuraFromStack(GetId());
 }
예제 #9
0
 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     GetTarget()->RemoveAura(SPELL_RAM_FATIGUE);
 }
 void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
 {
     PreventDefaultAction();
     int32 damage = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), 45));
     GetTarget()->CastCustomSpell(SPELL_MIRRORED_SOUL_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetCaster(), true);
 }
예제 #11
0
void CNPC_Hydra::RunTask( const Task_t *pTask )
{
	switch( pTask->iTask )
	{
	case TASK_HYDRA_DEPLOY:
		{
			m_flHeadGoalInfluence = 1.0;
			float dist = (EyePosition() - m_vecHeadGoal).Length();

			if (dist < m_idealSegmentLength)
			{
				TaskComplete();
			}

			AimHeadInTravelDirection( 0.2 );
		}
		break;

	case TASK_HYDRA_PREP_STAB:
		{
			int i;

			if (m_body.Count() < 2)
			{
				TaskFail( "hydra is too short to begin stab" );
				return;
			}

			CBaseEntity *pTarget = GetTarget();
			if (pTarget == NULL)
			{
				TaskFail( FAIL_NO_TARGET );
			}

			if (pTarget->IsPlayer())
			{
				m_vecTarget = pTarget->EyePosition( );
			}
			else
			{
				m_vecTarget = pTarget->BodyTarget( EyePosition( ) );
			}

			float distToTarget = (m_vecTarget - m_vecHeadGoal).Length();
			float distToBase = (m_vecHeadGoal - GetAbsOrigin()).Length();
			m_idealLength = distToTarget + distToBase * 0.5;

			if (m_idealLength > HYDRA_MAX_LENGTH)
				m_idealLength = HYDRA_MAX_LENGTH;

			if (distToTarget < 100.0)
			{
				m_vecTargetDir = (m_vecTarget - m_vecHeadGoal);
				VectorNormalize( m_vecTargetDir );
				m_vecHeadGoal = m_vecHeadGoal - m_vecTargetDir * (100 - distToTarget) * 0.5;
			}
			else if (distToTarget > 200.0)
			{
				m_vecTargetDir = (m_vecTarget - m_vecHeadGoal);
				VectorNormalize( m_vecTargetDir );
				m_vecHeadGoal = m_vecHeadGoal - m_vecTargetDir * (200.0 - distToTarget) * 0.5;
			}

			// face enemy
			m_vecTargetDir = (m_vecTarget - m_body[m_body.Count()-1].vecPos);
			VectorNormalize( m_vecTargetDir );
			m_vecHeadDir = m_vecHeadDir * 0.6 + m_vecTargetDir * 0.4;
			VectorNormalize( m_vecHeadDir.GetForModify() );

			// build tension towards strike time
			float influence = 1.0 - (m_flTaskEndTime - gpGlobals->curtime) / pTask->flTaskData;
			if (influence > 1)
				influence = 1.0;

			influence = influence * influence * influence;

			m_flHeadGoalInfluence = influence;

			// keep head segment straight
			i = m_body.Count() - 2;
			m_body[i].vecGoalPos = m_vecHeadGoal - m_vecHeadDir * m_body[i].flActualLength;
			m_body[i].flGoalInfluence = influence;

			// curve neck into spiral
			float distBackFromHead = m_body[i].flActualLength;
			Vector right, up;
			VectorVectors( m_vecHeadDir, right, up );

			for (i = i - 1; i > 1 && distBackFromHead < distToTarget; i--)
			{
				distBackFromHead += m_body[i].flActualLength;

				float r = (distBackFromHead / 200) * 3.1415 * 2;

				// spiral
				Vector p0 = m_vecHeadGoal 
							- m_vecHeadDir * distBackFromHead * 0.5 
							+ cos( r ) * m_body[i].flActualLength * right 
							+ sin( r ) * m_body[i].flActualLength * up;

				// base
				r = (distBackFromHead / m_idealLength) * 3.1415 * 0.2;
				r = sin( r );
				p0 = p0 * (1 - r) + r * GetAbsOrigin();

				m_body[i].vecGoalPos = p0;

				m_body[i].flGoalInfluence = influence * (1.0 - (distBackFromHead / distToTarget));

				/*
				if ( (pEnemy->EyePosition( ) - m_body[i].vecPos).Length() < distBackFromHead)
				{
					if ( gpGlobals->curtime - m_flLastAttackTime > 4.0)
					{
						TaskComplete();
					}
					return;
				}
				*/
			}

			// look to see if any of the goal positions are stuck
			for (i = i; i < m_body.Count() - 1; i++)
			{
				if (m_body[i].bStuck)
				{
					Vector delta = DotProduct( m_body[i].vecGoalPos - m_body[i].vecPos, m_vecHeadDir) * m_vecHeadDir;
					m_vecHeadGoal -= delta * m_body[i].flGoalInfluence;
					break;
				}
			}

			if ( gpGlobals->curtime >= m_flTaskEndTime )
			{
				if (distToTarget < 500)
				{
					TaskComplete( );
					return;
				}
				else
				{
					TaskFail( "target is too far away" );
					return;
				}
			}
		}
		return;

	case TASK_HYDRA_STAB:
		{
			int i;

			if (m_body.Count() < 2)
			{
				TaskFail( "hydra is too short to begin stab" );
				return;
			}

			if (m_flTaskEndTime <= gpGlobals->curtime)
			{
				TaskComplete( );
				return;
			}

			m_flHeadGoalInfluence = 1.0;

			// face enemy
			//m_vecHeadDir = (pEnemy->EyePosition( ) - m_body[m_body.Count()-1].vecPos);
			//VectorNormalize( m_vecHeadDir.GetForModify() );

			// keep head segment straight
			i = m_body.Count() - 2;
			m_body[i].vecGoalPos = m_vecHeadGoal + m_vecHeadDir * m_body[i].flActualLength;
			m_body[i].flGoalInfluence = 1.0;

			Vector vecToTarget = (m_vecTarget - EyePosition( ));

			// check to see if we went past target
			if (DotProduct( vecToTarget, m_vecHeadDir ) < 0.0)
			{
				TaskComplete( );
				return;
			}

			float distToTarget = vecToTarget.Length();
			float distToBase = (EyePosition( ) - GetAbsOrigin()).Length();
			m_idealLength = distToTarget + distToBase;

			/*
			if (distToTarget < 20)
			{
				m_vecHeadGoal = m_vecTarget;
				SetLastAttackTime( gpGlobals->curtime );
				TaskComplete();
				return;
			}
			else
			*/
			{
				// hit enemy
				m_vecHeadGoal = m_vecTarget + m_vecHeadDir * 300;
			}

			if (m_idealLength > HYDRA_MAX_LENGTH)
				m_idealLength = HYDRA_MAX_LENGTH;

			// curve neck into spiral
			float distBackFromHead = m_body[i].flActualLength;
			Vector right, up;
			VectorVectors( m_vecHeadDir, right, up );

#if 1
			for (i = i - 1; i > 1 && distBackFromHead < distToTarget; i--)
			{
				Vector p0 = m_vecHeadGoal - m_vecHeadDir * distBackFromHead * 1.0; 

				m_body[i].vecGoalPos = p0;

				if ((m_vecTarget - m_body[i].vecPos).Length() > distToTarget + distBackFromHead)
				{
					m_body[i].flGoalInfluence = 1.0 - (distBackFromHead / distToTarget);
				}
				else
				{
					m_body[i].vecGoalPos = EyePosition( ) - m_vecHeadDir * distBackFromHead;
					m_body[i].flGoalInfluence = 1.0 - (distBackFromHead / distToTarget);
				}

				distBackFromHead += m_body[i].flActualLength;
			}
#endif
		}
		return;

	case TASK_HYDRA_PULLBACK:
		{
			if (m_body.Count() < 2)
			{
				TaskFail( "hydra is too short to begin stab" );
				return;
			}
			CBaseEntity *pEnemy = (CBaseEntity *)UTIL_GetLocalPlayer();
			if (GetEnemy() != NULL)
			{
				pEnemy = GetEnemy();
			}

			AimHeadInTravelDirection( 0.2 );

			// float dist = (EyePosition() - m_vecHeadGoal).Length();

			if (m_flCurrentLength < m_idealLength + m_idealSegmentLength)
			{
				TaskComplete();
			}
		}
		break;

	default:
		BaseClass::RunTask( pTask );
		break;
	}

}
예제 #12
0
Tracking::Target VisionTablesFrisbeeAimer::GetClosestTargetByOffset() {
	return GetTarget("best_offset");
}
예제 #13
0
Tracking::Target VisionTablesFrisbeeAimer::GetClosestTargetByDistance() {
	return GetTarget("best_distance");
}
예제 #14
0
Tracking::Target VisionTablesFrisbeeAimer::GetLowTarget() {
	return GetTarget("low");
}
예제 #15
0
        void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & /*absorbAmount*/)
        {
            if (Unit* owner = GetUnitOwner())
            {
                if (dmgInfo.GetSpellInfo())
                {
                    if (uint32 poweringUp = sSpellMgr->GetSpellIdForDifficulty(SPELL_POWERING_UP, owner))
                    {
                        if (urand(0, 99) < 5)
                            GetTarget()->CastSpell(GetTarget(), spellId, true);

                        // Twin Vortex part
                        uint32 lightVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_LIGHT_VORTEX_DAMAGE, owner);
                        uint32 darkVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_DARK_VORTEX_DAMAGE, owner);
                        int32 stacksCount = int32(dmgInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue()) * 0.001 - 1;

                        if (lightVortex && darkVortex && stacksCount)
                        {
                            if (dmgInfo.GetSpellInfo()->Id == darkVortex || dmgInfo.GetSpellInfo()->Id == lightVortex)
                            {
                                Aura* pAura = owner->GetAura(poweringUp);
                                if (pAura)
                                {
                                    pAura->ModStackAmount(stacksCount);
                                    owner->CastSpell(owner, poweringUp, true);
                                }
                                else
                                {
                                    owner->CastSpell(owner, poweringUp, true);
                                    if (Aura* pTemp = owner->GetAura(poweringUp))
                                        pTemp->ModStackAmount(stacksCount);
                                }
                            }
                        }

                        // Picking floating balls
                        uint32 unleashedDark = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNLEASHED_DARK, owner);
                        uint32 unleashedLight = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNLEASHED_LIGHT, owner);

                        if (unleashedDark && unleashedLight)
                        {
                            if (dmgInfo.GetSpellInfo()->Id == unleashedDark || dmgInfo.GetSpellInfo()->Id == unleashedLight)
                            {
                                // need to do the things in this order, else players might have 100 charges of Powering Up without anything happening
                                Aura* pAura = owner->GetAura(poweringUp);
                                if (pAura)
                                {
                                    // 2 lines together add the correct amount of buff stacks
                                    pAura->ModStackAmount(stacksCount);
                                    owner->CastSpell(owner, poweringUp, true);
                                }
                                else
                                {
                                    owner->CastSpell(owner, poweringUp, true);
                                    if (Aura* pTemp = owner->GetAura(poweringUp))
                                        pTemp->ModStackAmount(stacksCount);
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #16
0
 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     Unit* target = GetTarget();
     target->CastSpell(target, SPELL_RAM_LEVEL_NEUTRAL, true);
 }
예제 #17
0
 void OnApply(constAuraEffectPtr /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     Unit* target = GetTarget();
     target->SetStandState(UNIT_STAND_STATE_SIT);
     target->CastSpell(target, SPELL_MEAL_PERIODIC, false);
 }
예제 #18
0
 void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
 {
     // reduces all damage taken while Stunned in Cat Form
     if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
         absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
 }
 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     if (Unit* target = GetTarget())
         target->CastSpell(target, SPELL_SUMMON_VERANUS_AND_THORIM, true);
 }
예제 #20
0
 void Absorb(AuraEffect * aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
 {
     absorbAmount = uint32(CalculatePctN(GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK), absorbPct));
     aurEff->SetAmount(0);
 }
예제 #21
0
 void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
 {
     absorbAmount = std::min(CalculatePctN(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct));
 }
예제 #22
0
 void HandleDummyTick(AuraEffect const* aurEff)
 {
     GetCaster()->CastCustomSpell(SPELL_MARK_OF_THE_FACELESS_LEECH, SPELLVALUE_BASE_POINT1, aurEff->GetAmount(), GetTarget(), true);
 }
예제 #23
0
 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     if (GetTarget()->isAlive())
         GetTarget()->CastSpell(GetTarget(), SPELL_SLAG_IMBUED, true);
 }
예제 #24
0
 void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
 {
     // reduces all damage taken while stun, fear or silence
     if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING | UNIT_FLAG_SILENCED) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
         absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
 }
예제 #25
0
void    pfGUIControlMod::UpdateBounds( hsMatrix44 *invXformMatrix, bool force )
{
    hsMatrix44  xformMatrix, projMatrix;
    hsPoint3    corners[ 8 ];
    int         i;


    if( ( !fBoundsValid || force ) && fDialog && GetTarget() )
    {
        plDrawInterface *DI = IGetTargetDrawInterface( 0 );
        if( DI == nil )
            return;

        if( HasFlag( kBetterHitTesting ) )
        {
            hsTArray<hsPoint3>  scrnPoints;

            // Create a list of points to make a 2D convex hull from
            GetObjectPoints( GetTarget(), scrnPoints );
            hsMatrix44 l2w = GetTarget()->GetLocalToWorld();
            for( i = 0; i < scrnPoints.GetCount(); i++ )
            {
                scrnPoints[ i ] = l2w * scrnPoints[ i ];
                scrnPoints[ i ] = fDialog->WorldToScreenPoint( scrnPoints[ i ] );
            }

            // Now create a convex hull from them, assuming the Zs are all the same
            int numPoints = scrnPoints.GetCount();
            if( !CreateConvexHull( scrnPoints.AcquireArray(), numPoints ) )
                return;

            // Copy & store. Also recalc our bounding box just for fun
            fBounds.MakeEmpty();
            fBoundsPoints.SetCount( numPoints );
            for( i = 0; i < numPoints; i++ )
            {
                fBoundsPoints[ i ] = scrnPoints[ i ];
                fBounds.Union( &fBoundsPoints[ i ] );
            }
        }
        else
        {
            fBounds.MakeEmpty();

            hsBounds3Ext worldBounds = DI->GetLocalBounds();
            hsMatrix44 l2w = GetTarget()->GetLocalToWorld();
            worldBounds.Transform( &l2w );

            worldBounds.GetCorners( corners );
            for( i = 0; i < 8; i++ )
            {
                hsPoint3 scrnPt = fDialog->WorldToScreenPoint( corners[ i ] );
                fBounds.Union( &scrnPt );
            }
        }

        // Calc center Z
//      if( !fCenterValid )
        {
#if 0
            corners[ 1 ] = GetTarget()->GetLocalToWorld().GetTranslate();
            float w = corners[ 1 ].fX * fXformMatrix.fMap[3][0]
                    + corners[ 1 ].fY * fXformMatrix.fMap[3][1]
                    + corners[ 1 ].fZ * fXformMatrix.fMap[3][2]
                    + 1.f * fXformMatrix.fMap[3][3];
            corners[ 1 ] = fXformMatrix * corners[ 1 ];

            corners[ 1 ].fX = ( ( corners[ 1 ].fX / corners[ 1 ].fZ ) + 1.f ) / 2.f;
            corners[ 1 ].fY = ( ( corners[ 1 ].fY / corners[ 1 ].fZ ) + 1.f ) / 2.f;
            fScreenCenter = corners[ 1 ];

//          fScreenCenter.fZ = w;


            corners[ 1 ] = GetTarget()->GetLocalToWorld().GetTranslate();
            fDialog->WorldToScreenPoint( corners[ 1 ].fX, corners[ 1 ].fY, corners[ 1 ].fZ, fScreenCenter );
            fCenterValid = true;
#else
            corners[ 1 ] = GetTarget()->GetLocalToWorld().GetTranslate();
            fScreenCenter = fDialog->WorldToScreenPoint( corners[ 1 ] );
            corners[ 1 ] = fScreenCenter;
            fCenterValid = true;
#endif
        }

        fScreenMinZ = fBounds.GetMins().fZ;

        // Manually change the bounds so we know the z ranges from at least -1 to 1, suitable for us testing against for clicks
        corners[ 0 ] = fBounds.GetCenter();
        corners[ 0 ].fZ = -1.f;
        fBounds.Union( &corners[ 0 ] );
        corners[ 0 ].fZ = 1.f;
        fBounds.Union( &corners[ 0 ] );

        fBoundsValid = true;
    }
}
예제 #26
0
 void HandleExtraEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     if (Unit* caster = GetCaster())
         if (Creature* creCaster = caster->ToCreature())
             CAST_AI(boss_ick::boss_ickAI, creCaster->AI())->_ResetThreat(GetTarget());
 }
예제 #27
0
 bool CheckProc(ProcEventInfo& /*eventInfo*/)
 {
     _procTarget = GetTarget()->GetOwner();
     return _procTarget != nullptr;
 }
예제 #28
0
 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     GetTarget()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false);
     GetTarget()->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false);
 }
 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     if (Unit* caster = GetCaster())
     {
         int32 damage;
         switch (GetStackAmount())
         {
             case 1:
                 damage = 0;
                 break;
             case 2:
                 damage = 500;
                 break;
             case 3:
                 damage = 1000;
                 break;
             case 4:
                 damage = 1500;
                 break;
             case 5:
                 damage = 4000;
                 break;
             case 6:
                 damage = 12000;
                 break;
             default:
                 damage = 20000 + 1000 * (GetStackAmount() - 7);
                 break;
         }
         if (damage)
             caster->CastCustomSpell(SPELL_MARK_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget());
     }
 }
예제 #30
0
Tracking::Target VisionTablesFrisbeeAimer::GetMediumLeftTarget() {
	return GetTarget("medium_left");
}