diff options
| author | megamage <none@none> | 2009-05-08 00:49:02 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2009-05-08 00:49:02 -0500 |
| commit | 979073cebdb7fdaea910f610c996bd5a53c04fe7 (patch) | |
| tree | 9e7fcde3540f952d639980e9d5cde3fe211fe42e /src | |
| parent | e8474f32911ace12cc5fe11421c74dc7945f0e20 (diff) | |
*Update some spell attr flag. Use better way to check IsRangedSpell and UnaffectedByInvulnerability
--HG--
branch : trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/ItemPrototype.h | 4 | ||||
| -rw-r--r-- | src/game/SharedDefines.h | 26 | ||||
| -rw-r--r-- | src/game/Spell.cpp | 6 | ||||
| -rw-r--r-- | src/game/Spell.h | 6 | ||||
| -rw-r--r-- | src/game/SpellAuras.cpp | 6 | ||||
| -rw-r--r-- | src/game/SpellMgr.cpp | 29 | ||||
| -rw-r--r-- | src/game/SpellMgr.h | 9 | ||||
| -rw-r--r-- | src/game/Unit.cpp | 36 | ||||
| -rw-r--r-- | src/game/Unit.h | 2 |
9 files changed, 54 insertions, 70 deletions
diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 781262189e1..f87e52b2e22 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -263,6 +263,10 @@ enum ItemSubclassWeapon ITEM_SUBCLASS_WEAPON_FISHING_POLE = 20 }; +#define ITEM_SUBCLASS_MASK_WEAPON_RANGED (\ + (1 << ITEM_SUBCLASS_WEAPON_BOW) | (1 << ITEM_SUBCLASS_WEAPON_GUN) |\ + (1 << ITEM_SUBCLASS_WEAPON_CROSSBOW) | (1 << ITEM_SUBCLASS_WEAPON_THROWN)) + #define MAX_ITEM_SUBCLASS_WEAPON 21 enum ItemSubclassGem diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 514d927cd47..cc8db7c30f8 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -221,8 +221,8 @@ enum SpellCategory // *********************************** #define SPELL_ATTR_UNK0 0x00000001 // 0 -#define SPELL_ATTR_RANGED 0x00000002 // 1 All ranged abilities have this flag -#define SPELL_ATTR_ON_NEXT_SWING_1 0x00000004 // 2 on next swing +#define SPELL_ATTR_REQ_AMMO 0x00000002 // 1 +#define SPELL_ATTR_ON_NEXT_SWING 0x00000004 // 2 on next swing #define SPELL_ATTR_UNK3 0x00000008 // 3 not set in 3.0.3 #define SPELL_ATTR_UNK4 0x00000010 // 4 #define SPELL_ATTR_UNK5 0x00000020 // 5 trade spells? @@ -230,7 +230,7 @@ enum SpellCategory #define SPELL_ATTR_UNK7 0x00000080 // 7 visible? #define SPELL_ATTR_UNK8 0x00000100 // 8 #define SPELL_ATTR_UNK9 0x00000200 // 9 -#define SPELL_ATTR_ON_NEXT_SWING_2 0x00000400 // 10 on next swing 2 +#define SPELL_ATTR_UNK10 0x00000400 // 10 on next swing 2 #define SPELL_ATTR_UNK11 0x00000800 // 11 #define SPELL_ATTR_DAYTIME_ONLY 0x00001000 // 12 only useable at daytime, not set in 2.4.2 #define SPELL_ATTR_NIGHT_ONLY 0x00002000 // 13 only useable at night, not set in 2.4.2 @@ -243,33 +243,33 @@ enum SpellCategory #define SPELL_ATTR_STOP_ATTACK_TARGET 0x00100000 // 20 Stop attack after use this spell (and not begin attack if use) #define SPELL_ATTR_IMPOSSIBLE_DODGE_PARRY_BLOCK 0x00200000 // 21 Cannot be dodged/parried/blocked #define SPELL_ATTR_UNK22 0x00400000 // 22 shoot spells -#define SPELL_ATTR_UNK23 0x00800000 // 23 castable while dead? +#define SPELL_ATTR_CASTABLE_WHILE_DEAD 0x00800000 // 23 castable while dead? #define SPELL_ATTR_CASTABLE_WHILE_MOUNTED 0x01000000 // 24 castable while mounted #define SPELL_ATTR_DISABLED_WHILE_ACTIVE 0x02000000 // 25 Activate and start cooldown after aura fade or remove summoned creature or go -#define SPELL_ATTR_UNK26 0x04000000 // 26 Aura ignore immune? +#define SPELL_ATTR_UNK26 0x04000000 // 26 Aura #define SPELL_ATTR_CASTABLE_WHILE_SITTING 0x08000000 // 27 castable while sitting #define SPELL_ATTR_CANT_USED_IN_COMBAT 0x10000000 // 28 Cannot be used in combat #define SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY 0x20000000 // 29 unaffected by invulnerability (hmm possible not...) #define SPELL_ATTR_BREAKABLE_BY_DAMAGE 0x40000000 // 30 breakable by damage? #define SPELL_ATTR_CANT_CANCEL 0x80000000 // 31 positive aura can't be canceled -#define SPELL_ATTR_EX_UNK0 0x00000001 // 0 +#define SPELL_ATTR_EX_DISMISS_PET 0x00000001 // 0 dismiss pet and not allow to summon new one? #define SPELL_ATTR_EX_DRAIN_ALL_POWER 0x00000002 // 1 use all power (Only paladin Lay of Hands and Bunyanize) -#define SPELL_ATTR_EX_CHANNELED_1 0x00000004 // 2 channeled 1 +#define SPELL_ATTR_EX_CHANNELED_1 0x00000004 // 2 channeled target #define SPELL_ATTR_EX_UNK3 0x00000008 // 3 -#define SPELL_ATTR_EX_UNK4 0x00000010 // 4 +#define SPELL_ATTR_EX_UNK4 0x00000010 // 4 stealth and whirlwind #define SPELL_ATTR_EX_NOT_BREAK_STEALTH 0x00000020 // 5 Not break stealth -#define SPELL_ATTR_EX_CHANNELED_2 0x00000040 // 6 channeled 2 +#define SPELL_ATTR_EX_CHANNELED_2 0x00000040 // 6 channeled self #define SPELL_ATTR_EX_NEGATIVE 0x00000080 // 7 #define SPELL_ATTR_EX_NOT_IN_COMBAT_TARGET 0x00000100 // 8 Spell req target not to be in combat state -#define SPELL_ATTR_EX_UNK9 0x00000200 // 9 -#define SPELL_ATTR_EX_NO_INITIAL_AGGRO 0x00000400 // 10 no generates threat on cast 100% -#define SPELL_ATTR_EX_UNK11 0x00000800 // 11 +#define SPELL_ATTR_EX_UNK9 0x00000200 // 9 melee spells +#define SPELL_ATTR_EX_NO_INITIAL_AGGRO 0x00000400 // 10 no generates threat on cast 100%? +#define SPELL_ATTR_EX_UNK11 0x00000800 // 11 aura #define SPELL_ATTR_EX_UNK12 0x00001000 // 12 #define SPELL_ATTR_EX_UNK13 0x00002000 // 13 #define SPELL_ATTR_EX_UNK14 0x00004000 // 14 #define SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY 0x00008000 // 15 remove auras on immunity -#define SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE 0x00010000 // 16 unaffected by school immunity +#define SPELL_ATTR_EX_UNK16 0x00010000 // 16 on immuniy #define SPELL_ATTR_EX_UNAUTOCASTABLE_BY_PET 0x00020000 // 17 #define SPELL_ATTR_EX_UNK18 0x00040000 // 18 #define SPELL_ATTR_EX_UNK19 0x00080000 // 19 diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 393cab740fb..e1ee5f77435 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -377,7 +377,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi m_attackType = BASE_ATTACK; break; case SPELL_DAMAGE_CLASS_RANGED: - m_attackType = IsRangedSpell() ? RANGED_ATTACK : BASE_ATTACK; + m_attackType = IsRangedWeaponSpell(m_spellInfo) ? RANGED_ATTACK : BASE_ATTACK; break; default: // Wands @@ -2973,7 +2973,7 @@ void Spell::SendSpellStart() sLog.outDebug("Sending SMSG_SPELL_START id=%u", m_spellInfo->Id); uint32 castFlags = CAST_FLAG_UNKNOWN1; - if(IsRangedSpell()) + if(m_spellInfo->Attributes & SPELL_ATTR_REQ_AMMO) castFlags |= CAST_FLAG_AMMO; if ((m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet())) @@ -3015,7 +3015,7 @@ void Spell::SendSpellGo() sLog.outDebug("Sending SMSG_SPELL_GO id=%u", m_spellInfo->Id); uint32 castFlags = CAST_FLAG_UNKNOWN3; - if(IsRangedSpell()) + if(m_spellInfo->Attributes & SPELL_ATTR_REQ_AMMO) castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual if ((m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet())) diff --git a/src/game/Spell.h b/src/game/Spell.h index 9cbd7f666dd..6dc8477dcdb 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -447,11 +447,7 @@ class Spell void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; } bool IsNextMeleeSwingSpell() const { - return m_spellInfo->Attributes & (SPELL_ATTR_ON_NEXT_SWING_1|SPELL_ATTR_ON_NEXT_SWING_2); - } - bool IsRangedSpell() const - { - return m_spellInfo->Attributes & SPELL_ATTR_RANGED; + return m_spellInfo->Attributes & SPELL_ATTR_ON_NEXT_SWING; } bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; } bool IsMeleeAttackResetSpell() const { return !m_IsTriggeredSpell && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_AUTOATTACK); } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 4e3f60a18d3..f7f13acc3f8 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -6585,10 +6585,8 @@ void AuraEffect::PeriodicDummyTick() // Explosive Shot if (spell->SpellFamilyFlags[1] & 0x80000000) { - if (!caster) - return; - int32 damage = m_amount; - caster->CastCustomSpell(m_target, 53352, &damage, 0, 0, true, 0, this); + if(caster) + caster->CastCustomSpell(53352, SPELLVALUE_BASE_POINT0, m_amount, m_target, true, NULL, this); return; } switch (spell->Id) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 87d5d844ba2..945255f883a 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -285,7 +285,7 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell) if (spell && spell->GetCaster()) spell->GetCaster()->ModSpellCastTime(spellInfo, castTime, spell); - if (spellInfo->Attributes & SPELL_ATTR_RANGED && (!spell || !(spell->IsAutoRepeat()))) + if (spellInfo->Attributes & SPELL_ATTR_REQ_AMMO && (!spell || !(spell->IsAutoRepeat()))) castTime += 500; return (castTime > 0) ? uint32(castTime) : 0; @@ -790,30 +790,9 @@ bool IsDispelableBySpell(SpellEntry const * dispelSpell, uint32 spellId, bool de SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId); if (!spellproto) return false; - if (spellproto->Mechanic == MECHANIC_IMMUNE_SHIELD) - { - if (dispelSpell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) - { - return true; - } - else - return false; - } - else if (spellproto->Mechanic == MECHANIC_INVULNERABILITY) - { - if (dispelSpell->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) - { - return true; - } - else - return false; - } - else - { - if ((dispelSpell->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) - || (dispelSpell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY)) - return !def; - } + if(dispelSpell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) + return true; + return def; } diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index a723e3415e4..c6d251e5457 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -322,7 +322,14 @@ inline bool isSpellBreakStealth(SpellEntry const* spellInfo) inline bool IsAutoRepeatRangedSpell(SpellEntry const* spellInfo) { - return (spellInfo->Attributes & SPELL_ATTR_RANGED) && (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG); + return spellInfo->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG; +} + +inline bool IsRangedWeaponSpell(SpellEntry const* spellInfo) +{ + //spell->DmgClass == SPELL_DAMAGE_CLASS_RANGED should be checked outside + return (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER) // for 53352, cannot find better way + || (spellInfo->EquippedItemSubClassMask & ITEM_SUBCLASS_MASK_WEAPON_RANGED); } SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 form); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 67b15de5adb..514a26349ba 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1074,7 +1074,7 @@ void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32 CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster); } -void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, uint32 value, Unit* target, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster) +void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster) { CustomSpellValues values; values.AddSpellMod(mod, value); @@ -2730,7 +2730,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell) { WeaponAttackType attType = BASE_ATTACK; - if (spell->DmgClass == SPELL_DAMAGE_CLASS_RANGED && spell->Attributes & SPELL_ATTR_RANGED) + if (spell->DmgClass == SPELL_DAMAGE_CLASS_RANGED && IsRangedWeaponSpell(spell)) attType = RANGED_ATTACK; // bonus from skills is 0.04% per skill Diff @@ -9479,30 +9479,30 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo) if(itr->type == spellInfo->Id) return true; - SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL]; - for(SpellImmuneList::const_iterator itr = dispelList.begin(); itr != dispelList.end(); ++itr) - if(itr->type == spellInfo->Dispel) - return true; - - if(spellInfo->Id != 42292 && spellInfo->Id !=59752) + if(spellInfo->Dispel) { - SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; - for(SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) - if( !(IsPositiveSpell(itr->spellId) && IsPositiveSpell(spellInfo->Id)) && - (itr->type & GetSpellSchoolMask(spellInfo)) && !IsDispelableBySpell(spellInfo, itr->spellId)) + SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL]; + for(SpellImmuneList::const_iterator itr = dispelList.begin(); itr != dispelList.end(); ++itr) + if(itr->type == spellInfo->Dispel) return true; } - if (spellInfo->Mechanic) + if(spellInfo->Mechanic) { SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; for(SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) - { if(itr->type == spellInfo->Mechanic) - { return true; - } - } + } + + if(spellInfo->Id != 42292 && spellInfo->Id !=59752) + { + SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; + for(SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) + if((itr->type & GetSpellSchoolMask(spellInfo)) + && !(IsPositiveSpell(itr->spellId) && IsPositiveSpell(spellInfo->Id)) + && !IsDispelableBySpell(spellInfo, itr->spellId)) + return true; } return false; @@ -10834,7 +10834,7 @@ void Unit::ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spel castTime = int32( float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED)); else { - if (spellProto->Attributes & SPELL_ATTR_RANGED && !(spellProto->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG)) + if (spellProto->Attributes & SPELL_ATTR_REQ_AMMO && !(spellProto->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG)) castTime = int32 (float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]); } } diff --git a/src/game/Unit.h b/src/game/Unit.h index ea3845a2b80..fcfc14b5394 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1181,7 +1181,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(uint32 spellId, SpellValueMod mod, uint32 value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); void CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); void AddAura(uint32 spellId, Unit *target); |
