Esempio n. 1
0
            void HandleEffect(SpellEffIndex effIndex)
            {
                Unit* caster = GetCaster();
                if (Unit* target = GetHitUnit())
                {
                    SpellInfo const* spellInfo = GetSpellInfo();
                    int32 rageUsed = std::min<int32>(300 - spellInfo->CalcPowerCost(caster, SpellSchoolMask(spellInfo->SchoolMask)), caster->GetPower(POWER_RAGE));
                    int32 newRage = std::max<int32>(0, caster->GetPower(POWER_RAGE) - rageUsed);

                    // Sudden Death rage save
                    if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, WARRIOR_ICON_ID_SUDDEN_DEATH, EFFECT_0))
                    {
                        int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10;
                        newRage = std::max(newRage, ragesave);
                    }

                    caster->SetPower(POWER_RAGE, uint32(newRage));
                    // Glyph of Execution bonus
                    if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_WARRIOR_GLYPH_OF_EXECUTION, EFFECT_0))
                        rageUsed += aurEff->GetAmount() * 10;


                    int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f);
                    caster->CastCustomSpell(target, SPELL_WARRIOR_EXECUTE, &bp, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID());
                }
            }
Esempio n. 2
0
		void HandleOnHit()
		{
			Unit* caster = GetCaster();
			if (Unit* unitTarget = GetHitUnit())
			{
				if (Aura* aur = caster->GetAuraOfRankedSpell(15273, caster->GetGUID()))
				{
					int32 chance = aur->GetSpellInfo()->Effects[EFFECT_1].BasePoints;
					if (caster->GetShapeshiftForm() == FORM_SHADOW && roll_chance_i(chance))
						caster->CastSpell(unitTarget, 48301, true);
				}
				// Remove Mind spike debuff
				unitTarget->RemoveAurasDueToSpell(87178, caster->GetGUID());
			}

			// Shadow orbs
			if (AuraEffect* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 4941, EFFECT_0))
			{
				uint8 stacks = aurEff->GetBase()->GetStackAmount();
				int32 amount = aurEff->GetAmount() / (2.0f * stacks);
				if (AuraEffect* mastery = caster->GetAuraEffect(77486, EFFECT_0))
					amount += mastery->GetAmount();
				caster->CastCustomSpell(caster, 95799, &amount, &amount, NULL, true);
				aurEff->GetBase()->Remove();
			}
		}
Esempio n. 3
0
            void HandleDummy(SpellEffIndex /*effect*/)
            {
                Unit* target = GetHitUnit();
                Unit* caster = GetCaster();
                int32 damage = 0;

                // apply percent damage mods
                damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);

                switch (GetSpellInfo()->Id)
                {
                    case 12162:
                        ApplyPctN(damage, 16); break; // Rank 1
                    case 12850:
                        ApplyPctN(damage, 32); break; // Rank 2
                    case 12868:
                        ApplyPctN(damage, 48); break; // Rank 3
                    default:
                        break;
                }

                SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(12721);
                uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude;

                // Add remaining ticks to damage done
                if (AuraEffect const* aurEff = target->GetAuraEffect(12721, EFFECT_0, caster->GetGUID()))
                    damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber());

                damage /= ticks;
                caster->CastCustomSpell(target, 12721, &damage, NULL, NULL, true);
            }
Esempio n. 4
0
            void HandleBeforeCast()
            {
                Unit* caster = GetCaster();
                Unit* target = GetExplTargetUnit();
                
                if(caster && target)
                {
                    int32 basepoints0 = 0;

                    if(AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_WARRIOR, 243, EFFECT_0))
                    {
                        basepoints0 = CalculatePct(caster->CalculateDamage(BASE_ATTACK, true, true), aurEff->GetAmount());

                        // Check for IconId duplicate
                        if(aurEff->GetBase() && aurEff->GetBase()->GetId() != 84919)
                        {
                            // * 6 because I need the total remaind periodic amount
                            basepoints0 += (target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, SPELL_AURA_PERIODIC_DAMAGE) * 6);
                        }
                    }

                    // Per tick damage
                    if(basepoints0)
                    {
                        deepWoundsAmount = basepoints0 / 6;
                    }
                }
            }
