當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetHitUnit函數代碼示例

本文整理匯總了C++中GetHitUnit函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetHitUnit函數的具體用法?C++ GetHitUnit怎麽用?C++ GetHitUnit使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetHitUnit函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: HandleScriptEffect

 void HandleScriptEffect(SpellEffIndex /*effIndex*/)
 {
     if (roll_chance_i(chance))
         GetCaster()->CastSpell(GetHitUnit(), SHAMAN_SPELL_EARTHQUAKE_KNOCKDOWN, true);
 }
開發者ID:Everf,項目名稱:Dkc,代碼行數:5,代碼來源:spell_shaman.cpp

示例2: NotifyTargets

 void NotifyTargets()
 {
     if (Creature* caster = GetCaster()->ToCreature())
         if (Unit* target = GetHitUnit())
             caster->AI()->Talk(EMOTE_MUTATED_INFECTION, target->GetGUID());
 }
開發者ID:Arkania,項目名稱:ArkCORE4,代碼行數:6,代碼來源:boss_rotface.cpp

示例3: HandleScript

 void HandleScript(SpellEffIndex effIndex)
 {
     PreventHitDefaultEffect(effIndex);
     if (Unit* target = GetHitUnit())
         target->CastSpell(target, GetEffectValue(), false);
 }
開發者ID:beyourself,項目名稱:123,代碼行數:6,代碼來源:spell_dk.cpp

示例4: HandleScriptEffect

        void HandleScriptEffect(SpellEffIndex /*effIndex*/)
        {
            Unit* caster = GetCaster();
            if (Unit* unitTarget = GetHitUnit())
            {
                uint32 spellId = 0;
                int32 basePoint = 0;
                Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
                for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
                {
                    Aura* aura = i->second->GetBase();
                    if (aura->GetCasterGUID() != caster->GetGUID())
                        continue;

                    // Search only Serpent Sting, Viper Sting, Scorpid Sting auras
                    flag96 familyFlag = aura->GetSpellInfo()->SpellFamilyFlags;
                    if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
                        continue;
                    if (AuraEffect* aurEff = aura->GetEffect(0))
                    {
                        // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
                        if (familyFlag[0] & 0x4000)
                        {
                            int32 TickCount = aurEff->GetTotalTicks();
                            spellId = SPELL_HUNTER_CHIMERA_SHOT_SERPENT;
                            basePoint = aurEff->GetDamage();
                            ApplyPct(basePoint, TickCount * 40);
                            basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());

                            // Recalculate bonus damage on roll.
                            uint32 damage = std::max(aurEff->GetAmount(), 0);
                            sScriptMgr->ModifyPeriodicDamageAurasTick(unitTarget, caster, damage);
                            aurEff->SetDamage(caster->SpellDamageBonusDone(unitTarget, aurEff->GetSpellInfo(), damage, DOT) * aurEff->GetDonePct());
                        }
                        // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
                        else if (familyFlag[1] & 0x00000080)
                        {
                            int32 TickCount = aura->GetEffect(0)->GetTotalTicks();
                            spellId = SPELL_HUNTER_CHIMERA_SHOT_VIPER;

                            // Amount of one aura tick
                            basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
                            int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50; /// @todo WTF? caster uses unitTarget?
                            if (basePoint > casterBasePoint)
                                basePoint = casterBasePoint;
                            ApplyPct(basePoint, TickCount * 60);
                        }
                        // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
                        else if (familyFlag[0] & 0x00008000)
                            spellId = SPELL_HUNTER_CHIMERA_SHOT_SCORPID;
                        // ?? nothing say in spell desc (possibly need addition check)
                        //if (familyFlag & 0x0000010000000000LL || // dot
                        //    familyFlag & 0x0000100000000000LL)   // stun
                        //{
                        //    spellId = 53366; // 53366 Chimera Shot - Wyvern
                        //}

                        // Refresh aura duration
                        aura->RefreshDuration();
                    }
                    break;
                }
                if (spellId)
                    caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true);
                if (spellId == SPELL_HUNTER_CHIMERA_SHOT_SCORPID && caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
                    caster->ToPlayer()->AddSpellCooldown(spellId, 0, uint32(time(NULL) + 60));
            }
        }
開發者ID:4jb,項目名稱:Trinity,代碼行數:68,代碼來源:spell_hunter.cpp

示例5: HandleScript

 void HandleScript(SpellEffIndex /*effIndex*/)
 {
     GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
 }
開發者ID:Aravu,項目名稱:Talador-Project,代碼行數:4,代碼來源:boss_lord_jaraxxus.cpp

示例6: HandleScriptEffect

 void HandleScriptEffect(SpellEffIndex /*effIndex*/)
 {
     if (Unit* target = GetHitUnit())
         target->GetAI()->DoAction(ACTION_FLY_DOWN);
 }
開發者ID:AzerothShard-Dev,項目名稱:azerothcore,代碼行數:5,代碼來源:boss_vazruden_the_herald.cpp

示例7: HandleScript

 void HandleScript(SpellEffIndex /*effIndex*/)
 {
     if (Unit* target = GetHitUnit())
         target->RemoveAura(SPELL_GIFT_OF_THARON_JA);
 }
開發者ID:125125,項目名稱:TrinityCore,代碼行數:5,代碼來源:boss_tharon_ja.cpp

