Ejemplo n.º 1
0
        void CalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod, SpellInfo const* /*spellInfo*/, Unit* /*target*/)
        {
            int32 bonus = 0;
            if (Unit* caster = GetCaster())
            {
                if (Player* player = caster->ToPlayer())
                {
                    uint32 maxMana = player->GetMaxPower(POWER_MANA);
                    if (!maxMana)
                        return;
                    uint32 amount = aurEff->GetAmount(); // 150 * mastery / 100
                    float manaPercent = float(player->GetPower(POWER_MANA)) / float(maxMana);
                    //float mastery = player->GetMasteryPoints();
                    bonus = int32(manaPercent * (/*(mastery + 8.0f) **/ amount)/* / 100.0f*/);
                    //if (!spellMod || bonus != spellMod->value)
                    //    sLog->outBasic("Mana Adept : manaPct %.2f, amount %u, bonus %d", manaPercent, amount, bonus);
                }
            }

            if (!spellMod)
                spellMod = new SpellModifier(GetAura(), const_cast<AuraEffect*>(aurEff));

            spellMod->op = SPELLMOD_DAMAGE/*SPELLMOD_ALL_EFFECTS*/;

            spellMod->type = SPELLMOD_PCT;
            spellMod->spellId = aurEff->GetId(); // 12042 Arcane Power : 685904631, 102472, 0
            spellMod->mask = flag96(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);//GetSpellProto()->EffectSpellClassMask[aurEff->GetEffIndex()];
            spellMod->charges = GetAura()->GetCharges();

            //spellMod->spellId = aurEff->GetId(); // 12042
            spellMod->value = bonus;
        }
