mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Revert "Core/Creatures: merged a change regarding energy regeneration"
This reverts commit 374a405321.
This commit is contained in:
@@ -186,11 +186,9 @@ m_lootRecipient(), m_lootRecipientGroup(0), _skinner(), _pickpocketLootRestore(0
|
||||
m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_boundaryCheckTime(2500), m_combatPulseTime(0), m_combatPulseDelay(0), m_reactState(REACT_AGGRESSIVE),
|
||||
m_defaultMovementType(IDLE_MOTION_TYPE), m_spawnId(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false),
|
||||
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_cannotReachTarget(false), m_cannotReachTimer(0), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
|
||||
m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), m_waypointID(0), m_path_id(0), m_formation(nullptr), m_focusSpell(nullptr),
|
||||
m_focusDelay(0), m_shouldReacquireTarget(false), m_suppressedOrientation(0.0f), m_tmpEnergyReg(0.0f)
|
||||
m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), m_waypointID(0), m_path_id(0), m_formation(nullptr), m_focusSpell(nullptr), m_focusDelay(0), m_shouldReacquireTarget(false), m_suppressedOrientation(0.0f)
|
||||
{
|
||||
m_regenTimer = CREATURE_REGEN_INTERVAL;
|
||||
m_regenTimerEnergy = CREATURE_REGEN_ENERGY_INTERVAL;
|
||||
m_valuesCount = UNIT_END;
|
||||
|
||||
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
||||
@@ -688,16 +686,6 @@ void Creature::Update(uint32 diff)
|
||||
m_regenTimer -= diff;
|
||||
}
|
||||
|
||||
if (m_regenTimerEnergy <= diff)
|
||||
{
|
||||
if (getPowerType() == POWER_ENERGY)
|
||||
if (!IsVehicle() || GetVehicleKit()->GetVehicleInfo()->m_powerDisplayId != POWER_PYRITE)
|
||||
Regenerate(POWER_ENERGY);
|
||||
m_regenTimerEnergy = CREATURE_REGEN_ENERGY_INTERVAL;
|
||||
}
|
||||
else
|
||||
m_regenTimerEnergy -= diff;
|
||||
|
||||
if (m_regenTimer == 0)
|
||||
{
|
||||
bool bInCombat = IsInCombat() && (!GetVictim() || // if IsInCombat() is true and this has no victim
|
||||
@@ -708,9 +696,12 @@ void Creature::Update(uint32 diff)
|
||||
RegenerateHealth();
|
||||
|
||||
if (HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER))
|
||||
if (getPowerType() != POWER_ENERGY)
|
||||
{
|
||||
if (getPowerType() == POWER_ENERGY)
|
||||
Regenerate(POWER_ENERGY);
|
||||
else
|
||||
RegenerateMana();
|
||||
|
||||
}
|
||||
m_regenTimer = CREATURE_REGEN_INTERVAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,6 @@ enum CreatureFlagsExtra : uint32
|
||||
};
|
||||
|
||||
const uint32 CREATURE_REGEN_INTERVAL = 2 * IN_MILLISECONDS;
|
||||
const uint32 CREATURE_REGEN_ENERGY_INTERVAL = 100;
|
||||
const uint32 CREATURE_NOPATH_EVADE_TIME = 5 * IN_MILLISECONDS;
|
||||
|
||||
const uint8 MAX_KILL_CREDIT = 2;
|
||||
@@ -805,8 +804,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
uint32 m_waypointID;
|
||||
uint32 m_path_id;
|
||||
|
||||
float m_tmpEnergyReg;
|
||||
|
||||
//Formation var
|
||||
CreatureGroup* m_formation;
|
||||
bool m_TriggerJustRespawned;
|
||||
|
||||
@@ -655,32 +655,14 @@ void Creature::Regenerate(Powers power)
|
||||
}
|
||||
|
||||
// Apply modifiers (if any).
|
||||
float modifier = 0.0f;
|
||||
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
|
||||
if (Powers((*i)->GetMiscValue()) == power)
|
||||
modifier += (*i)->GetAmount();
|
||||
AddPct(addvalue, (*i)->GetAmount());
|
||||
|
||||
if (modifier)
|
||||
AddPct(addvalue, modifier);
|
||||
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, power) * (IsHunterPet()? PET_FOCUS_REGEN_INTERVAL : CREATURE_REGEN_INTERVAL) / (5 * IN_MILLISECONDS);
|
||||
|
||||
if (power != POWER_ENERGY)
|
||||
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, power) * (IsHunterPet() ? PET_FOCUS_REGEN_INTERVAL : CREATURE_REGEN_INTERVAL) / (5 * IN_MILLISECONDS);
|
||||
else
|
||||
addvalue += (float)GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, power) * ((float)CREATURE_REGEN_INTERVAL / 5140.0f);
|
||||
|
||||
if (power == POWER_ENERGY)
|
||||
{
|
||||
m_tmpEnergyReg += std::min((float)CREATURE_REGEN_ENERGY_INTERVAL * addvalue / CREATURE_REGEN_INTERVAL, 10.0f);
|
||||
int32 enerReg = int32(m_tmpEnergyReg);
|
||||
if (enerReg)
|
||||
{
|
||||
ModifyPower(power, enerReg);
|
||||
m_tmpEnergyReg = fmod(m_tmpEnergyReg, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
ModifyPower(power, int32(addvalue));
|
||||
ModifyPower(power, int32(addvalue));
|
||||
}
|
||||
|
||||
void Pet::Remove(PetSaveMode mode, bool returnreagent)
|
||||
|
||||
@@ -2296,7 +2296,6 @@ class TC_GAME_API Unit : public WorldObject
|
||||
|
||||
uint32 m_reactiveTimer[MAX_REACTIVE];
|
||||
uint32 m_regenTimer;
|
||||
uint32 m_regenTimerEnergy;
|
||||
|
||||
ThreatManager m_ThreatManager;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user