Fix MGB not always turning off and make it work for discs

This commit is contained in:
Michael Cook (mackal) 2015-10-14 16:36:38 -04:00
parent 98bc7f0ccd
commit efeb80cc8b
3 changed files with 16 additions and 6 deletions

View File

@ -626,10 +626,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
return(false);
}
if(GetEndurance() > spell.EndurCost) {
SetEndurance(GetEndurance() - spell.EndurCost);
TryTriggerOnValueAmount(false, false, true);
} else {
if(GetEndurance() < spell.EndurCost) {
Message(11, "You are too fatigued to use this skill right now.");
return(false);
}

View File

@ -425,6 +425,8 @@ public:
virtual int32 CalcMaxHP();
inline int32 GetMaxMana() const { return max_mana; }
inline int32 GetMana() const { return cur_mana; }
virtual int32 GetEndurance() const { return 0; }
virtual void SetEndurance(int32 newEnd) { return; }
int32 GetItemHPBonuses();
int32 GetSpellHPBonuses();
virtual const int32& SetMana(int32 amount);

View File

@ -75,6 +75,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include "../common/skills.h"
#include "../common/spdat.h"
#include "../common/string_util.h"
#include "../common/data_verification.h"
#include "quest_parser_collection.h"
#include "string_ids.h"
@ -2248,13 +2249,13 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
}
}
bool mgb = HasMGB() && spells[spell_id].can_mgb;
// if this was a spell slot or an ability use up the mana for it
if(slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && slot != TARGET_RING_SPELL_SLOT && mana_used > 0)
{
mana_used = GetActSpellCost(spell_id, mana_used);
if (HasMGB() && spells[spell_id].can_mgb) {
if (mgb) {
mana_used *= 2;
SetMGB(false);
}
// clamp if we some how got focused above our current mana
if (GetMana() < mana_used)
@ -2265,6 +2266,16 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
TryTriggerOnValueAmount(false, true);
}
}
// one may want to check if this is a disc or not, but we actually don't, there are non disc stuff that have end cost
if (spells[spell_id].EndurCost) {
auto end_cost = spells[spell_id].EndurCost;
if (mgb)
end_cost *= 2;
SetEndurance(GetEndurance() - EQEmu::ClampUpper(end_cost, GetEndurance()));
TryTriggerOnValueAmount(false, false, true);
}
if (mgb)
SetMGB(false);
//set our reuse timer on long ass reuse_time spells...
if(IsClient() && !isproc)