diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/Object.h | 11 | ||||
| -rw-r--r-- | src/game/Spell.cpp | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/game/Object.h b/src/game/Object.h index b7e5a6efa3e..3004601cd50 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -560,11 +560,12 @@ class TRINITY_DLL_SPEC WorldObject : public Object bool IsTempWorldObject; #ifdef MAP_BASED_RAND_GEN - int32 irand(int32 min, int32 max) const { return int32 (GetMap()->mtRand.randInt(max - min)) + min; } - uint32 urand(uint32 min, uint32 max) const { return GetMap()->mtRand.randInt(max - min) + min; } - int32 rand32() const { return GetMap()->mtRand.randInt(); } - double rand_norm() const { return GetMap()->mtRand.randExc(); } - double rand_chance() const { return GetMap()->mtRand.randExc(100.0); } + // Object may not have map assigned - use global scope rand in that case + int32 irand(int32 min, int32 max) const { return FindMap() ? int32 (GetMap()->mtRand.randInt(max - min)) + min : ::irand(min, max); } + uint32 urand(uint32 min, uint32 max) const { return FindMap() ? GetMap()->mtRand.randInt(max - min) + min : ::urand(min, max); } + int32 rand32() const { return FindMap() ? GetMap()->mtRand.randInt(): ::rand32(); } + double rand_norm() const { return FindMap() ? GetMap()->mtRand.randExc(): ::rand_norm(); } + double rand_chance() const { return FindMap() ? GetMap()->mtRand.randExc(100.0): ::rand_chance(); } #endif protected: diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 8f47a8252d4..dfa2687c72d 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4341,7 +4341,7 @@ SpellCastResult Spell::CheckCast(bool strict) if(m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell)) return SPELL_FAILED_TARGET_AURASTATE; - if(target == m_caster && m_spellInfo->AttributesEx & SPELL_ATTR_EX_CANT_TARGET_SELF) + if(!m_IsTriggeredSpell && target == m_caster && m_spellInfo->AttributesEx & SPELL_ATTR_EX_CANT_TARGET_SELF) return SPELL_FAILED_BAD_TARGETS; if(target != m_caster) |