Esempio n. 5
0
            void HandleEffect(SpellEffIndex /*effIndex*/)
            {
                Unit* caster = GetCaster();
                if (GetHitUnit())
                {
                    SpellInfo const* spellInfo = GetSpellInfo();
                    int32 rageUsed = std::min<int32>(200 - spellInfo->CalcPowerCost(caster, SpellSchoolMask(spellInfo->SchoolMask)), caster->GetPower(POWER_RAGE));
                    int32 newRage = std::max<int32>(0, caster->GetPower(POWER_RAGE) - rageUsed);

                    // Sudden Death rage save
                    if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, ICON_ID_SUDDEN_DEATH, EFFECT_0))
                    {
                        int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_0].CalcValue() * 10;
                        newRage = std::max(newRage, ragesave);
                    }

                    caster->SetPower(POWER_RAGE, uint32(newRage));

                    /// Formula taken from the DBC: "${10+$AP*0.437*$m1/100}"
                    int32 baseDamage = int32(10 + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.437f * GetEffectValue() / 100.0f);
                    /// Formula taken from the DBC: "${$ap*0.874*$m1/100-1} = 20 rage"
                    int32 moreDamage = int32(rageUsed * (caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.874f * GetEffectValue() / 100.0f - 1) / 200);
                    SetHitDamage(baseDamage + moreDamage);
                }
            }
Esempio n. 6
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     Unit* caster = GetCaster();
     if (Unit* unitTarget = GetHitUnit())
     {
         multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f);
         // Death Knight T8 Melee 4P Bonus
         if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0))
             AddPct(multiplier, aurEff->GetAmount());
     }
 }
Esempio n. 7
0
            void HandleHeal(SpellEffIndex /*effIndex*/)
            {
                Unit* caster = GetCaster();
                int32 heal = caster->GetTotalAttackPowerValue(BASE_ATTACK) * 4; /// todo, add versatality bonus as it will probably not apply to the heal due to its damageclass SPELL_DAMAGE_CLASS_NONE.
                caster->CastCustomSpell(SPELL_DK_DEATH_STRIKE_HEAL, SPELLVALUE_BASE_POINT0, heal, caster, true);

                if (!caster->HasAura(SPELL_DK_BLOOD_PRESENCE) || !caster->HasAura(SPELL_DK_IMPROVED_BLOOD_PRESENCE))
                    return;

                /// todo, if SPELL_AURA_MOD_ABSORB_PERCENTAGE will not apply to SPELL_DAMAGE_CLASS_NONE, resolve must be applied here.
                if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_BLOOD_SHIELD_MASTERY, EFFECT_0))
                    caster->CastCustomSpell(SPELL_DK_BLOOD_SHIELD_ABSORB, SPELLVALUE_BASE_POINT0, CalculatePct(heal, aurEff->GetAmount()), caster);
            }
Esempio n. 8
0
 void HandleDummy(SpellEffIndex /* effIndex */)
 {
     Unit* caster = GetCaster();
     if (Unit* target = GetHitUnit())
     {
         uint32 count = target->GetDiseasesByCaster(caster->GetGUID());
         int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier)));
         // Improved Death Strike
         if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, ICON_ID_IMPROVED_DEATH_STRIKE, 0))
             AddPctN(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
         caster->CastCustomSpell(caster, SPELL_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false);
     }
 }
Esempio n. 9
0
		void HandleOnHit()
		{
			Unit* caster = GetCaster();
			// Shadow orbs
			if (AuraEffect* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 4941, EFFECT_0))
			{
				uint8 stacks = aurEff->GetBase()->GetStackAmount();
				int32 amount = aurEff->GetAmount() / (2.0f * stacks);
				if (AuraEffect* mastery = caster->GetAuraEffect(77486, EFFECT_0))
					amount += mastery->GetAmount();
				caster->CastCustomSpell(caster, 95799, &amount, &amount, NULL, true);
				aurEff->GetBase()->Remove();
			}
		}
Esempio n. 10
0
            bool CheckProc(ProcEventInfo& eventInfo)
            {
                Unit* caster = eventInfo.GetActor();
                // Prevent double proc for Arcane missiles
                if (caster == eventInfo.GetProcTarget())
                    return false;

                // Proc chance is unknown, we'll just use dummy aura amount
                if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_MAGE_T8_4P_BONUS, EFFECT_0))
                    if (roll_chance_i(aurEff->GetAmount()))
                        return false;

                return true;
            }
Esempio n. 11
0
           void HandleImprovedFreeze()
           {
               if (!_didHit)
                   return;

               Unit* owner = GetCaster()->GetOwner();
               if (!owner)
                   return;

               if (AuraEffect* aurEff = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_MAGE, ICON_MAGE_IMPROVED_FREEZE, EFFECT_0))
               {
                   if (roll_chance_i(aurEff->GetAmount()))
                       owner->CastCustomSpell(SPELL_MAGE_FINGERS_OF_FROST, SPELLVALUE_AURA_STACK, 2, owner, true);
               }
           }
