aboutsummaryrefslogtreecommitdiff
path: root/src/game/Pet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Pet.cpp')
-rw-r--r--src/game/Pet.cpp125
1 files changed, 57 insertions, 68 deletions
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index d1345b7079d..59d02af930a 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -770,6 +770,7 @@ bool Guardian::InitStatsForLevel(uint32 petlevel)
SetLevel(petlevel);
+ //Determine pet type
PetType petType = MAX_PET_TYPE;
if(HasSummonMask(SUMMON_MASK_PET) && m_owner->GetTypeId() == TYPEID_PLAYER)
{
@@ -793,6 +794,7 @@ bool Guardian::InitStatsForLevel(uint32 petlevel)
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0);
+ //scale
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family);
if(cFamily && cFamily->minScale > 0.0f && petType==HUNTER_PET)
{
@@ -806,10 +808,9 @@ bool Guardian::InitStatsForLevel(uint32 petlevel)
SetFloatValue(OBJECT_FIELD_SCALE_X, scale);
}
- m_bonusdamage = 0;
+ //resistance
int32 createResistance[MAX_SPELL_SCHOOL] = {0,0,0,0,0,0,0};
-
if(cinfo && petType != HUNTER_PET)
{
createResistance[SPELL_SCHOOL_HOLY] = cinfo->resistance1;
@@ -819,7 +820,37 @@ bool Guardian::InitStatsForLevel(uint32 petlevel)
createResistance[SPELL_SCHOOL_SHADOW] = cinfo->resistance5;
createResistance[SPELL_SCHOOL_ARCANE] = cinfo->resistance6;
}
+ for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
+ SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i]));
+
+ //health, mana, armor and resistance
+ PetLevelInfo const* pInfo = objmgr.GetPetLevelInfo(creature_ID, petlevel);
+ if(pInfo) // exist in DB
+ {
+ SetCreateHealth(pInfo->health);
+ if(petType != HUNTER_PET) //hunter pet use focus
+ SetCreateMana(pInfo->mana);
+
+ if(pInfo->armor > 0)
+ SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(pInfo->armor));
+
+ for(int stat = 0; stat < MAX_STATS; ++stat)
+ SetCreateStat(Stats(stat), float(pInfo->stats[stat]));
+ }
+ else // not exist in DB, use some default fake data
+ {
+ // remove elite bonuses included in DB values
+ //SetCreateHealth(uint32(((float(cinfo->maxhealth) / cinfo->maxlevel) / (1 + 2 * cinfo->rank)) * petlevel) );
+ //SetCreateMana( uint32(((float(cinfo->maxmana) / cinfo->maxlevel) / (1 + 2 * cinfo->rank)) * petlevel) );
+
+ SetCreateStat(STAT_STRENGTH, 22);
+ SetCreateStat(STAT_AGILITY, 22);
+ SetCreateStat(STAT_STAMINA, 25);
+ SetCreateStat(STAT_INTELLECT, 28);
+ SetCreateStat(STAT_SPIRIT, 27);
+ }
+ m_bonusdamage = 0;
switch(petType)
{
case SUMMON_PET:
@@ -835,35 +866,6 @@ bool Guardian::InitStatsForLevel(uint32 petlevel)
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)) );
//SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, float(cinfo->attackpower));
-
- PetLevelInfo const* pInfo = objmgr.GetPetLevelInfo(creature_ID, petlevel);
- if(pInfo) // exist in DB
- {
- SetCreateHealth(pInfo->health);
- SetCreateMana(pInfo->mana);
-
- if(pInfo->armor > 0)
- SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(pInfo->armor));
-
- for(int stat = 0; stat < MAX_STATS; ++stat)
- {
- SetCreateStat(Stats(stat), float(pInfo->stats[stat]));
- }
- }
- else // not exist in DB, use some default fake data
- {
- sLog.outErrorDb("Summoned pet (Entry: %u) not have pet stats data in DB",cinfo->Entry);
-
- // remove elite bonuses included in DB values
- SetCreateHealth(uint32(((float(cinfo->maxhealth) / cinfo->maxlevel) / (1 + 2 * cinfo->rank)) * petlevel) );
- SetCreateMana( uint32(((float(cinfo->maxmana) / cinfo->maxlevel) / (1 + 2 * cinfo->rank)) * petlevel) );
-
- SetCreateStat(STAT_STRENGTH, 22);
- SetCreateStat(STAT_AGILITY, 22);
- SetCreateStat(STAT_STAMINA, 25);
- SetCreateStat(STAT_INTELLECT, 28);
- SetCreateStat(STAT_SPIRIT, 27);
- }
break;
}
case HUNTER_PET:
@@ -875,36 +877,10 @@ bool Guardian::InitStatsForLevel(uint32 petlevel)
//damage range is then petlevel / 2
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)) );
//damage is increased afterwards as strength and pet scaling modify attack power
-
- //stored standard pet stats are entry 1 in pet_levelinfo
- PetLevelInfo const* pInfo = objmgr.GetPetLevelInfo(creature_ID, petlevel);
- if(pInfo) // exist in DB
- {
- SetCreateHealth(pInfo->health);
- SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(pInfo->armor));
- //SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, float(cinfo->attackpower));
-
- for( int i = STAT_STRENGTH; i < MAX_STATS; i++)
- {
- SetCreateStat(Stats(i), float(pInfo->stats[i]));
- }
- }
- else // not exist in DB, use some default fake data
- {
- sLog.outErrorDb("Hunter pet levelstats missing in DB");
-
- // remove elite bonuses included in DB values
- SetCreateHealth( uint32(((float(cinfo->maxhealth) / cinfo->maxlevel) / (1 + 2 * cinfo->rank)) * petlevel) );
-
- SetCreateStat(STAT_STRENGTH, 22);
- SetCreateStat(STAT_AGILITY, 22);
- SetCreateStat(STAT_STAMINA, 25);
- SetCreateStat(STAT_INTELLECT, 28);
- SetCreateStat(STAT_SPIRIT, 27);
- }
break;
}
default:
+ {
switch(GetEntry())
{
case 510: // mage Water Elemental
@@ -917,24 +893,39 @@ bool Guardian::InitStatsForLevel(uint32 petlevel)
break;
}
case 1964: //force of nature
- SetCreateHealth(30 + 30*petlevel);
+ {
+ if(!pInfo)
+ SetCreateHealth(30 + 30*petlevel);
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 2.5f - (petlevel / 2)));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 2.5f + (petlevel / 2)));
break;
+ }
case 15352: //earth elemental 36213
- SetCreateHealth(100 + 120*petlevel);
+ {
+ if(!pInfo)
+ SetCreateHealth(100 + 120*petlevel);
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)));
break;
+ }
case 15438: //fire elemental
- SetCreateHealth(40*petlevel);
- SetCreateMana(28 + 10*petlevel);
+ {
+ if(!pInfo)
+ {
+ SetCreateHealth(40*petlevel);
+ SetCreateMana(28 + 10*petlevel);
+ }
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 4 - petlevel));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 4 + petlevel));
break;
+ }
default:
- SetCreateMana(28 + 10*petlevel);
- SetCreateHealth(28 + 30*petlevel);
+ {
+ if(!pInfo)
+ {
+ 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
@@ -942,14 +933,12 @@ bool Guardian::InitStatsForLevel(uint32 petlevel)
//damage range is then petlevel / 2
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)));
break;
+ }
}
- //sLog.outError("Pet have incorrect type (%u) for levelup.", petType);
break;
+ }
}
- for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
- SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i]));
-
UpdateAllStats();
SetHealth(GetMaxHealth());