*Furor now stores and restores Energy properly, thanks lobuz

--HG--
branch : trunk
This commit is contained in:
maximius
2009-11-17 20:50:38 -08:00
parent 27d3bf466c
commit d03c14e0b7
2 changed files with 17 additions and 19 deletions
+10 -11
View File
@@ -3522,7 +3522,7 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun
break; break;
} }
if(apply) if (apply)
{ {
// remove other shapeshift before applying a new one // remove other shapeshift before applying a new one
if(m_target->m_ShapeShiftFormSpellId) if(m_target->m_ShapeShiftFormSpellId)
@@ -3535,9 +3535,9 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun
if(PowerType != POWER_MANA) if(PowerType != POWER_MANA)
{ {
uint32 oldVal = m_target->GetPower(PowerType); uint32 oldPower = m_target->GetPower(PowerType);
// reset power to default values only at power change // reset power to default values only at power change
if(m_target->getPowerType()!=PowerType) if(m_target->getPowerType() != PowerType)
m_target->setPowerType(PowerType); m_target->setPowerType(PowerType);
switch(form) switch(form)
@@ -3547,20 +3547,19 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun
case FORM_DIREBEAR: case FORM_DIREBEAR:
{ {
// get furor proc chance // get furor proc chance
int32 FurorChance = 0; uint32 FurorChance = 0;
if(AuraEffect const * dummy = m_target->GetDummyAura(SPELLFAMILY_DRUID, 238, 0)) if (AuraEffect const * dummy = m_target->GetDummyAura(SPELLFAMILY_DRUID, 238, 0))
FurorChance = dummy->GetAmount(); FurorChance = dummy->GetAmount() > 0 ? uint32(dummy->GetAmount()) : 0;
if (GetMiscValue() == FORM_CAT) if (GetMiscValue() == FORM_CAT)
{ {
int32 basePoints = (FurorChance < oldVal ? FurorChance : oldVal); int32 basePoints = int32(std::min(oldPower, FurorChance));
m_target->CastCustomSpell(m_target,17099,&basePoints,NULL,NULL,true,NULL,this); m_target->CastCustomSpell(m_target, 17099, &basePoints, NULL, NULL, true, NULL, this);
} }
else else
{ {
m_target->SetPower(POWER_RAGE,0); uint32 newEnergy = std::min(m_target->GetPower(POWER_ENERGY), FurorChance);
if(urand(1,100) <= FurorChance) m_target->SetPower(POWER_ENERGY, newEnergy);
m_target->CastSpell(m_target,17057,true,NULL,this);
} }
break; break;
} }
+7 -8
View File
@@ -8012,20 +8012,19 @@ void Unit::setPowerType(Powers new_powertype)
case POWER_MANA: case POWER_MANA:
break; break;
case POWER_RAGE: case POWER_RAGE:
SetMaxPower(POWER_RAGE,GetCreatePowers(POWER_RAGE)); SetMaxPower(POWER_RAGE, GetCreatePowers(POWER_RAGE));
SetPower( POWER_RAGE,0); SetPower(POWER_RAGE, 0);
break; break;
case POWER_FOCUS: case POWER_FOCUS:
SetMaxPower(POWER_FOCUS,GetCreatePowers(POWER_FOCUS)); SetMaxPower(POWER_FOCUS, GetCreatePowers(POWER_FOCUS));
SetPower( POWER_FOCUS,GetCreatePowers(POWER_FOCUS)); SetPower(POWER_FOCUS, GetCreatePowers(POWER_FOCUS));
break; break;
case POWER_ENERGY: case POWER_ENERGY:
SetMaxPower(POWER_ENERGY,GetCreatePowers(POWER_ENERGY)); SetMaxPower(POWER_ENERGY, GetCreatePowers(POWER_ENERGY));
SetPower( POWER_ENERGY,0);
break; break;
case POWER_HAPPINESS: case POWER_HAPPINESS:
SetMaxPower(POWER_HAPPINESS,GetCreatePowers(POWER_HAPPINESS)); SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
SetPower(POWER_HAPPINESS,GetCreatePowers(POWER_HAPPINESS)); SetPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
break; break;
} }
} }