Esempio n. 12
0
            void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
            {
                Unit* target = GetTarget();

                // Master of Subtlety
                if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_ROGUE_MASTER_OF_SUBTLETY_PASSIVE, EFFECT_0))
                {
                    int32 basepoints0 = aurEff->GetAmount();
                    target->CastCustomSpell(target, SPELL_ROGUE_MASTER_OF_SUBTLETY_DAMAGE_PERCENT, &basepoints0, NULL, NULL, true);
                }

                // Overkill
                if (target->HasAura(SPELL_ROGUE_OVERKILL_TALENT))
                    target->CastSpell(target, SPELL_ROGUE_OVERKILL_POWER_REGEN, true);
            }
Esempio n. 13
0
            void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
            {
                Unit* caster = GetCaster();
                Unit* target = GetTarget();

                if(!caster || !caster->ToPlayer() || !target)
                    return;

                if(AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_WARRIOR, WARRIOR_ICON_ID_IMPROVED_HAMSTRING, EFFECT_0))
                {
                    if(!caster->ToPlayer()->HasSpellCooldown(SPELL_WARRIOR_IMPROVED_HAMSTRING))
                    {
                        caster->CastSpell(target, SPELL_WARRIOR_IMPROVED_HAMSTRING, true);
                        caster->ToPlayer()->AddSpellCooldown(SPELL_WARRIOR_IMPROVED_HAMSTRING, NULL, time(NULL) + aurEff->GetAmount());
                    }
                }
            }
Esempio n. 14
0
            void HandleHeal(SpellEffIndex /*effIndex*/)
            {
                Unit* caster = GetCaster();

                if(!caster)
                    return;

                if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_WARRIOR_BLOODTHIRST_DAMAGE))
                {
                    int32 calculatedHeal = CalculatePct(caster->GetMaxHealth(), float(spellInfo->Effects[EFFECT_1].CalcValue(GetCaster())) / 1000);

                    // Field Dressing check
                    if(AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_WARRIOR, 2671, EFFECT_1))
                        AddPct(calculatedHeal, aurEff->GetAmount());

                    SetHitHeal(calculatedHeal);
                }
            }
Esempio n. 15
0
 void HandleDummy(SpellEffIndex /* effIndex */)
 {
     int32 damage = GetEffectValue();
     Unit* caster = GetCaster();
     if (Unit* target = GetHitUnit())
     {
         if (caster->IsFriendlyTo(target))
         {
             int32 bp = int32(damage * 1.5f);
             caster->CastCustomSpell(target, SPELL_DEATH_COIL_HEAL, &bp, NULL, NULL, true);
         }
         else
         {
             if (AuraEffect const* auraEffect = caster->GetAuraEffect(SPELL_SIGIL_VENGEFUL_HEART, EFFECT_1))
                 damage += auraEffect->GetBaseAmount();
             caster->CastCustomSpell(target, SPELL_DEATH_COIL_DAMAGE, &damage, NULL, NULL, true);
         }
     }
 }
Esempio n. 16
0
            void HandleOnCast()
            {
                Unit* caster = GetCaster();

                if(caster && caster->GetPower(POWER_RAGE) > 0)
                {
                    float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK);

                    // Formula taken from the DBC: "${10+$AP*0.437*$m1/100}"
                    damage = int32(10 + ap * 0.437);

                    // Normalized rage (-10 because the execute base cost is not yet applied)
                    uint32 powerAfterBaseCost = caster->GetPower(POWER_RAGE) /10 -10;

                    uint32 extraRage = powerAfterBaseCost > 20 ? 20 : powerAfterBaseCost;
                    uint32 newPowerAmount = powerAfterBaseCost - extraRage;

                    // Sudden Death rage saving
                    if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_WARRIOR, WARRIOR_ICON_ID_SUDDEN_DEATH, EFFECT_0))
                    {
                        if(newPowerAmount < 10)
                        {
                            newPowerAmount = aurEff->GetAmount();
                        }
                    }

                    // Enter if there is extra rage to add as bonus damage
                    if(extraRage > 0)
                    {
                        // Add bonus damage
                        // Formula taken from the DBC: "${$ap*0.874*$m1/100-1} = 20 rage"
                        damage += int32 (ap * 0.874 * extraRage / 10 - 1);
                    }

                    // For remaining at the desidered rage when the warrior will use the base execute cost (10)
                    newPowerAmount += 10;

                    newPowerAmount *= sWorld->getRate(RATE_POWER_RAGE_INCOME);

                    // Sets new rage
                    caster->SetPower(POWER_RAGE, newPowerAmount * 10);
                }
            }
