[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
+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()
{