Ejemplo n.º 2
0
            void OnPeriodic(AuraEffect const* /*aurEff*/)
            {
                // Every 5 seconds
                Unit* target = GetTarget();
                Unit* caster = GetCaster();

                // If our player is no longer sit, remove all auras
                if (target->getStandState() != UNIT_STAND_STATE_SIT)
                {
                    target->RemoveAura(GetAura());
                    return;
                }

                target->CastSpell(target, SPELL_BASKET_CHECK, false); // unknown use, it targets Romantic Basket
                target->CastSpell(target, RAND(SPELL_MEAL_EAT_VISUAL, SPELL_DRINK_VISUAL), false);

                bool foundSomeone = false;
                // For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123)
                // required for "hearts" visual
                std::list<Player*> playerList;
                Trinity::AnyPlayerInObjectRangeCheck checker(target, INTERACTION_DISTANCE*2);
                Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(target, playerList, checker);
                target->VisitNearbyWorldObject(INTERACTION_DISTANCE*2, searcher);
                for (std::list<Player*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
                    if ((*itr) != target && (*itr)->HasAura(GetId())) // && (*itr)->getStandState() == UNIT_STAND_STATE_SIT)
                        foundSomeone = true;
                        // break;
            }
Ejemplo n.º 3
0
    void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
    {
        if (!GetCaster()->HasAura(SPELL_VITAL_SPARK))
        {
            stacks = 0;
            return;
        }

        stacks = GetCaster()->GetAuraCount(SPELL_VITAL_SPARK);
        int32 healingPct = sSpellMgr->AssertSpellInfo(SPELL_VITAL_SPARK)->GetEffect(EFFECT_0)->BasePoints * stacks;

        if (GetAura()->GetEffect(EFFECT_0)->GetAmount() < healingPct)
            GetAura()->GetEffect(EFFECT_0)->SetAmount(healingPct);

        GetCaster()->RemoveAura(SPELL_VITAL_SPARK);
    }
Ejemplo n.º 4
0
void Player::UpdateMastery()
{
    if (!CanUseMastery())
    {
        SetFloatValue(PLAYER_MASTERY, 0.0f);
        return;
    }

    float value = GetTotalAuraModifier(SPELL_AURA_MASTERY);
    value += GetRatingBonusValue(CR_MASTERY);
    SetFloatValue(PLAYER_MASTERY, value);

    ChrSpecializationEntry const* chrSpec = sChrSpecializationStore.LookupEntry(GetUInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID));
    if (!chrSpec)
        return;

    for (uint32 i = 0; i < MAX_MASTERY_SPELLS; ++i)
    {
        if (Aura* aura = GetAura(chrSpec->MasterySpellID[i]))
        {
            for (SpellEffectInfo const* effect : aura->GetSpellEffectInfos())
            {
                if (!effect)
                    continue;

                float mult = effect->BonusCoefficient;
                if (G3D::fuzzyEq(mult, 0.0f))
                    continue;

                aura->GetEffect(effect->EffectIndex)->ChangeAmount(int32(value * mult));
            }
        }
    }
}
Ejemplo n.º 5
0
            void HandlePeriodic(constAuraEffectPtr aurEff)
            {
                Unit* caster = GetCaster();
                Unit* target = GetTarget();
                const SpellInfo* spell = GetSpellInfo();
                Player* linkedPlayer = sObjectAccessor->GetPlayer(*target, playerLinkedGuid);

                if (!caster || !target || !spell || !linkedPlayer || !linkedPlayer->isAlive() || !linkedPlayer->HasAura(spell->Id))
                    if (AuraPtr myaura = GetAura())
                    {
                        myaura->Remove();
                        return;
                    }

                if (target->GetDistance(linkedPlayer) > spell->Effects[EFFECT_0].BasePoints)
                {
                    if (AuraPtr aura = target->GetAura(spell->Id))
                    {
                        if (aura->GetStackAmount() >= 15)
                        {
                            aura->Remove();
                            return;
                        }
                    }
                    
                    caster->AddAura(spell->Id, target);
                    target->CastSpell(linkedPlayer, SPELL_JASPER_CHAINS_DAMAGE, true);
                }
                else
                    target->CastSpell(linkedPlayer, SPELL_JASPER_CHAINS_VISUAL, true);
            }
            void HandlePeriodicTick(AuraEffect const* aurEff)
            {
                if (!GetUnitOwner())
                    return;

                if (Aura* aur = GetAura())
                {
                    if (aur->GetStackAmount() >= 5)
                    {
                        uint32 spellId = SPELL_DEEP_CORRUPTION_DMG;
                        switch (GetCaster()->GetMap()->GetDifficulty())
                        {
                            case RAID_DIFFICULTY_10MAN_NORMAL: spellId = SPELL_DEEP_CORRUPTION_DMG;     break;
                            case RAID_DIFFICULTY_25MAN_NORMAL: spellId = SPELL_DEEP_CORRUPTION_DMG_25;  break;
                            case RAID_DIFFICULTY_10MAN_HEROIC: spellId = SPELL_DEEP_CORRUPTION_DMG_10H; break;
                            case RAID_DIFFICULTY_25MAN_HEROIC: spellId = SPELL_DEEP_CORRUPTION_DMG_25H; break;

							default:                           spellId = SPELL_DEEP_CORRUPTION_DMG;     break;
                        }

                        GetUnitOwner()->CastSpell(GetUnitOwner(), spellId, true);

                        aur->Remove();
                    }
                }
            }
Ejemplo n.º 7
0
 void HandleShatter(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     //if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL)
     if (GetAura()->GetCharges() <= 1)
         if (GetTarget()->IsAIEnabled)
             GetTarget()->GetAI()->DoAction(ACTION_PROTECTIVE_BUBBLE_SHATTERED);
 }