Esempio n. 17
0
            void InitializeAI()
            {
                ScriptedAI::InitializeAI();
                Unit* owner = me->GetOwner();
                if (!owner)
                    return;

                // Xinef: Night of the Dead avoidance
                if (Aura *aur = me->GetAura(SPELL_DK_NIGHT_OF_THE_DEAD))
                    if (Unit* owner = me->GetOwner())
                        if (AuraEffect *aurEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2718, 0))
                            if (aur->GetEffect(0))
                                aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue());

                float tz = me->GetMap()->GetHeight(me->GetPhaseMask(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), true, MAX_FALL_DISTANCE);
                me->GetMotionMaster()->MoveCharge(me->GetPositionX(), me->GetPositionY(), tz, 7.0f, 1);
                me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
                me->SetCanFly(true);
                me->SetDisableGravity(true);
                _selectionTimer = 2000;
                _initialCastTimer = 0;
            }
Esempio n. 18
0
        void ChangeDamage(SpellEffIndex effIndex)
        {
            Unit* caster = GetCaster();
            Unit* target = GetHitUnit();

            if (!target)
                return;

            int32 rageUsed = std::min<int32>(300 - GetSpellInfo()->CalcPowerCost(caster, SpellSchoolMask(GetSpellInfo()->SchoolMask)), caster->GetPower(POWER_RAGE));
            int32 newRage = std::max<int32>(0, caster->GetPower(POWER_RAGE) - rageUsed);
            // Sudden Death rage refund
            if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, ICON_ID_SUDDEN_DEATH, EFFECT_0))
            {
                int32 ragesave = aurEff->GetAmount() * 10;
                newRage = std::max(newRage, ragesave);
            }
            caster->SetPower(POWER_RAGE, uint32(newRage));
            // DBC formula: ap * 0.874 * 100 / 100 - rageUsed
            int32 rageBonus = ((caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.874f) * 1000) / (1000 - rageUsed);
            int32 totalDamage = (GetHitDamage() + rageBonus);
            SetHitDamage(totalDamage);
        }
Esempio n. 19
0
            void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
            {
                PreventDefaultAction();

                Unit* caster = eventInfo.GetActor();
                Unit* target = eventInfo.GetProcTarget();

                // try to find spell Flame Shock on the target
                AuraEffect* flameShock = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, flag128(0x10000000), caster->GetGUID());
                if (!flameShock)
                    return;

                Aura* flameShockAura = flameShock->GetBase();

                int32 maxDuration = flameShockAura->GetMaxDuration();
                int32 newDuration = flameShockAura->GetDuration() + aurEff->GetAmount() * IN_MILLISECONDS;

                flameShockAura->SetDuration(newDuration);
                // is it blizzlike to change max duration for FS?
                if (newDuration > maxDuration)
                    flameShockAura->SetMaxDuration(newDuration);
            }
Esempio n. 20
0
            void HandleDummy(SpellEffIndex /*effIndex*/)
            {
                Unit* caster = GetCaster();
                Unit* target = GetHitUnit();

                int32 bp0 = GetEffectValue();

                if (caster && target)
                {
                    caster->CastCustomSpell(target, SPELL_WARRIOR_SLAM, &bp0, NULL, NULL, true);
                    
                    if(Player* player = caster->ToPlayer())
                    {        
                        if(AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELLFAMILY_WARRIOR, 4975, EFFECT_0))
                        {
                            if(player->IsOneHandUsed(true)
                                || player->IsOneHandUsed(false))
                            {
                                caster->CastCustomSpell(target, SPELL_WARRIOR_SLAM_OFFHAND, &bp0, NULL, NULL, true);
                            }
                        }
                    }
                }
            }
