Example #1
1
    void FlameWreathEffect()
    {
        std::vector<Unit*> targets;
        std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();

        if (!t_list.size())
            return;

        //store the threat list in a different container
        for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
        {
            Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
            //only on alive players
            if (target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER)
                targets.push_back(target);
        }

        //cut down to size if we have more than 3 targets
        while(targets.size() > 3)
            targets.erase(targets.begin()+rand()%targets.size());

        uint32 i = 0;
        for(std::vector<Unit*>::iterator itr = targets.begin(); itr!= targets.end(); ++itr)
        {
            if (*itr)
            {
                FlameWreathTarget[i] = (*itr)->GetGUID();
                FWTargPosX[i] = (*itr)->GetPositionX();
                FWTargPosY[i] = (*itr)->GetPositionY();
                m_creature->CastSpell((*itr), SPELL_FLAME_WREATH, true);
                i++;
            }
        }
    }
        void UpdateAI(const uint32 diff)
        {

            if (YellTimer <= diff)
            {
                if (EventStarted)
                    YellTimer = NextStep(Step++);
            } else YellTimer -= diff;

            if (Step >= 7 && Step <= 12)
            {
                Unit* arca = Unit::GetUnit((*me),ArcanagosGUID);

                if (FireArcanagosTimer <= diff)
                {
                    if (arca)
                        arca->CastSpell(me, SPELL_FIRE_BALL, false);
                    FireArcanagosTimer = 6000;
                } else FireArcanagosTimer -= diff;

                if (FireMedivhTimer <= diff)
                {
                    if (arca)
                        DoCast(arca, SPELL_FIRE_BALL);
                    FireMedivhTimer = 5000;
                } else FireMedivhTimer -= diff;
            }
        }
Example #3
1
        void NeedCheckCubeStatus()
        {
            uint32 ClickerNum = 0;
            // now checking if every clicker has debuff from manticron(it is dispelable atm rev 6110 : S)
            // if not - apply mind exhaustion and delete from clicker's list
            for (CubeMap::iterator i = Cube.begin(); i != Cube.end(); ++i)
            {
                Unit *clicker = Unit::GetUnit(*me, (*i).second);
                if (!clicker || !clicker->HasAura(SPELL_SHADOW_GRASP))
                {
                    DebuffClicker(clicker);
                    (*i).second = 0;
                }
                else
                    ++ClickerNum;
            }

            // if 5 clickers from other cubes apply shadow cage
            if (ClickerNum >= CLICKERS_COUNT && !me->HasAura(SPELL_SHADOW_CAGE))
            {
                DoScriptText(SAY_BANISH, me);
                DoCast(me, SPELL_SHADOW_CAGE, true);
            }
            else if (ClickerNum < CLICKERS_COUNT && me->HasAura(SPELL_SHADOW_CAGE))
                me->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE);

            if (!ClickerNum)
                NeedCheckCube = false;
        }
Example #4
1
    // Pure Virtual Functions
    void WaypointReached(uint32 i)
    {
        switch (i)
        {
        case 1:
            me->Say(SAY_WALK, LANG_UNIVERSAL, 0);
            break;

        case 3:
        {
            me->Say(SAY_ATTACK, LANG_UNIVERSAL, 0);
            Creature* temp = me->SummonCreature(21878, me->GetPositionX()+5, me->GetPositionY()+7, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000);
            if (temp)
                temp->AI()->AttackStart(me);
        }
        break;

        case 4:
        {
            me->Say(SAY_TIME_TO_GO, LANG_UNIVERSAL, GetPlayerForEscort()->GetGUID());
            me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE);

            Unit* temp = Unit::GetUnit(*me, GetPlayerForEscort()->GetGUID());
            if (temp)
            {
                temp->MonsterSay(SAY_BYE, LANG_UNIVERSAL, 0);
                temp->HandleEmoteCommand(EMOTE_ONESHOT_WAVE);
            }
        }
        break;
        }
    }
