Core/Vehicles: Fixed power issues

* Regenerate powers only if vehicle has UNIT_FLAG2_REGENERATE_POWER
* Removed old pyrite power hack
* Apply creature_template.ManaMod to all power types

Closes #12141
This commit is contained in:
Shauren committed 2014-06-14 17:09:35 +02:00
1 parent e9c9e36265
commit 08edc7d630
3 files changed
+19 -10

No files matched your search

@@ -567,13 +567,13 @@ void Creature::Update(uint32 diff)
if (!IsInEvadeMode() && (!bInCombat || IsPolymorphed())) // regenerate health if not in combat or if polymorphed
RegenerateHealth();
if (getPowerType() == POWER_ENERGY)
if (HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER))
{
if (!IsVehicle() || GetVehicleKit()->GetVehicleInfo()->m_powerDisplayId != POWER_PYRITE)
if (getPowerType() == POWER_ENERGY)
Regenerate(POWER_ENERGY);
else
RegenerateMana();
}
else
RegenerateMana();
/*if (!bIsPolymorphed) // only increase the timer if not polymorphed
m_regenTimer += CREATURE_REGEN_INTERVAL - diff;
+11 -6
View File
@@ -8645,25 +8645,30 @@ void Unit::setPowerType(Powers new_powertype)
}
}
float powerMultiplier = 1.0f;
if (!IsPet())
if (Creature* creature = ToCreature())
powerMultiplier = creature->GetCreatureTemplate()->ModMana;
switch (new_powertype)
{
default:
case POWER_MANA:
break;
case POWER_RAGE:
SetMaxPower(POWER_RAGE, GetCreatePowers(POWER_RAGE));
SetMaxPower(POWER_RAGE, uint32(std::ceilf(GetCreatePowers(POWER_RAGE) * powerMultiplier)));
SetPower(POWER_RAGE, 0);
break;
case POWER_FOCUS:
SetMaxPower(POWER_FOCUS, GetCreatePowers(POWER_FOCUS));
SetPower(POWER_FOCUS, GetCreatePowers(POWER_FOCUS));
SetMaxPower(POWER_FOCUS, uint32(std::ceilf(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
SetPower(POWER_FOCUS, uint32(std::ceilf(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
break;
case POWER_ENERGY:
SetMaxPower(POWER_ENERGY, GetCreatePowers(POWER_ENERGY));
SetMaxPower(POWER_ENERGY, uint32(std::ceilf(GetCreatePowers(POWER_ENERGY) * powerMultiplier)));
break;
case POWER_HAPPINESS:
SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
SetPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
SetMaxPower(POWER_HAPPINESS, uint32(std::ceilf(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
SetPower(POWER_HAPPINESS, uint32(std::ceilf(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
break;
}
}
@@ -77,8 +77,12 @@ Vehicle::~Vehicle()
void Vehicle::Install()
{
if (_me->GetTypeId() == TYPEID_UNIT)
{
if (PowerDisplayEntry const* powerDisplay = sPowerDisplayStore.LookupEntry(_vehicleInfo->m_powerDisplayId))
_me->setPowerType(Powers(powerDisplay->PowerType));
else if (_me->getClass() == CLASS_ROGUE)
_me->setPowerType(POWER_ENERGY);
}
_status = STATUS_INSTALLED;
if (GetBase()->GetTypeId() == TYPEID_UNIT)