Esempio n. 21
0
bool Guardian::UpdateStats(Stats stat)
{
    if (stat >= MAX_STATS)
        return false;

    // value = ((base_value * base_pct) + total_value) * total_pct
    float value  = GetTotalStatValue(stat);
    ApplyStatBuffMod(stat, m_statFromOwner[stat], false);
    float ownersBonus = 0.0f;

    Unit* owner = GetOwner();
    
    float mod = 0.75f;

    switch (stat)
    {
        case STAT_STRENGTH:
        {
            if (IsPetGhoul())
            {
                mod = 0.7f;
                
                // Glyph of the Ghoul
                if (AuraEffect const* aurEff = owner->GetAuraEffect(58686, 0))
                    mod += CalculatePct(1.0f, aurEff->GetAmount());

                ownersBonus = owner->GetStat(stat) * mod;
                value += ownersBonus;
            }
            break;
        }
        case STAT_STAMINA:
        {
            mod = 0.0f;
            if (IsPetGhoul() || IsPetGargoyle())
            {
                // Glyph of the Ghoul
                if (AuraEffect const* aurEff = owner->GetAuraEffect(58686, 0))
                    mod += CalculatePct(1.0f, aurEff->GetAmount()); 
            }

            ownersBonus = owner->GetStat(stat) * mod;
            ownersBonus *= GetModifierValue(UNIT_MOD_STAT_STAMINA, TOTAL_PCT);
            value += ownersBonus;
            break;
        }
        case STAT_INTELLECT:
        {
            if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
            {
                mod = 0.3f;
                ownersBonus = owner->GetStat(stat) * mod;
            }
            else if (owner->getClass() == CLASS_DEATH_KNIGHT && GetEntry() == 31216)
            {
                mod = 0.3f;
                if (owner->getSimulacrumTarget())
                    ownersBonus = owner->getSimulacrumTarget()->GetStat(stat) * mod;
                else
                    ownersBonus = owner->GetStat(stat) * mod;
            }
            value += ownersBonus;
            break;
        }
    }

    SetStat(stat, int32(value));
    m_statFromOwner[stat] = ownersBonus;
    ApplyStatBuffMod(stat, m_statFromOwner[stat], true);

    switch (stat)
    {
        case STAT_STRENGTH:         UpdateAttackPowerAndDamage();        break;
        case STAT_AGILITY:          UpdateArmor();                       break;
        case STAT_STAMINA:          UpdateMaxHealth();                   break;
        case STAT_INTELLECT:
            UpdateMaxPower(POWER_MANA);
            if (isPet() && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE))
                UpdateAttackPowerAndDamage(); 
            break;
        case STAT_SPIRIT:
        default:
            break;
    }

    return true;
}
Esempio n. 22
0
bool Guardian::UpdateStats(Stats stat)
{
    if (stat >= MAX_STATS)
        return false;

    // value = ((base_value * base_pct) + total_value) * total_pct
    float value  = GetTotalStatValue(stat);
    ApplyStatBuffMod(stat, m_statFromOwner[stat], false);
    float ownersBonus = 0.0f;

    Unit* owner = GetOwner();
    // Handle Death Knight Glyphs and Talents
    float mod = 0.75f;
    if (IsPetGhoul() && (stat == STAT_STAMINA || stat == STAT_STRENGTH))
    {
        switch (stat)
        {
            case STAT_STAMINA:  mod = 0.9f; break;                // Default is 0.48
            case STAT_STRENGTH: mod = 0.7f; break;                // Default Owner's Strength scale
            default: break;
        }

        // Check just if owner has Ravenous Dead since it's effect is not an aura
        AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
        if (aurEff)
        {
            SpellInfo const* spellInfo = aurEff->GetSpellInfo();                                                 // Then get the SpellProto and add the dummy effect value
            AddPct(mod, spellInfo->Effects[EFFECT_1].CalcValue(owner));                                              // Ravenous Dead edits the original scale
        }
        // Glyph of the Ghoul
        aurEff = owner->GetAuraEffect(58686, 0);
        if (aurEff)
            mod += CalculatePct(1.0f, aurEff->GetAmount());                                                    // Glyph of the Ghoul adds a flat value to the scale mod
        ownersBonus = float(owner->GetStat(stat)) * mod;
        value += ownersBonus;
    }
    else if (stat == STAT_STAMINA)
    {
        int pct = 30;

        switch(owner->getClass())
        {
            case CLASS_WARLOCK:
                pct = 75;
                break;
            case CLASS_DEATH_KNIGHT:
                // Ebon Gargoyle
                if(GetEntry() == 27829)
                {
                    pct = 80;
                }
                break;
            case CLASS_MAGE:
                pct = 78;
                break;
            case CLASS_SHAMAN:
                pct = 78;
                break;
            case CLASS_HUNTER:
                pct = 67;
                
                // Looks for creature template
                if(CreatureTemplate const* cinfo = GetCreatureTemplate())
                {
                    // Checks the pet talent type
                    CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(cinfo->family);
                    if (pet_family)
                    {
                        switch(pet_family->petTalentType)
                        {
                            // Ferocity
                            case 0:
                                pct = 67;
                                break;
                            // Tenacity
                            case 1:
                                pct = 78;
                                break;
                            // Cunning
                            case 2:
                                pct = 73;
                                break;
                        }
                    }
                }
                break;
        }

        ownersBonus = CalculatePct(owner->GetStat(STAT_STAMINA) - owner->GetCreateStat(STAT_STAMINA), pct);
        value += ownersBonus;
    }
                                                            //warlock's and mage's pets gain 30% of owner's intellect
    else if (stat == STAT_INTELLECT)
    {
        if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
        {
            ownersBonus = CalculatePct(owner->GetStat(stat), 30);
            value += ownersBonus;
        }
    }
/*
    else if (stat == STAT_STRENGTH)
    {
        if (IsPetGhoul())
            value += float(owner->GetStat(stat)) * 0.3f;
    }
*/

    SetStat(stat, int32(value));
    m_statFromOwner[stat] = ownersBonus;
    ApplyStatBuffMod(stat, m_statFromOwner[stat], true);

    switch (stat)
    {
        case STAT_STRENGTH:         UpdateAttackPowerAndDamage();        break;
        case STAT_AGILITY:          UpdateArmor();                       break;
        case STAT_STAMINA:          UpdateMaxHealth();                   break;
        case STAT_INTELLECT:        UpdateMaxPower(POWER_MANA);          break;
        case STAT_SPIRIT:
        default:
            break;
    }

    return true;
}
Esempio n. 23
0
bool Guardian::UpdateStats(Stats stat)
{
    if (stat >= MAX_STATS)
        return false;

    // value = ((base_value * base_pct) + total_value) * total_pct
    float value  = GetTotalStatValue(stat);
    ApplyStatBuffMod(stat, m_statFromOwner[stat], false);
    float ownersBonus = 0.0f;

    Unit *owner = GetOwner();
    // Handle Death Knight Glyphs and Talents
    float mod = 0.75f;
    if (IsPetGhoul() && (stat == STAT_STAMINA || stat == STAT_STRENGTH))
    {
        switch (stat)
        {
            case STAT_STAMINA:  mod = 0.3f; break;                // Default Owner's Stamina scale
            case STAT_STRENGTH: mod = 0.7f; break;                // Default Owner's Strength scale
            default: break;
        }
        // Ravenous Dead
        AuraEffect const *aurEff = NULL;
        // Check just if owner has Ravenous Dead since it's effect is not an aura
        aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
        if (aurEff)
        {
            SpellInfo const* spellInfo = aurEff->GetSpellInfo();                                                 // Then get the SpellProto and add the dummy effect value
            AddPctN(mod, spellInfo->Effects[EFFECT_1].CalcValue());                                              // Ravenous Dead edits the original scale
        }
        // Glyph of the Ghoul
        aurEff = owner->GetAuraEffect(58686, 0);
        if (aurEff)
            mod += CalculatePctN(1.0f, aurEff->GetAmount());                                                    // Glyph of the Ghoul adds a flat value to the scale mod
        ownersBonus = float(owner->GetStat(stat)) * mod;
        // ownersBonus is multiplied by TOTAL_PCT too
        ownersBonus *= GetModifierValue(UNIT_MOD_STAT_STAMINA, TOTAL_PCT);
        value += ownersBonus;
    }
    else if (stat == STAT_STAMINA)
    {
        if (owner->getClass() == CLASS_WARLOCK && isPet())
        {
            ownersBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75);
            value += ownersBonus;
        }
        else
        {
            mod = 0.45f;
            if (isPet())
            {
                PetSpellMap::const_iterator itr = (ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
                if (itr == ToPet()->m_spells.end())
                    itr = ToPet()->m_spells.find(62762);                            // Wild Hunt rank 2

                if (itr != ToPet()->m_spells.end())                                 // If pet has Wild Hunt
                {
                    SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
                    AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue());
                }
            }
            ownersBonus = float(owner->GetStat(stat)) * mod;
            value += ownersBonus;
        }
    }
                                                            //warlock's and mage's pets gain 30% of owner's intellect
    else if (stat == STAT_INTELLECT)
    {
        if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
        {
            ownersBonus = CalculatePctN(owner->GetStat(stat), 30);
            value += ownersBonus;
        }
    }
