Jump to content

[patch] Few bonuses for summoned guardians/pets.


Auntie Mangos

Recommended Posts

What bug does the patch fix? What features does the patch add?

- Adding some proper bonuses into Pet::InitStatsForLevel() for few summons.

NOTE: some of those not yet fully supported by the core.

This used to be part of http://getmangos.eu/community/viewtopic.php?id=10150 split due to request.

For which repository revision was the patch created?

8526

Who has been writing this patch? Please include either forum user names or email addresses.

Me

Patch:

diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 3581c45..2bbd2bd 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -855,38 +855,45 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner)
    {
        case SUMMON_PET:
        {
-            if(owner->GetTypeId() == TYPEID_PLAYER)
+            if(owner->getClass() == CLASS_WARLOCK)
            {
-                switch(owner->getClass())
-                {
-                    case CLASS_WARLOCK:
-                    {
+                //the damage bonus used for pets is either fire or shadow damage, whatever is higher
+                uint32 fire  = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE);
+                uint32 shadow = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW);
+                uint32 val  = (fire > shadow) ? fire : shadow;

-                        //the damage bonus used for pets is either fire or shadow damage, whatever is higher
-                        uint32 fire  = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE);
-                        uint32 shadow = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW);
-                        uint32 val  = (fire > shadow) ? fire : shadow;
+                SetBonusDamage(int32 (val * 0.15f));
+                //bonusAP += val * 0.57;
+            }

-                        SetBonusDamage(int32 (val * 0.15f));
-                        //bonusAP += val * 0.57;
-                        break;
-                    }
-                    case CLASS_MAGE:
-                    {
-                                                            //40% damage bonus of mage's frost damage
-                        float val = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.4;
-                        if(val < 0)
-                            val = 0;
-                        SetBonusDamage( int32(val));
-                        break;
-                    }
-                    default:
-                        break;
+            switch(GetEntry())
+            {
+                case 510: // Water Elemental
+                {
+                    //40% damage bonus of mage's frost damage
+                    float val = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.4f;
+                    if(val < 0)
+                        val = 0;
+                    SetBonusDamage(int32(val));
+                    break;
                }
-            }
+                case 19668: // Shadowfiend
+                {
+                    //6% damage bonus of priest's shadow damage
+                    float val = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW) * 0.06f;
+                    if(val < 0)
+                        val = 0;

-            SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)) );
-            SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)) );
+                    SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4) + val) );
+                    SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4) + val) );
+                    break;
+                }
+                default:
+                    SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)) );
+                    SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)) );
+                    break;
+            }

            //SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, float(cinfo->attackpower));

@@ -959,18 +966,50 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner)
            break;
        }
        case GUARDIAN_PET:
+
+            switch(GetEntry())
+            {
+                // Force of Nature -- TODO : move to pet after fixed, it should not be guardian
+                case 1964:
+                {
+                    float val = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_NATURE) * 0.035f;
+                    if(val < 0)
+                        val = 0;
+
+                    SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4) + val) );
+                    SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4) + val) );
+                    break;
+                }
+                case 31216: // Mirror Image
+                {
+                    //33% damage bonus of mage's frost damage
+                    float val = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.33f;
+                    if(val < 0)
+                        val = 0;
+                    SetBonusDamage(int32(val));
+                    break;
+                }
+                case 27829: // Ebon Gargoyle
+                {
+                    // 40% AP
+                    float val = owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.4f;
+                    if(val < 0)
+                        val = 0;
+                    SetBonusDamage(int32(val));
+                    break;
+                }
+                default:
+                    SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)));
+                    SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)));
+                break;
+            }
+
            SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
            SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);

            SetCreateMana(28 + 10*petlevel);
            SetCreateHealth(28 + 30*petlevel);

-            // FIXME: this is wrong formula, possible each guardian pet have own damage formula
-            //these formula may not be correct; however, it is designed to be close to what it should be
-            //this makes dps 0.5 of pets level
-            SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)));
-            //damage range is then petlevel / 2
-            SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)));
            break;
        default:
            sLog.outError("Pet have incorrect type (%u) for levelup.", getPetType());

Link to comment
Share on other sites

  • 39 years later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use