[Spells] Major update to cast restriction code and new spell field 'caster_requirement_id' (field220) implemented (#1508)

* Implemented spells_new table 'field220' as 'caster_requirement_id'

Implemented spells_new table 'field220' as 'caster_requirement_id'

* Update spell_effects.cpp

* updates to CastRestriction

enum using live description
updated entire function
missing and new types added
many fixes

* updates

* code fixes

* updates

* updates

* Update spdat.h

* typo fix
This commit is contained in:
KayenEQ
2021-08-31 01:41:20 -04:00
committed by GitHub
parent 5f3c054044
commit cb3f8daedd
7 changed files with 1242 additions and 292 deletions
+1
View File
@@ -5903,6 +5903,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot)
else if (id == "rank") {return spells[spell_id].rank; }
else if (id == "no_resist") {return spells[spell_id].no_resist; }
else if (id == "CastRestriction") {return spells[spell_id].CastRestriction; }
else if (id == "caster_requirement_id") { return spells[spell_id].caster_requirement_id; }
else if (id == "AllowRest") {return spells[spell_id].AllowRest; }
else if (id == "InCombat") {return spells[spell_id].InCombat; }
else if (id == "OutofCombat") {return spells[spell_id].OutofCombat; }
+2 -1
View File
@@ -420,6 +420,7 @@ public:
inline float GetTargetRingZ() const { return m_TargetRing.z; }
inline bool HasEndurUpkeep() const { return endur_upkeep; }
inline void SetEndurUpkeep(bool val) { endur_upkeep = val; }
bool HasBuffWithSpellGroup(int spellgroup);
//Basic Stats/Inventory
virtual void SetLevel(uint8 in_level, bool command = false) { level = in_level; }
@@ -832,7 +833,7 @@ public:
int8 GetDecayEffectValue(uint16 spell_id, uint16 spelleffect);
int32 GetExtraSpellAmt(uint16 spell_id, int32 extra_spell_amt, int32 base_spell_dmg);
void MeleeLifeTap(int32 damage);
bool PassCastRestriction(bool UseCastRestriction = true, int16 value = 0, bool IsDamage = true);
bool PassCastRestriction(int value);
bool ImprovedTaunt();
bool TryRootFadeByDamage(int buffslot, Mob* attacker);
float GetSlowMitigation() const { return slow_mitigation; }
+899 -280
View File
File diff suppressed because it is too large Load Diff
+17 -2
View File
@@ -1535,8 +1535,13 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
if (isproc && IsNPC() && CastToNPC()->GetInnateProcSpellID() == spell_id)
targetType = ST_Target;
if (spell_target && !spell_target->PassCastRestriction(true, spells[spell_id].CastRestriction)){
MessageString(Chat::Red,SPELL_NEED_TAR);
if (spell_target && spells[spell_id].CastRestriction && !spell_target->PassCastRestriction(spells[spell_id].CastRestriction)){
Message(Chat::Red, "Your target does not meet the spell requirements."); //Current live also adds description after this from dbstr_us type 39
return false;
}
if (spells[spell_id].caster_requirement_id && !PassCastRestriction(spells[spell_id].caster_requirement_id)) {
MessageString(Chat::Red, SPELL_WOULDNT_HOLD);
return false;
}
@@ -4146,6 +4151,16 @@ uint32 Mob::BuffCount() {
return active_buff_count;
}
bool Mob::HasBuffWithSpellGroup(int spellgroup)
{
for (int i = 0; i < GetMaxTotalSlots(); i++) {
if (IsValidSpell(buffs[i].spellid) && spells[buffs[i].spellid].spellgroup == spellgroup) {
return true;
}
}
return false;
}
// removes all buffs
void Mob::BuffFadeAll()
{