/*
    else if (stat == STAT_STRENGTH)
    {
        if (IsPetGhoul())
            value += float(owner->GetStat(stat)) * 0.3f;
    }
*/

    SetStat(stat, int32(value));
    m_statFromOwner[stat] = ownersBonus;
    ApplyStatBuffMod(stat, m_statFromOwner[stat], true);

    switch (stat)
    {
        case STAT_STRENGTH:         UpdateAttackPowerAndDamage();        break;
        case STAT_AGILITY:          UpdateArmor();                       break;
        case STAT_STAMINA:          UpdateMaxHealth();                   break;
        case STAT_INTELLECT:        UpdateMaxPower(POWER_MANA);          break;
        case STAT_SPIRIT:
        default:
            break;
    }

    return true;
}
Esempio n. 24
0
bool Guardian::UpdateStats(Stats stat)
{
    if (stat >= MAX_STATS)
        return false;

    // value = ((base_value * base_pct) + total_value) * total_pct
    float value  = GetTotalStatValue(stat);

    Unit *owner = GetOwner();
    // Handle Death Knight Glyphs and Talents
    if (IsPetGhoul() && (stat == STAT_STAMINA || stat == STAT_STRENGTH))
    { 
        float mod = 0.0f;
        switch (stat)
        {
            case STAT_STAMINA:  mod = 0.3f; break;                // Default Owner's Stamina scale
            case STAT_STRENGTH: mod = 0.7f; break;                // Default Owner's Strength scale
            default: break;
        }
        // Ravenous Dead
        AuraEffect const *aurEff;
        // Check just if owner has Ravenous Dead since it's effect is not an aura
        if (aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0))
        {
            SpellEntry const* sProto = aurEff->GetSpellProto();                                                       // Then get the SpellProto and add the dummy effect value
            mod += mod * (sProto->EffectBasePoints[1] / 100.0f);                                                      // Ravenous Dead edits the original scale
        }
        // Glyph of the Ghoul
        if (aurEff = owner->GetAuraEffect(58686, 0))
            mod += (aurEff->GetAmount() / 100.0f);                                                                    // Glyph of the Ghoul adds a flat value to the scale mod
        value += float(owner->GetStat(stat)) * mod;
    }
    else if (stat == STAT_STAMINA)
    {
        if (owner->getClass() == CLASS_WARLOCK && isPet())
            value += float(owner->GetStat(STAT_STAMINA)) * 0.75f;
        else
            value += float(owner->GetStat(stat)) * 0.3f;
    }
                                                            //warlock's and mage's pets gain 30% of owner's intellect
    else if (stat == STAT_INTELLECT)
    {
        if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
            value += float(owner->GetStat(stat)) * 0.3f;
    }