Example #5
1
        void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
        {
            Unit* victim = GetTarget();
            int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage();
            uint32 allowedHealth = victim->CountPctFromMaxHealth(35);
            // If damage kills us
            if (remainingHealth <= 0 && !victim->ToPlayer()->HasSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL))
            {
                // Cast healing spell, completely avoid damage
                absorbAmount = dmgInfo.GetDamage();

                uint32 defenseSkillValue = victim->GetDefenseSkillValue();
                // Max heal when defense skill denies critical hits from raid bosses
                // Formula: max defense at level + 140 (raiting from gear)
                uint32 reqDefForMaxHeal  = victim->getLevel() * 5 + 140;
                float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal)
                                       ? 1.0f
                                       : float(defenseSkillValue) / float(reqDefForMaxHeal);

                int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense)));
                victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff);
                victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, time(NULL) + 120);
            }
            else if (remainingHealth < int32(allowedHealth))
            {
                // Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x%
                uint32 damageToReduce = (victim->GetHealth() < allowedHealth)
                                        ? dmgInfo.GetDamage()
                                        : allowedHealth - remainingHealth;
                absorbAmount = CalculatePctN(damageToReduce, absorbPct);
            }
        }
        void JustDied(Unit* killer)
        {
            if (!ghost && instance)
            {
                Unit* skarvald = Unit::GetUnit(*me, instance->GetData64(DATA_SKARVALD));
                if (skarvald)
                {
                    if (skarvald->isDead())
                    {
                        Talk(YELL_DALRONN_SKA_DIED);

                        if (instance)
                            instance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE);
                    }
                    else
                    {
                        Talk(YELL_DALRONN_DAL_DIEDFIRST);

                        me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
                        //DoCast(me, SPELL_SUMMON_DALRONN_GHOST, true);
                        Creature* temp = me->SummonCreature(MOB_DALRONN_GHOST, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN, 5000);
                        if (temp)
                        {
                            temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            temp->AI()->AttackStart(killer);
                        }
                    }
                }
            }
        }
Example #7
1
        void UpdateAI(const uint32 diff)
        {
            if (Event_Timer <= diff)
            {
                switch (Phase)
                {
                case 1:
                    if (someplayer)
                    {
                        Unit* u = Unit::GetUnit(*me, someplayer);
                        if (u && u->GetTypeId() == TYPEID_PLAYER) DoScriptText(EMOTE_START, me, u);
                    }
                    Event_Timer = 60000;
                    Wave = true;
                    ++Phase;
                    break;
                case 2:
                    DoScriptText(EMOTE_60, me);
                    Event_Timer = 30000;
                    ++Phase;
                    break;
                case 3:
                    DoScriptText(EMOTE_30, me);
                    Event_Timer = 20000;
                    DoFinalSpawnForCreature(me);
                    ++Phase;
                    break;
                case 4:
                    DoScriptText(EMOTE_10, me);
                    Event_Timer = 10000;
                    Wave = false;
                    ++Phase;
                    break;
                case 5:
                    DoScriptText(EMOTE_COMPLETE, me);
                    if (someplayer)
                    {
                        Unit* u = Unit::GetUnit(*me, someplayer);
                        if (u && u->GetTypeId() == TYPEID_PLAYER)
                            CAST_PLR(u)->KilledMonsterCredit(me->GetEntry(), me->GetGUID());
                        DoCast(me, SPELL_DISABLE_VISUAL);
                    }
                    if (goConsole)
                    {
                        if (GameObject* go = GameObject::GetGameObject(*me, goConsole))
                            go->RemoveFlag(GAMEOBJECT_FIELD_FLAGS, GO_FLAG_IN_USE);
                    }
                    ++Phase;
                    break;
                }
            } else Event_Timer -= diff;

            if (Wave)
            {
                if (Wave_Timer <= diff)
                {
                    DoWaveSpawnForCreature(me);
                } else Wave_Timer -= diff;
            }
        }
