mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 00:01:28 +00:00
Merge pull request #288 from KayenEQ/Development
optimization for how do endurance upkeep for discs
This commit is contained in:
commit
dd869695c4
@ -1928,16 +1928,21 @@ void Client::DoEnduranceRegen()
|
||||
}
|
||||
|
||||
void Client::DoEnduranceUpkeep() {
|
||||
|
||||
if (!HasEndurUpkeep())
|
||||
return;
|
||||
|
||||
int upkeep_sum = 0;
|
||||
|
||||
int cost_redux = spellbonuses.EnduranceReduction + itembonuses.EnduranceReduction;
|
||||
|
||||
int cost_redux = spellbonuses.EnduranceReduction + itembonuses.EnduranceReduction + aabonuses.EnduranceReduction;
|
||||
|
||||
bool has_effect = false;
|
||||
uint32 buffs_i;
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (buffs_i = 0; buffs_i < buff_count; buffs_i++) {
|
||||
if (buffs[buffs_i].spellid != SPELL_UNKNOWN) {
|
||||
int upkeep = spells[buffs[buffs_i].spellid].EndurUpkeep;
|
||||
if(upkeep > 0) {
|
||||
has_effect = true;
|
||||
if(cost_redux > 0) {
|
||||
if(upkeep <= cost_redux)
|
||||
continue; //reduced to 0
|
||||
@ -1957,6 +1962,9 @@ void Client::DoEnduranceUpkeep() {
|
||||
SetEndurance(GetEndurance() - upkeep_sum);
|
||||
TryTriggerOnValueAmount(false, false, true);
|
||||
}
|
||||
|
||||
if (!has_effect)
|
||||
SetEndurUpkeep(false);
|
||||
}
|
||||
|
||||
void Client::CalcRestState() {
|
||||
|
||||
@ -1160,16 +1160,21 @@ void Merc::SetEndurance(int32 newEnd)
|
||||
}
|
||||
|
||||
void Merc::DoEnduranceUpkeep() {
|
||||
int upkeep_sum = 0;
|
||||
|
||||
if (!HasEndurUpkeep())
|
||||
return;
|
||||
|
||||
int upkeep_sum = 0;
|
||||
int cost_redux = spellbonuses.EnduranceReduction + itembonuses.EnduranceReduction;
|
||||
|
||||
bool has_effect = false;
|
||||
uint32 buffs_i;
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (buffs_i = 0; buffs_i < buff_count; buffs_i++) {
|
||||
if (buffs[buffs_i].spellid != SPELL_UNKNOWN) {
|
||||
int upkeep = spells[buffs[buffs_i].spellid].EndurUpkeep;
|
||||
if(upkeep > 0) {
|
||||
has_effect = true;
|
||||
if(cost_redux > 0) {
|
||||
if(upkeep <= cost_redux)
|
||||
continue; //reduced to 0
|
||||
@ -1187,6 +1192,9 @@ void Merc::DoEnduranceUpkeep() {
|
||||
|
||||
if(upkeep_sum != 0)
|
||||
SetEndurance(GetEndurance() - upkeep_sum);
|
||||
|
||||
if (!has_effect)
|
||||
SetEndurUpkeep(false);
|
||||
}
|
||||
|
||||
void Merc::CalcRestState() {
|
||||
|
||||
@ -391,6 +391,7 @@ Mob::Mob(const char* in_name,
|
||||
for (int i = 0; i < HIGHEST_RESIST+2; i++) { Vulnerability_Mod[i] = 0; }
|
||||
|
||||
emoteid = 0;
|
||||
endur_upkeep = false;
|
||||
}
|
||||
|
||||
Mob::~Mob()
|
||||
|
||||
@ -290,6 +290,8 @@ public:
|
||||
inline float GetTargetRingX() const { return targetring_x; }
|
||||
inline float GetTargetRingY() const { return targetring_y; }
|
||||
inline float GetTargetRingZ() const { return targetring_z; }
|
||||
inline bool HasEndurUpkeep() const { return endur_upkeep; }
|
||||
inline void SetEndurUpkeep(bool val) { endur_upkeep = val; }
|
||||
|
||||
//Basic Stats/Inventory
|
||||
virtual void SetLevel(uint8 in_level, bool command = false) { level = in_level; }
|
||||
@ -1130,6 +1132,7 @@ protected:
|
||||
int16 SpellPowerDistanceMod;
|
||||
bool last_los_check;
|
||||
bool pseudo_rooted;
|
||||
bool endur_upkeep;
|
||||
|
||||
// Bind wound
|
||||
Timer bindwound_timer;
|
||||
|
||||
@ -130,6 +130,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
|
||||
buffs[buffslot].magic_rune = 0;
|
||||
buffs[buffslot].numhits = 0;
|
||||
|
||||
if (spells[spell_id].EndurUpkeep > 0)
|
||||
SetEndurUpkeep(true);
|
||||
|
||||
if(IsClient() && CastToClient()->GetClientVersionBit() & BIT_UnderfootAndLater)
|
||||
{
|
||||
EQApplicationPacket *outapp = MakeBuffsPacket(false);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user