/*
    else if (stat == STAT_STRENGTH)
    {
        if (IsPetGhoul())
            value += float(owner->GetStat(stat)) * 0.3f;
    }
*/

    SetStat(stat, int32(value));

    switch (stat)
    {
        case STAT_STRENGTH:         UpdateAttackPowerAndDamage();        break;
        case STAT_AGILITY:          UpdateArmor();                       break;
        case STAT_STAMINA:          UpdateMaxHealth();                   break;
        case STAT_INTELLECT:        UpdateMaxPower(POWER_MANA);          break;
        case STAT_SPIRIT:
        default:
            break;
    }

    return true;
}
Esempio n. 25
0
bool Guardian::UpdateStats(Stats stat)
{
    if (stat >= MAX_STATS)
        return false;

    // value = ((base_value * base_pct) + total_value) * total_pct
    float value  = GetTotalStatValue(stat);
    ApplyStatBuffMod(stat, m_statFromOwner[stat], false);
    float ownersBonus = 0.0f;

    Unit* owner = GetOwner();
    // Handle Death Knight Glyphs and Talents
    float mod = 0.75f;
    if (IsPetGhoul() && (stat == STAT_STAMINA || stat == STAT_STRENGTH))
    {
        if (stat == STAT_STAMINA)
            mod = 0.3f; // Default Owner's Stamina scale
        else
            mod = 0.7f; // Default Owner's Strength scale

        // Check just if owner has Ravenous Dead since it's effect is not an aura
        AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
        if (aurEff)
        {
            SpellInfo const* spellInfo = aurEff->GetSpellInfo();                                                 // Then get the SpellProto and add the dummy effect value
            AddPct(mod, spellInfo->Effects[EFFECT_1].CalcValue(owner));                                              // Ravenous Dead edits the original scale
        }
        // Glyph of the Ghoul
        aurEff = owner->GetAuraEffect(58686, 0);
        if (aurEff)
            mod += CalculatePct(1.0f, aurEff->GetAmount());                                                    // Glyph of the Ghoul adds a flat value to the scale mod
        ownersBonus = float(owner->GetStat(stat)) * mod;
        value += ownersBonus;
    }
    else if (stat == STAT_STAMINA)
    {
        ownersBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 30);
        value += ownersBonus;
    }
                                                            //warlock's and mage's pets gain 30% of owner's intellect
    else if (stat == STAT_INTELLECT)
    {
        if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
        {
            ownersBonus = CalculatePct(owner->GetStat(stat), 30);
            value += ownersBonus;
        }
    }
