diff --git a/zone/aa.cpp b/zone/aa.cpp index 07adc2805..db765e813 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -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 diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 76ce5195c..13a8130bd 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -1979,10 +1979,17 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const uint32 effectmod = 10; int effectmodcap = 0; - if (RuleB(Character, UseSpellFileSongCap)) + bool nocap = false; + if (RuleB(Character, UseSpellFileSongCap)) { effectmodcap = spells[spell_id].songcap / 10; - else + // this looks a bit weird, but easiest way I could think to keep both systems working + if (effectmodcap == 0) + nocap = true; + else + effectmodcap += 10; + } else { effectmodcap = RuleI(Character, BaseInstrumentSoftCap); + } // this should never use spell modifiers... // if a spell grants better modifers, they are copied into the item mods // because the spells are supposed to act just like having the intrument. @@ -2056,7 +2063,7 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const effectmodcap += aabonuses.songModCap + spellbonuses.songModCap + itembonuses.songModCap; if (effectmod < 10) effectmod = 10; - if (effectmodcap && effectmod > effectmodcap) // if the cap is calculated to be 0 using new rules, no cap. + if (!nocap && effectmod > effectmodcap) // if the cap is calculated to be 0 using new rules, no cap. effectmod = effectmodcap; Log.Out(Logs::Detail, Logs::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id, effectmod, effectmodcap); diff --git a/zone/common.h b/zone/common.h index e9521cb94..0b875456b 100644 --- a/zone/common.h +++ b/zone/common.h @@ -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 diff --git a/zone/spells.cpp b/zone/spells.cpp index 30e3b02d9..0a4dc29b3 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -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...