mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-18 02:22:25 +00:00
Fix issue with AA cast mana consumption
AAs will now cast from slot "0xFF" instead of the itemslot to avoid special behavior of items. Mana reduction also moved down to the same place consumption takes place like live.
This commit is contained in:
parent
337ce2d74b
commit
5a6685d129
@ -1183,12 +1183,12 @@ void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) {
|
||||
|
||||
// Bards can cast instant cast AAs while they are casting another song
|
||||
if(spells[rank->spell].cast_time == 0 && GetClass() == BARD && IsBardSong(casting_spell_id)) {
|
||||
if(!SpellFinished(rank->spell, entity_list.GetMob(target_id), 10, -1, -1, spells[rank->spell].ResistDiff, false)) {
|
||||
if(!SpellFinished(rank->spell, entity_list.GetMob(target_id), ALTERNATE_ABILITY_SPELL_SLOT, spells[rank->spell].mana, -1, spells[rank->spell].ResistDiff, false)) {
|
||||
return;
|
||||
}
|
||||
ExpendAlternateAdvancementCharge(ability->id);
|
||||
} else {
|
||||
if(!CastSpell(rank->spell, target_id, USE_ITEM_SPELL_SLOT, -1, -1, 0, -1, rank->spell_type + pTimerAAStart, cooldown, nullptr, rank->id)) {
|
||||
if(!CastSpell(rank->spell, target_id, ALTERNATE_ABILITY_SPELL_SLOT, -1, -1, 0, -1, rank->spell_type + pTimerAAStart, cooldown, nullptr, rank->id)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1554,7 +1554,7 @@ void Zone::LoadAlternateAdvancement() {
|
||||
// then set it here too
|
||||
//if prev has an aa we have
|
||||
// then set to whichever is highest
|
||||
|
||||
|
||||
auto iter = current->prereqs.find(prev_prereq.first);
|
||||
if(iter == current->prereqs.end()) {
|
||||
//not found
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#define TARGET_RING_SPELL_SLOT 12
|
||||
#define DISCIPLINE_SPELL_SLOT 10
|
||||
#define ABILITY_SPELL_SLOT 9
|
||||
#define ALTERNATE_ABILITY_SPELL_SLOT 0xFF
|
||||
|
||||
//LOS Parameters:
|
||||
#define HEAD_POSITION 0.9f //ratio of GetSize() where NPCs see from
|
||||
|
||||
@ -409,24 +409,19 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
|
||||
// ok now we know the target
|
||||
casting_spell_targetid = target_id;
|
||||
|
||||
if (mana_cost == -1) {
|
||||
// We don't get actual mana cost here, that's done when we consume the mana
|
||||
if (mana_cost == -1)
|
||||
mana_cost = spell.mana;
|
||||
mana_cost = GetActSpellCost(spell_id, mana_cost);
|
||||
}
|
||||
|
||||
if(HasMGB() && spells[spell_id].can_mgb)
|
||||
mana_cost *= 2;
|
||||
|
||||
// mana is checked for clients on the frontend. we need to recheck it for NPCs though
|
||||
// fix: items dont need mana :-/
|
||||
// If you're at full mana, let it cast even if you dont have enough mana
|
||||
|
||||
// we calculated this above, now enforce it
|
||||
if(mana_cost > 0 && slot != 10)
|
||||
if(mana_cost > 0 && slot != USE_ITEM_SPELL_SLOT)
|
||||
{
|
||||
int my_curmana = GetMana();
|
||||
int my_maxmana = GetMaxMana();
|
||||
if(my_curmana < spell.mana) // not enough mana
|
||||
if(my_curmana < mana_cost) // not enough mana
|
||||
{
|
||||
//this is a special case for NPCs with no mana...
|
||||
if(IsNPC() && my_curmana == my_maxmana)
|
||||
@ -2157,11 +2152,11 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
|
||||
}
|
||||
#endif //BOTS
|
||||
|
||||
// We hold off turning MBG off so we can still use it to calc the mana cost
|
||||
if(spells[spell_id].can_mgb && HasMGB())
|
||||
{
|
||||
SpellOnTarget(spell_id, this);
|
||||
entity_list.MassGroupBuff(this, this, spell_id, true);
|
||||
SetMGB(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2262,13 +2257,21 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
|
||||
}
|
||||
|
||||
// if this was a spell slot or an ability use up the mana for it
|
||||
// CastSpell already reduced the cost for it if we're a client with focus
|
||||
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) {
|
||||
mana_used *= 2;
|
||||
SetMGB(false);
|
||||
}
|
||||
// clamp if we some how got focused above our current mana
|
||||
if (GetMana() < mana_used)
|
||||
mana_used = GetMana();
|
||||
Log.Out(Logs::Detail, Logs::Spells, "Spell %d: consuming %d mana", spell_id, mana_used);
|
||||
if (!DoHPToManaCovert(mana_used))
|
||||
if (!DoHPToManaCovert(mana_used)) {
|
||||
SetMana(GetMana() - mana_used);
|
||||
TryTriggerOnValueAmount(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
//set our reuse timer on long ass reuse_time spells...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user