void AssistanceMovementGenerator::Finalize(Unit &unit)
{
    ((Creature*)&unit)->SetNoCallAssistance(false);
    ((Creature*)&unit)->CallAssistance();
    if (unit.isAlive())
        unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY));
}
void InputDFA::appendCollection (UnitCollection *newcol) {
    switch (state) {
    case LOCATION_SELECT:
    case UNITS_SELECTED:
    case NONE:
        if (selected) {
            Unit *tUnit;
            for(un_iter it = newcol->createIterator(); tUnit = *it; ++it)
                tUnit->Select();
            un_iter tmpit = newcol->createIterator();
            selected->append (&tmpit);
            delete newcol;
            //remove duplicates FIXME
        } else {
            selected=newcol;
        }
        break;
    case TARGET_SELECT:
        if (targetted) {
            un_iter tmpit = newcol->createIterator();
            targetted->append (&tmpit);
            delete newcol;
            //remove duplicates FIXME
        } else {
            targetted = newcol;
        }
        break;
    }
}
Example #10
1
void WorldSession::HandleMoveKnockBackAck( WorldPacket & recv_data )
{
    DEBUG_LOG("CMSG_MOVE_KNOCK_BACK_ACK");

    Unit *mover = _player->GetMover();
    Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;

    // ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck
    if(plMover && plMover->IsBeingTeleported())
    {
        recv_data.rpos(recv_data.wpos());                   // prevent warnings spam
        return;
    }

    ObjectGuid guid;
    MovementInfo movementInfo;

    recv_data >> guid.ReadAsPacked();
    recv_data >> Unused<uint32>();                          // knockback packets counter
    recv_data >> movementInfo;

    if (!VerifyMovementInfo(movementInfo, guid))
        return;

    HandleMoverRelocation(movementInfo);

    WorldPacket data(MSG_MOVE_KNOCK_BACK, recv_data.size() + 15);
    data << mover->GetPackGUID();
    data << movementInfo;
    data << movementInfo.GetJumpInfo().sinAngle;
    data << movementInfo.GetJumpInfo().cosAngle;
    data << movementInfo.GetJumpInfo().xyspeed;
    data << movementInfo.GetJumpInfo().velocity;
    mover->SendMessageToSetExcept(&data, _player);
}
Example #11
1
void WorldSession::HandlePetStopAttack(WorldPacket& recv_data)
{
    DEBUG_LOG("WORLD: Received opcode CMSG_PET_STOP_ATTACK");

    ObjectGuid petGuid;
    recv_data >> petGuid;

    Unit* pet = GetPlayer()->GetMap()->GetUnit(petGuid);    // pet or controlled creature/player
    if (!pet)
    {
        sLog.outError("%s doesn't exist.", petGuid.GetString().c_str());
        return;
    }

    if (GetPlayer()->GetObjectGuid() != pet->GetCharmerOrOwnerGuid())
    {
        sLog.outError("HandlePetStopAttack: %s isn't charm/pet of %s.", petGuid.GetString().c_str(), GetPlayer()->GetGuidStr().c_str());
        return;
    }

    if (!pet->isAlive())
        return;

    pet->AttackStop();
}
Example #12
1
 void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
 {
     Unit* target = GetTarget();
     if (!target->HasAura(DK_SPELL_BLOOD_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
     {
         int32 basePoints1 = aurEff->GetAmount();
         target->CastCustomSpell(target, 63611, NULL, &basePoints1, NULL, true, 0, aurEff);
     }
 }
Example #13
1
 void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
 {
     Unit* target = GetTarget();
     if (target->HasAura(DK_SPELL_UNHOLY_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
     {
         // Not listed as any effect, only base points set in dbc
         int32 basePoints0 = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
         target->CastCustomSpell(target, DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &basePoints0, &basePoints0, &basePoints0, true, 0, aurEff);
     }
 }
Example #14
1
void Guardian::UpdateAttackPowerAndDamage(bool ranged)
{
    if (ranged)
        return;

    float val = 0.0f;
    float bonusAP = 0.0f;
    UnitMods unitMod = UNIT_MOD_ATTACK_POWER;

    if (GetEntry() == 416)                                   // imp's attack power
        val = GetStat(STAT_STRENGTH) - 10.0f;
    else
        val = 2 * GetStat(STAT_STRENGTH) - 20.0f;

    Unit* owner = GetOwner();
    if (owner && owner->GetTypeId() == TYPEID_PLAYER)
    {
        if (isHunterPet())                      //hunter pets benefit from owner's attack power
        {
            bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f;
            SetBonusDamage(int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.125f));
        }
        //demons benefit from warlocks shadow or fire damage
        else if (isPet() && owner->getClass() == CLASS_WARLOCK)
        {
            int32 fire  = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
            int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
            int32 maximum  = (fire > shadow) ? fire : shadow;
            if (maximum < 0)
                maximum = 0;
            SetBonusDamage(int32(maximum * 0.15f));
            bonusAP = maximum * 0.57f;
        }
        //water elementals benefit from mage's frost damage
        else if (GetEntry() == 510 && owner->getClass() == CLASS_MAGE)
        {
            int32 frost = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST);
            if (frost < 0)
                frost = 0;
            SetBonusDamage(int32(frost * 0.4f));
        }
    }

    SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, val + bonusAP);

    //in BASE_VALUE of UNIT_MOD_ATTACK_POWER for creatures we store data of meleeattackpower field in DB
    float base_attPower  = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
    float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
    float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;

    //UNIT_FIELD_(RANGED)_ATTACK_POWER field
    SetInt32Value(UNIT_FIELD_ATTACK_POWER, (int32)base_attPower);
    //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field
    SetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS, (int32)attPowerMod);
    //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
    SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, attPowerMultiplier);

    //automatically update weapon damage after attack power modification
    UpdateDamagePhysical(BASE_ATTACK);
}
Example #15
1
void SummonHandler::ExpireSummonsInSlot()
{
    for (std::tr1::array< Unit*, SUMMON_SLOTS >::iterator itr = summonslots.begin(); itr != summonslots.end(); ++itr)
    {
        Unit* u = *itr;

        if (u != NULL)
            u->Delete();
    }
    std::fill(summonslots.begin(), summonslots.end(), reinterpret_cast<Unit*>(NULL));
}
Example #16
1
void SummonHandler::RemoveAllSummons()
{
    for (std::set< Unit* >::iterator itr = guardians.begin(); itr != guardians.end();)
    {
        Unit* g = *itr;
        ++itr;
        g->Delete();
    }
    guardians.clear();

    ExpireSummonsInSlot();
}
void InputDFA::LocSelect (KBSTATE k, int x, int y, int delx, int dely, int mod) {
    if (k==RESET)
        return;///little hack to prevent the function from being 'primed' with reset and continuing on an infinite loop again and again and again
    CoordinateSelect::MouseMoveHandle(k,x,y,delx,dely,mod);

    if (k==PRESS) {

        Unit * un;
        Vector tmplocselvec = CurDFA->locsel->GetVector().Cast();
        for(un_iter tmp = CurDFA->selected->createIterator(); un = *tmp; ++tmp) {
            Order * nAI = CurDFA->orderfac->newOrder();
            nAI->AttachOrder(tmplocselvec.Cast());
            if (CurDFA->queueOrder) {
                un->EnqueueAI(nAI);
            } else {
                un->SetAI(nAI);//will take care of doing the setparent
            }
        }
        delete CurDFA->targetted;
        CurDFA->targetted=NULL;

        CurDFA->orderfac = NULL;//I know we don't dealloc
    }
    CurDFA->SetStateNone(); //go back up the heirarchy;
}
Example #18
0
        void KilledUnit(Unit* /*victim*/)
        {
            Unit* pLeftHead  = Unit::GetUnit(*me, LeftHeadGUID);
            Unit* pRightHead = Unit::GetUnit(*me, RightHeadGUID);

            if (!pLeftHead || !pRightHead)
                return;

            ikilling = rand()%2;

            Unit *source = (pLeftHead->GetEntry() == Killing[ikilling].creature ? pLeftHead : pRightHead);

            switch(ikilling)
            {
            case 0:
                DoScriptText(Killing[ikilling].id, source);
                Delay_Timer = 3500;
                KillingYell = true;
                break;
            case 1:
                DoScriptText(Killing[ikilling].id, source);
                KillingYell = false;
                break;
            }
        }
