953 | | |
954 | | if(((Creature*)unit)->AI()) |
955 | | ((Creature*)unit)->AI()->SpellHit(m_caster ,m_spellInfo); |
956 | | } |
957 | | |
958 | | if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI()) |
959 | | ((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo); |
960 | | |
961 | | if(int32 spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id, 1)) |
962 | | { |
963 | | if(spell_triggered > 0) |
964 | | unit->CastSpell(unit, spell_triggered, true/*, 0, 0, m_caster->GetGUID()*/); |
965 | | else |
966 | | unit->RemoveAurasDueToSpell(-spell_triggered); |
| 953 | } |
| 954 | |
| 955 | if( !m_caster->IsFriendlyTo(unit) && !IsPositiveSpell(m_spellInfo->Id)) |
| 956 | { |
| 957 | if( !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO) ) |
| 958 | { |
| 959 | if(!unit->IsStandState() && !unit->hasUnitState(UNIT_STAT_STUNNED)) |
| 960 | unit->SetStandState(PLAYER_STATE_NONE); |
| 961 | |
| 962 | if(!unit->isInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI()) |
| 963 | ((Creature*)unit)->AI()->AttackStart(m_caster); |
| 964 | |
| 965 | unit->SetInCombatWith(m_caster); |
| 966 | m_caster->SetInCombatWith(unit); |
| 967 | |
| 968 | if(Player *attackedPlayer = unit->GetCharmerOrOwnerPlayerOrPlayerItself()) |
| 969 | m_caster->SetContestedPvP(attackedPlayer); |
| 970 | } |
1009 | | |
1010 | | if( !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO) ) |
1011 | | { |
1012 | | if(!unit->IsStandState() && !unit->hasUnitState(UNIT_STAT_STUNNED)) |
1013 | | unit->SetStandState(PLAYER_STATE_NONE); |
1014 | | |
1015 | | if(!unit->isInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI()) |
1016 | | ((Creature*)unit)->AI()->AttackStart(m_caster); |
1017 | | |
1018 | | unit->SetInCombatWith(m_caster); |
1019 | | m_caster->SetInCombatWith(unit); |
1020 | | |
1021 | | if(Player *attackedPlayer = unit->GetCharmerOrOwnerPlayerOrPlayerItself()) |
1022 | | { |
1023 | | m_caster->SetContestedPvP(attackedPlayer); |
1024 | | } |
1025 | | unit->AddThreat(m_caster, 0.0f); |
1026 | | } |
| 1054 | } |
| 1055 | |
| 1056 | if(unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->AI()) |
| 1057 | ((Creature*)unit)->AI()->SpellHit(m_caster, m_spellInfo); |
| 1058 | |
| 1059 | if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI()) |
| 1060 | ((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo); |
| 1061 | |
| 1062 | if(int32 spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id, 1)) |
| 1063 | { |
| 1064 | if(spell_triggered > 0) |
| 1065 | unit->CastSpell(unit, spell_triggered, true, 0, 0, m_caster->GetGUID()); |
| 1066 | else |
| 1067 | unit->RemoveAurasDueToSpell(-spell_triggered); |