当前位置: 首页>>代码示例>>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;未经允许,请勿转载。