/*
    else if (stat == STAT_STRENGTH)
    {
        if (IsPetGhoul())
            value += float(owner->GetStat(stat)) * 0.3f;
    }
*/

    SetStat(stat, int32(value));
    m_statFromOwner[stat] = ownersBonus;
    ApplyStatBuffMod(stat, m_statFromOwner[stat], true);

    switch (stat)
    {
        case STAT_STRENGTH:         UpdateAttackPowerAndDamage();        break;
        case STAT_AGILITY:          UpdateArmor();                       break;
        case STAT_STAMINA:          UpdateMaxHealth();                   break;
        case STAT_INTELLECT:        UpdateMaxPower(POWER_MANA);          break;
        case STAT_SPIRIT:
        default:
            break;
    }

    return true;
}
Esempio n. 26
0
bool Guardian::UpdateStats(Stats stat)
{
    if (stat >= MAX_STATS)
        return false;

    // value = ((base_value * base_pct) + total_value) * total_pct
    float value  = GetTotalStatValue(stat);
    ApplyStatBuffMod(stat, m_statFromOwner[stat], false);
    float ownersBonus = 0.0f;

    Unit *owner = GetOwner();
    // Handle Death Knight Glyphs and Talents
    float mod = 0.75f;
    if (IsPetGhoul() && (stat == STAT_STAMINA || stat == STAT_STRENGTH))
    {
        switch (stat)
        {
        case STAT_STAMINA:
            mod = 0.3f;
            break;                // Default Owner's Stamina scale
        case STAT_STRENGTH:
            mod = 0.7f;
            break;                // Default Owner's Strength scale
        default:
            break;
        }
        // Ravenous Dead
        AuraEffect const *aurEff = NULL;
        // Check just if owner has Ravenous Dead since it's effect is not an aura
        aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
        if (aurEff)
        {
            SpellEntry const* sProto = aurEff->GetSpellProto();                                                       // Then get the SpellProto and add the dummy effect value
            mod += mod * (SpellMgr::CalculateSpellEffectAmount(sProto, 1) / 100.0f);                                                      // Ravenous Dead edits the original scale
        }
        // Glyph of the Ghoul
        aurEff = owner->GetAuraEffect(58686, 0);
        if (aurEff)
            mod += (aurEff->GetAmount() / 100.0f);                                                                    // Glyph of the Ghoul adds a flat value to the scale mod
        ownersBonus = float(owner->GetStat(stat)) * mod;
        value += ownersBonus;
    }
    else if (stat == STAT_STAMINA)
    {
        if (owner->getClass() == CLASS_WARLOCK && isPet())
        {
            ownersBonus = float(owner->GetStat(STAT_STAMINA)) * 0.75f;
            value += ownersBonus;
        }
        else
        {
            mod = 0.45f;
            if (isPet())
            {
                switch(ToPet()->GetTalentType())
                {
                case PET_TALENT_TYPE_NOT_HUNTER_PET:
                    break;
                case PET_TALENT_TYPE_FEROCITY:
                    mod = 0.67f;
                    break;
                case PET_TALENT_TYPE_TENACITY:
                    mod = 0.78f;
                    break;
                case PET_TALENT_TYPE_CUNNING:
                    mod = 0.725f;
                    break;
                }

                PetSpellMap::const_iterator itr = (ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
                if (itr == ToPet()->m_spells.end())
                    itr = ToPet()->m_spells.find(62762);                            // Wild Hunt rank 2

                if (itr != ToPet()->m_spells.end())                                 // If pet has Wild Hunt
                {
                    SpellEntry const* sProto = sSpellStore.LookupEntry(itr->first); // Then get the SpellProto and add the dummy effect value
                    mod += mod * (SpellMgr::CalculateSpellEffectAmount(sProto, 0) / 100.0f);
                }
            }
            ownersBonus = float(owner->GetStat(stat)) * mod;
            value += ownersBonus;
        }
    }
    //warlock's and mage's pets gain 30% of owner's intellect
    else if (stat == STAT_INTELLECT)
    {
        if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
        {
            ownersBonus = float(owner->GetStat(stat)) * 0.3f;
            value += ownersBonus;
        }
    }
    /*
        else if (stat == STAT_STRENGTH)
        {
            if (IsPetGhoul())
                value += float(owner->GetStat(stat)) * 0.3f;
        }
    */

    SetStat(stat, int32(value));
    m_statFromOwner[stat] = ownersBonus;
    ApplyStatBuffMod(stat, m_statFromOwner[stat], true);

    switch (stat)
    {
    case STAT_STRENGTH:
        UpdateAttackPowerAndDamage();
        break;
    case STAT_AGILITY:
        UpdateArmor();
        break;
    case STAT_STAMINA:
        UpdateMaxHealth();
        break;
    case STAT_INTELLECT:
        UpdateMaxPower(POWER_MANA);
        break;
    case STAT_SPIRIT:
    default:
        break;
    }

    return true;
}