//Equiv of nonselect, but for Targets instead of selected ships
void InputDFA::TargetSelect (KBSTATE k,int x,int y, int delx, int dely, int mod) {
    if (k==RESET)
        return;///little hack to prevent the function from being 'primed' with reset and continuing on an infinite loop again and again and again
    CurDFA->state=TARGET_SELECT;//to fool the Noneselect function into using targets
    //don't bind keys above...."quiet state update"
    if (mod&ACTIVE_CTRL) {
        mod-=ACTIVE_CTRL;
    }
    NoneSelect (k,x,y,delx,dely,mod);
    if (CurDFA->state==TARGET_SELECT) {
        //executeOrders from selected->target;
        if (k==RELEASE&&CurDFA->targetted!=NULL) {
            Unit * un;
            for(un_iter tmp = CurDFA->selected->createIterator(); un = *tmp; ++tmp) {
                Order * nAI = CurDFA->orderfac->newOrder();
                if (CurDFA->targetted) {
                    Unit *tar = CurDFA->targetted->front();
                    if (tar) {
                        nAI->AttachOrder(tar);
                    }
                }
                if (CurDFA->queueOrder) {
                    un->EnqueueAI(nAI);
                } else {
                    un->SetAI(nAI);//will take care of doing the setparent
                }
            }
            delete CurDFA->targetted;
            CurDFA->targetted=NULL;

            CurDFA->orderfac = NULL;//I know we don't dealloc
        }
        CurDFA->SetStateNone(); //go back up the heirarchy;
    }
}
        void PreventHitByLoS()
        {
            if (Unit* target = GetHitUnit())
            {
                Unit* caster = GetCaster();

                std::list<GameObject*> blockList;
                caster->GetGameObjectListWithEntryInGrid(blockList, GO_SARONITE_ROCK, 100.0f);
                if (!blockList.empty())
                {
                    for (std::list<GameObject*>::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr)
                    {
                        if ((*itr)->isVisibleForInState(target))
                        {
                            if ((*itr)->IsInBetween(caster, target, 4.0f))
                            {
                                prevented = true;
                                target->ApplySpellImmune(GetSpellInfo()->Id, IMMUNITY_ID, GetSpellInfo()->Id, true);
                                PreventHitDefaultEffect(EFFECT_0);
                                PreventHitDefaultEffect(EFFECT_1);
                                PreventHitDefaultEffect(EFFECT_2);
                                PreventHitDamage();
                                break;
                            }
                        }
                    }
                }
            }
        }