示例8: HandleScript

 void HandleScript(SpellEffIndex /*effIndex*/)
 {
     Unit* caster = GetCaster();
     if (Unit* target = GetHitUnit())
         caster->CastSpell(target, uint32(GetEffectValue()), true);
 }
開發者ID:Dramacydal,項目名稱:Trinitycore-5.3.0,代碼行數:6,代碼來源:boss_mandokir.cpp

示例9: HandleEffect

 void HandleEffect(SpellEffIndex effIndex)
 {
     PreventHitDefaultEffect(effIndex);
     float curThreat = GetCaster()->getThreatManager().getThreat(GetHitUnit(), true);
     GetCaster()->getThreatManager().addThreat(GetHitUnit(), -curThreat + 50000.0f / std::min(1.0f, GetCaster()->GetDistance(GetHitUnit())));
 }
開發者ID:AtVirus,項目名稱:multi_realm_cell,代碼行數:6,代碼來源:boss_alysrazor.cpp

示例10: TurnBird

 void TurnBird(SpellEffIndex effIndex)
 {
     PreventHitDefaultEffect(effIndex);
     GetHitUnit()->PlayOneShotAnimKit(ANIM_KIT_BIRD_TURN);
 }
開發者ID:AtVirus,項目名稱:multi_realm_cell,代碼行數:5,代碼來源:boss_alysrazor.cpp

示例11: HandleDummy

 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     Unit* caster = GetCaster();
     if (Unit* unitTarget = GetHitUnit())
         caster->CastSpell(unitTarget, SPELL_ROGUE_SHIV_TRIGGERED, true);
 }
開發者ID:mynew4,項目名稱:RE,代碼行數:6,代碼來源:spell_rogue.cpp

示例12: HandleDummy

        void HandleDummy(SpellEffIndex /*effIndex*/)
        {
            uint32 roll = urand(1, 100);

            uint8 ev;
            if (roll <= 50)
                ev = EVENT_MISS;
            else if (roll <= 83)
                ev = EVENT_HIT;
            else
                ev = EVENT_MISS_BIRD;

            Unit* shooter = GetCaster();
            Creature* wilhelm = GetHitUnit()->ToCreature();
            Creature* apple = shooter->FindNearestCreature(NPC_APPLE, 30);
            Creature* drostan = shooter->FindNearestCreature(NPC_DROSTAN, 30);

            if (!wilhelm || !apple || !drostan)
                return;

            switch (ev)
            {
            case EVENT_MISS_BIRD:
            {
                Creature* crunchy = shooter->FindNearestCreature(NPC_CRUNCHY, 30);
                Creature* bird = shooter->FindNearestCreature(NPC_THICKBIRD, 30);

                if (!bird || !crunchy)
                    ; // fall to EVENT_MISS
                else
                {
                    shooter->CastSpell(bird, SPELL_MISS_BIRD_APPLE);
                    bird->CastSpell(bird, SPELL_BIRD_FALL);
                    wilhelm->AI()->Talk(SAY_WILHELM_MISS);
                    drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS);

                    bird->Kill(bird);
                    crunchy->GetMotionMaster()->MovePoint(0, bird->GetPositionX(), bird->GetPositionY(),
                                                          bird->GetMap()->GetWaterOrGroundLevel(bird->GetPositionX(), bird->GetPositionY(), bird->GetPositionZ()));
                    /// @todo Make crunchy perform emote eat when he reaches the bird

                    break;
                }
            }
            case EVENT_MISS:
            {
                shooter->CastSpell(wilhelm, SPELL_MISS_APPLE);
                wilhelm->AI()->Talk(SAY_WILHELM_MISS);
                drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS);
                break;
            }
            case EVENT_HIT:
            {
                shooter->CastSpell(apple, SPELL_HIT_APPLE);
                apple->CastSpell(apple, SPELL_APPLE_FALL);
                wilhelm->AI()->Talk(SAY_WILHELM_HIT);
                if (Player* player = shooter->ToPlayer())
                    player->KilledMonsterCredit(NPC_APPLE);
                apple->DespawnOrUnsummon();

                break;
            }
            }
        }
開發者ID:RafoxSama,項目名稱:TrinityCore,代碼行數:64,代碼來源:zone_sholazar_basin.cpp

示例13: HandleDummy

 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     if (Unit* unitTarget = GetHitUnit())
         if (SpellInfo const* spell_proto = sSpellMgr->GetSpellInfo(GetEffectValue()))
             GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL);
 }
開發者ID:Stylerdk,項目名稱:TrinityCore,代碼行數:6,代碼來源:spell_paladin.cpp

示例14: HandleDummy

 void HandleDummy(SpellEffIndex effIndex)
 {
     if (Unit *unitTarget = GetHitUnit())
         if (unitTarget->GetTypeId() == TYPEID_UNIT)
             unitTarget->CastSpell(unitTarget, spell_list[urand(0, 5)], true);
 }
開發者ID:Archives,項目名稱:ro_core,代碼行數:6,代碼來源:spell_mage.cpp

示例15: HandleScript

 void HandleScript(SpellEffIndex effIndex)
 {
     PreventHitDefaultEffect(effIndex);
     GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), false);
 }
開發者ID:heros,項目名稱:LasCore,代碼行數:5,代碼來源:wintergrasp.cpp


注:本文中的GetHitUnit函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。