mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Implemented buff level restrictions
Higher level buffs can't be cast on lower level toons. The formula was based on information found here: http://samanna.net/eq.general/buffs.shtml This behavior is controlled by the rule Spells:BuffLevelRestrictions which defaults to true.
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
#define ITEM_OUT_OF_CHARGES 182 //Item is out of charges.
|
||||
#define TARGET_NO_MANA 191 //Your target has no mana to affect
|
||||
#define TARGET_GROUP_MEMBER 196 //You must first target a group member.
|
||||
#define SPELL_TOO_POWERFUL 197 //Your spell is too powerful for your intended target.
|
||||
#define INSUFFICIENT_MANA 199 //Insufficient Mana to cast this spell!
|
||||
#define SAC_TOO_LOW 203 //This being is not a worthy sacrifice.
|
||||
#define SAC_TOO_HIGH 204 //This being is too powerful to be a sacrifice.
|
||||
|
||||
@@ -482,6 +482,7 @@ public:
|
||||
int32 GetDotFocus(uint16 spell_id, int32 value);
|
||||
int32 GetActDoTDamage(uint16 spell_id, int32 value);
|
||||
virtual bool CheckFizzle(uint16 spell_id);
|
||||
virtual bool CheckSpellLevelRestriction(uint16 spell_id);
|
||||
virtual int GetCurrentBuffSlots() const;
|
||||
virtual int GetCurrentSongSlots() const;
|
||||
virtual int GetCurrentDiscSlots() const { return 1; }
|
||||
|
||||
@@ -191,6 +191,7 @@ public:
|
||||
virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center,
|
||||
CastAction_type &CastAction);
|
||||
virtual bool CheckFizzle(uint16 spell_id);
|
||||
virtual bool CheckSpellLevelRestriction(uint16 spell_id);
|
||||
virtual bool IsImmuneToSpell(uint16 spell_id, Mob *caster);
|
||||
virtual float GetAOERange(uint16 spell_id);
|
||||
void InterruptSpell(uint16 spellid = SPELL_UNKNOWN);
|
||||
|
||||
@@ -2709,6 +2709,41 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check Spell Level Restrictions
|
||||
// returns true if they meet the restrictions, false otherwise
|
||||
// derived from http://samanna.net/eq.general/buffs.shtml
|
||||
// spells 1-50: no restrictons
|
||||
// 51-65: SpellLevel/2+15
|
||||
// 66+L Group Spells 62, Single Target 61
|
||||
bool Mob::CheckSpellLevelRestriction(uint16 spell_id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Client::CheckSpellLevelRestriction(uint16 spell_id)
|
||||
{
|
||||
int SpellLevel = GetMinLevel(spell_id);
|
||||
|
||||
// Only check for beneficial buffs, if it's a bard song, only if it's short duration
|
||||
if(IsBuffSpell(spell_id) && IsBeneficialSpell(spell_id) &&
|
||||
!(IsBardSong(spell_id) && !IsShortDurationBuff(spell_id)))
|
||||
{
|
||||
if(SpellLevel > 65)
|
||||
{
|
||||
if(IsGroupSpell(spell_id) && GetLevel() < 62)
|
||||
return false;
|
||||
else if(GetLevel() < 61)
|
||||
return false;
|
||||
}
|
||||
else if(SpellLevel > 50) // 51-65
|
||||
{
|
||||
if(GetLevel() < (SpellLevel/2+15))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// returns the slot the buff was added to, -1 if it wasn't added due to
|
||||
// stacking problems, and -2 if this is not a buff
|
||||
@@ -3479,6 +3514,15 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r
|
||||
else if (IsBeneficialSpell(spell_id) && !IsSummonPCSpell(spell_id))
|
||||
entity_list.AddHealAggro(spelltar, this, CheckHealAggroAmount(spell_id, (spelltar->GetMaxHP() - spelltar->GetHP())));
|
||||
|
||||
// make sure spelltar is high enough level for the buff
|
||||
if(RuleB(Spells, BuffLevelRestrictions) && !spelltar->CheckSpellLevelRestriction(spell_id))
|
||||
{
|
||||
mlog(SPELLS__BUFFS, "Spell %d failed: recipient did not meet the level restrictions", spell_id);
|
||||
if(!IsBardSong(spell_id))
|
||||
Message_StringID(MT_SpellFailure, SPELL_TOO_POWERFUL);
|
||||
return false;
|
||||
}
|
||||
|
||||
// cause the effects to the target
|
||||
if(!spelltar->SpellEffect(this, spell_id, spell_effectiveness))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user