Example #21
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     if (Unit* unitTarget = GetHitUnit())
     {
         uint32 spell_id = 0;
         switch (unitTarget->getClass())
         {
         case CLASS_DRUID:
             spell_id = SPELL_BLESSING_OF_LOWER_CITY_DRUID;
             break;
         case CLASS_PALADIN:
             spell_id = SPELL_BLESSING_OF_LOWER_CITY_PALADIN;
             break;
         case CLASS_PRIEST:
             spell_id = SPELL_BLESSING_OF_LOWER_CITY_PRIEST;
             break;
         case CLASS_SHAMAN:
             spell_id = SPELL_BLESSING_OF_LOWER_CITY_SHAMAN;
             break;
         default:
             return;                    // ignore for non-healing classes
         }
         Unit* caster = GetCaster();
         caster->CastSpell(caster, spell_id, true);
     }
 }
Example #22
0
Unit* PetAI::SelectNextTarget()
{
    // Provides next target selection after current target death

    // Passive pets don't do next target selection
    if (me->HasReactState(REACT_PASSIVE))
        return NULL;

    Unit* target = me->getAttackerForHelper();

    // Check pet's attackers first to prevent dragging mobs back to owner
    if (target && !target->HasBreakableByDamageCrowdControlAura())
        return target;

    if (me->GetCharmerOrOwner())
    {
        // Check owner's attackers if pet didn't have any
        target = me->GetCharmerOrOwner()->getAttackerForHelper();
        if (target && !target->HasBreakableByDamageCrowdControlAura())
            return target;

        // 3.0.2 - Pets now start attacking their owners target in defensive mode as soon as the hunter does
        target = me->GetCharmerOrOwner()->getVictim();
        if (target && !target->HasBreakableByDamageCrowdControlAura())
            return target;
    }

    // Default
    return NULL;
}
 void Trigger(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
 {
     Unit * target = GetTarget();
     // damage absorbed by Anti-Magic Shell energizes the DK with additional runic power.
     // This, if I'm not mistaken, shows that we get back ~20% of the absorbed damage as runic power.
     int32 bp = absorbAmount * 2 / 10;
     target->CastCustomSpell(target, DK_SPELL_RUNIC_POWER_ENERGIZE, &bp, NULL, NULL, true, NULL, aurEff);
 }
Example #24
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     Unit* caster = GetCaster();
     if (Unit* unitTarget = GetHitUnit())
     {
         int32 bp = CalculatePctN(GetHitDamage(), GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()));
         caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
     }
 }
