[7785] Allow regenerate energy for pets if this current power type. Author: Astellar
--HG-- branch : trunk
This commit is contained in:
+38
-11
@@ -565,18 +565,26 @@ void Pet::Update(uint32 diff)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getPetType() != HUNTER_PET)
|
//regenerate focus for hunter pets or energy for deathknight's ghoul
|
||||||
break;
|
|
||||||
|
|
||||||
//regenerate Focus
|
|
||||||
if(m_regenTimer <= diff)
|
if(m_regenTimer <= diff)
|
||||||
{
|
{
|
||||||
RegenerateFocus();
|
switch (getPowerType())
|
||||||
|
{
|
||||||
|
case POWER_FOCUS:
|
||||||
|
case POWER_ENERGY:
|
||||||
|
Regenerate(getPowerType());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
m_regenTimer = 4000;
|
m_regenTimer = 4000;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_regenTimer -= diff;
|
m_regenTimer -= diff;
|
||||||
|
|
||||||
|
if(getPetType() != HUNTER_PET)
|
||||||
|
break;
|
||||||
|
|
||||||
if(m_happinessTimer <= diff)
|
if(m_happinessTimer <= diff)
|
||||||
{
|
{
|
||||||
LooseHappiness();
|
LooseHappiness();
|
||||||
@@ -593,22 +601,41 @@ void Pet::Update(uint32 diff)
|
|||||||
Creature::Update(diff);
|
Creature::Update(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pet::RegenerateFocus()
|
void Pet::Regenerate(Powers power)
|
||||||
{
|
{
|
||||||
uint32 curValue = GetPower(POWER_FOCUS);
|
uint32 curValue = GetPower(power);
|
||||||
uint32 maxValue = GetMaxPower(POWER_FOCUS);
|
uint32 maxValue = GetMaxPower(power);
|
||||||
|
|
||||||
if (curValue >= maxValue)
|
if (curValue >= maxValue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float addvalue = 24 * sWorld.getRate(RATE_POWER_FOCUS);
|
float addvalue = 0.0f;
|
||||||
|
|
||||||
|
switch (power)
|
||||||
|
{
|
||||||
|
case POWER_FOCUS:
|
||||||
|
{
|
||||||
|
// For hunter pets.
|
||||||
|
addvalue = 24 * sWorld.getRate(RATE_POWER_FOCUS);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case POWER_ENERGY:
|
||||||
|
{
|
||||||
|
// For deathknight's ghoul.
|
||||||
|
addvalue = 20;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply modifiers (if any).
|
||||||
AuraEffectList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
AuraEffectList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
||||||
for(AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
|
for(AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
|
||||||
if ((*i)->GetMiscValue() == POWER_FOCUS)
|
if ((*i)->GetMiscValue() == power)
|
||||||
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
|
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
|
||||||
|
|
||||||
ModifyPower(POWER_FOCUS, (int32)addvalue);
|
ModifyPower(power, (int32)addvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pet::LooseHappiness()
|
void Pet::LooseHappiness()
|
||||||
|
|||||||
+1
-1
@@ -159,7 +159,7 @@ class Pet : public Guardian
|
|||||||
return m_autospells[pos];
|
return m_autospells[pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegenerateFocus();
|
void Regenerate(Powers power);
|
||||||
void LooseHappiness();
|
void LooseHappiness();
|
||||||
HappinessState GetHappinessState();
|
HappinessState GetHappinessState();
|
||||||
void GivePetXP(uint32 xp);
|
void GivePetXP(uint32 xp);
|
||||||
|
|||||||
Reference in New Issue
Block a user