Ejemplo n.º 8
0
        void OnProc(AuraEffect const* aurEff, Unit* unit, Unit* victim, uint32 damage, SpellInfo const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, int32 cooldown)
        {
            PreventDefaultAction();
            if (!(procFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG))
                return;

            Player* player = unit->ToPlayer();
            if (!player)
                return;

            // custom cooldown processing case
            uint32 auraSpellId = GetAura()->GetId();
            if (cooldown && player->HasSpellCooldown(auraSpellId))
                return;

            uint32 procSpellId = procSpell ? procSpell->Id : 0;
            uint32 spellId = 0;
            switch (procSpellId)
            {
                // Lightning Bolt
                case 403:
                    spellId = 45284;
                    break;
                // Chain Lightning
                case 421:
                    spellId = 45297;
                    break;
                // Lava Burst
                case 51505:
                    spellId = 77451;
                    break;
                default:
                    return;
            }

            //sLog->outDetail("Elemental Overlord : attType %u, damage %u, procSpell %u, chance %d", attType, damage, procSpellId, aurEff->GetAmount());

            // Chain Lightning
            if (procSpell->SpellFamilyFlags[0] & 0x2)
            {
                // Chain lightning has [LightOverload_Proc_Chance] / [Max_Number_of_Targets] chance to proc of each individual target hit.
                // A maxed LO would have a 33% / 3 = 11% chance to proc of each target.
                // LO chance was already "accounted" at the proc chance roll, now need to divide the chance by [Max_Number_of_Targets]
                float chance = 100.0f / procSpell->Effects[EFFECT_0].ChainTarget;
                if (!roll_chance_f(chance))
                    return;

                // Remove cooldown (Chain Lightning - have Category Recovery time)
                player->RemoveSpellCooldown(spellId);
            }

            if (roll_chance_i(aurEff->GetAmount()))
            {
                unit->CastSpell(victim, spellId, true, NULL, aurEff);
                if (cooldown)
                    player->AddSpellCooldown(auraSpellId, 0, time(NULL) + cooldown);
            }
        }
Ejemplo n.º 9
0
void Player::UpdateMastery()
{
    if (HasAuraType(SPELL_AURA_MASTERY))
    {
        if(HasAura(76671))
            GetAura(76671)->RecalculateAmountOfEffects();//Paladin Protection Mastery
        if(HasAura(77514))
            GetAura(77514)->RecalculateAmountOfEffects();//DK Frost Mastery
        if(HasAura(48517))
            GetAura(48517)->RecalculateAmountOfEffects();// Druid Balance Mastery
        if(HasAura(48518))
            GetAura(48518)->RecalculateAmountOfEffects();// Druid Balance Mastery
        if(HasAura(76857))
            GetAura(76857)->RecalculateAmountOfEffects();// Warrior Protection Mastery
        SetInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_MASTERY, m_baseRatingValue[CR_MASTERY]);
        SetFloatValue(PLAYER_MASTERY, GetMasteryPoints());
    }
}
Ejemplo n.º 10
0
            void HandlePeriodicDummy(AuraEffect const* aurEff)
            {
                Unit* target = GetTarget();
				if (target->GetTypeId() == TYPEID_UNIT && GetAura()->GetStackAmount() >= 10)
				{
					target->CastSpell(target, SPELL_OVERCHARGED_BLAST, true);
					target->ToCreature()->DespawnOrUnsummon(500);
				}

				PreventDefaultAction();
            }
Ejemplo n.º 11
0
uint32 MasteryScript::GetMasteryBaseAmount()
{
    if (dummyEffectIndex >= 0 && dummyEffectIndex < MAX_SPELL_EFFECTS)
    {
        if (SpellInfo const* spellInfo = GetAura()->GetSpellInfo())
            return spellInfo->Effects[dummyEffectIndex].BasePoints ? spellInfo->Effects[dummyEffectIndex].BasePoints : defaultBaseAmount;
        // if (AuraEffect* effect = GetAura()->GetEffect(dummyEffectIndex))
        //    return effect->GetBaseAmount()/*GetAmount()*/;
    }
    return defaultBaseAmount;
}
Ejemplo n.º 12
0
        void CalcSpellMod(AuraEffect const * aurEff, SpellModifier *& spellMod, SpellInfo const *spellInfo, Unit * target)
        {
            int32 bonus = 0;
            if (target && target->HasAuraState(AURA_STATE_FROZEN, spellInfo, GetCaster()))
            {
                bonus = aurEff->GetAmount(); // 250 * mastery / 100
                //if (!spellMod || bonus != spellMod->value)
                //    sLog->outBasic("Frostburn : affected spell %u bonus %d", spellInfo ? spellInfo->Id : 0, bonus);
            }

            if (!spellMod)
                spellMod = new SpellModifier(GetAura(), const_cast<AuraEffect*>(aurEff));

            spellMod->op = SPELLMOD_DAMAGE/*SPELLMOD_ALL_EFFECTS*/;
            spellMod->type = SPELLMOD_PCT;
            spellMod->spellId = aurEff->GetId(); // 12042 Arcane Power : 685904631, 102472, 0
            spellMod->mask = flag96(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);//GetSpellProto()->EffectSpellClassMask[aurEff->GetEffIndex()];
            spellMod->charges = GetAura()->GetCharges();
            //spellMod->spellId = aurEff->GetId(); // 12042
            spellMod->value = bonus;
        }