Example #25
0
    void LockRageclaw()
    {
        Unit *Rageclaw = Unit::GetCreature(*m_creature, RageclawGUID);
        // pointer check not needed
        m_creature->SetInFront(Rageclaw);
        Rageclaw->SetInFront(m_creature);

        DoCast(Rageclaw, SPELL_LEFT_CHAIN, true);
        DoCast(Rageclaw, SPELL_RIGHT_CHAIN, true);
    }
Example #26
0
 void SummonCreatureWithRandomTarget(uint32 creatureId) {
     Unit* Summoned = me->SummonCreature(creatureId, me->GetPositionX(),
                                         me->GetPositionY(), me->GetPositionZ(), 0,
                                         TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 240000);
     if (Summoned) {
         Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
         if (pTarget)
             Summoned->AddThreat(pTarget, 1.0f);
     }
 }
Example #27
0
        void ActivateMinion(uint64 uiGuid, bool bFlag)
        {
            Unit* pMinion = Unit::GetUnit(*me, uiGuid);

            if (pMinion && pMinion->isAlive())
            {
                DoCast(pMinion, SPELL_AWAKEN_VAULT_WALKER, bFlag);
                pMinion->CastSpell(pMinion, SPELL_ARCHAEDAS_AWAKEN, true);
            }
        }
Example #28
0
 void WaypointReached(uint32 i)
 {
     pos = i;
     if (i == 7 && pInstance)
     {
         Unit* target = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE));
         if (target && target->isAlive())
             me->AddThreat(target, 0.0f);
     }
 }
        void HandleTriggerSpell(AuraEffect const* aurEff)
        {
            PreventDefaultAction();
            Unit* target = GetTarget();
            uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
            target->CastSpell(target, triggerSpellId, true);

            if (Unit* caster = GetCaster())
                if (target->GetDistance(caster) <= 12.0f)
                    target->CastSpell(caster, SPELL_SIPHONED_MIGHT, true);
        }
Example #30
0
void SummonHandler::GetSummonSlotSpellIDs(std::vector< uint32 > &spellids)
{
    for (std::tr1::array< Unit*, SUMMON_SLOTS >::iterator itr = summonslots.begin(); itr != summonslots.end(); ++itr)
    {
        Unit* u = (*itr);

        if (u != NULL)
            if (u->GetCreatedBySpell() != 0)
                spellids.push_back(u->GetCreatedBySpell());
    }
}