Ejemplo n.º 13
0
 void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)
 {
     if (!spellMod)
     {
         spellMod = new SpellModifier(GetAura());
         spellMod->op = SPELLMOD_DOT;
         spellMod->type = SPELLMOD_FLAT;
         spellMod->spellId = GetId();
         spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask;
     }
     spellMod->value = aurEff->GetAmount() / 7;
 }
Ejemplo n.º 14
0
void SpellValanarKineticBombAuraScript::HandleDummyTick(AuraEffect const* /*aurEff*/)
{
    Unit* target = GetTarget();
    if (target->GetTypeId() != TYPEID_UNIT)
        return;

    if (Creature* bomb = target->FindNearestCreature(NPC_KINETIC_BOMB, 0.1f, true))
    {
        bomb->CastSpell(bomb, SPELL_KINETIC_BOMB_EXPLOSION, true);
        bomb->RemoveAurasDueToSpell(SPELL_KINETIC_BOMB_VISUAL);
        target->RemoveAura(GetAura());
        bomb->AI()->DoAction(SPELL_KINETIC_BOMB_EXPLOSION);
    }
}
Ejemplo n.º 15
0
        void CalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod, SpellInfo const* /*spellInfo*/, Unit* target)
        {
            int32 bonus = 0;
            float pct = 0.0f;
            if (target)
            {
                pct = target->GetHealthPct();
                uint32 amount = aurEff->GetAmount(); // 300
                //float mastery = player->GetMasteryPoints();
                bonus = int32((100.0f - pct) * amount/*((mastery + 8.0f) * amount)*/ / 100.0f);
            }

            if (!spellMod)
                spellMod = new SpellModifier(GetAura(), const_cast<AuraEffect*>(aurEff));

            spellMod->op = SPELLMOD_DAMAGE/*SPELLMOD_ALL_EFFECTS*/;

            spellMod->type = SPELLMOD_PCT;
            spellMod->spellId = aurEff->GetId(); // 16188 Nature's Swiftness
            spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask;
            spellMod->charges = GetAura()->GetCharges();

            spellMod->value = bonus;
        }
Ejemplo n.º 16
0
 void HandlePeriodic(AuraEffect const* /*eff*/)
 {
     Unit* caster = GetCaster();
     if (!caster)
         return;
     InstanceScript* instance = caster->GetInstanceScript();
     if (!instance)
         return;
     if (instance->GetBossState(DATA_HADRONOX) == DONE)
         GetAura()->Remove();
     else
     {
         if (caster->GetPositionZ() >= 750.0f)
             caster->CastSpell(caster, _topSpellId, true);
         else
             caster->CastSpell(caster, _bottomSpellId, true);
     }
 }
            void HandlePeriodicTick(constAuraEffectPtr /*aurEff*/)
            {
                if (!GetUnitOwner())
                    return;

                if (AuraEffectPtr aurEff = GetAura()->GetEffect(EFFECT_0))
                {
                    int32 oldamount = GetUnitOwner()->GetPower(POWER_ALTERNATE_POWER);
                    int32 newamount = oldamount + 5;
                    if (newamount > 100)
                        newamount = 100;
                    if (newamount == oldamount)
                        return;

                    if (oldamount < 100 && newamount == 100)
                    {
                        GetUnitOwner()->RemoveAura(SPELL_EPIC_CONCENTRATION);
                        GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_LEGENDARY_CONCENTRATION, true);
                    }
                    else if (oldamount < 75 && newamount >= 75)
                    {
                        GetUnitOwner()->RemoveAura(SPELL_RARE_CONCENTRATION);
                        GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_EPIC_CONCENTRATION, true);
                    }
                    else if (oldamount < 50 && newamount >= 50)
                    {
                        GetUnitOwner()->RemoveAura(SPELL_UNCOMMON_CONCENTRATION);
                        GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_RARE_CONCENTRATION, true);
                    }
                    else if (oldamount < 25 && newamount >= 25)
                    {
                        GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_UNCOMMON_CONCENTRATION, true);
                    }
                    else if (newamount < 25)
                    {
                        GetUnitOwner()->RemoveAura(SPELL_LEGENDARY_CONCENTRATION);
                        GetUnitOwner()->RemoveAura(SPELL_EPIC_CONCENTRATION);
                        GetUnitOwner()->RemoveAura(SPELL_RARE_CONCENTRATION);
                        GetUnitOwner()->RemoveAura(SPELL_UNCOMMON_CONCENTRATION);
                    }
                    GetUnitOwner()->SetPower(POWER_ALTERNATE_POWER, newamount);
                }
            }
Ejemplo n.º 18
0
void Player::UpdateMastery()
{
    if (!IsMasteryLearned())
    {
        SetFloatValue(PLAYER_MASTERY, 0.0f);
        return;
    }

    TalentTabEntry const* talentTab = sTalentTabStore.LookupEntry(GetPrimaryTalentTree(GetActiveSpec()));
    if (!talentTab)
    {
        SetFloatValue(PLAYER_MASTERY, 0.0f);
        return;
    }

    float value = GetTotalAuraModifier(SPELL_AURA_MASTERY);
    value += GetRatingBonusValue(CR_MASTERY);
    SetFloatValue(PLAYER_MASTERY, value);

    for (uint32 i = 0; i < MAX_MASTERY_SPELLS; ++i)
    {
        if (!talentTab->MasterySpells[i])
            continue;

        if (Aura* aura = GetAura(talentTab->MasterySpells[i]))
        {
            for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
            {
                if (!aura->HasEffect(j))
                    continue;

                if (aura->GetSpellInfo()->Effects[j].BasePoints == 0)
                    aura->GetEffect(j)->ChangeAmount(int32(value * aura->GetSpellInfo()->Effects[j].BonusMultiplier));
            }
        }
    }
}
Ejemplo n.º 19
0
            void OnPeriodic(AuraEffect const* aurEff)
            {
				if (aurEff->GetTickNumber() > 1 && aurEff->GetTickNumber()%5 == 1)
					GetAura()->GetEffect(aurEff->GetEffIndex())->SetAmount(aurEff->GetAmount()*2);
            }
Ejemplo n.º 20
0
 void UpdateAmount(AuraEffect* /*aurEff*/)
 {
     if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1))
         effect->ChangeAmount(effect->GetAmount() - 5);
 }
Ejemplo n.º 21
0
 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     // Remove all auras with spell id 46221, except the one currently being applied
     while (Aura* aur = GetUnitOwner()->GetOwnedAura(SPELL_ANIMAL_BLOOD, 0, 0, 0, GetAura()))
         GetUnitOwner()->RemoveOwnedAura(aur);
 }
Ejemplo n.º 22
0
 void OnPeriodic(AuraEffect const* /*aurEff*/)
 {
     if (Unit* caster = GetCaster())
         if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_0))
             effect->RecalculateAmount(caster);
 }
Ejemplo n.º 23
0
 void OnTick(AuraEffect const* aurEff)
 {
     if (Unit* player = GetTarget())
         if (player->GetHealthPct() <= 50.0f)
             player->RemoveAura(GetAura());
 }
Ejemplo n.º 24
0
 void OnApply(AuraEffect const* auraEffect, AuraEffectHandleModes)
 {
     GetAura()->GetEffect(auraEffect->GetEffIndex())->SetPeriodicTimer(_delay);
 }
Ejemplo n.º 25
0
            void HandleApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
            {
				// first tick after 10 seconds
				GetAura()->GetEffect(aurEff->GetEffIndex())->SetPeriodicTimer(10000);
            }
Ejemplo n.º 26
0
 void HandleApply(AuraEffect const* /*eff*/, AuraEffectHandleModes /*mode*/)
 {
     if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_0))
         effect->SetPeriodicTimer(urandms(2, 17));
 }
Ejemplo n.º 27
0
 void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
 {
     Unit* target = GetTarget();
     target->CastSpell(target, uint32(GetAura()->GetSpellEffectInfo(EFFECT_2)->CalcValue()), true, nullptr, aurEff, GetCasterGUID());
 }