mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-14 12:12:34 -04:00
Core/SmartAI: Add a spellid to SMART_EVENT_TARGET_CASTING. If left on 0, it checks for all spells (like it did without these changes)
This commit is contained in:
@@ -2643,10 +2643,20 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
}
|
||||
case SMART_EVENT_TARGET_CASTING:
|
||||
{
|
||||
if (!me || !me->IsInCombat() || !me->GetVictim() || !me->GetVictim()->IsNonMeleeSpellCasted(false, false, true))
|
||||
if (!me || !me->IsInCombat())
|
||||
return;
|
||||
|
||||
ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax, me->GetVictim());
|
||||
Unit* victim = me->GetVictim();
|
||||
|
||||
if (!victim || !victim->IsNonMeleeSpellCasted(false, false, true))
|
||||
return;
|
||||
|
||||
if (e.event.targetCasting.spellId > 0)
|
||||
if (Spell* currSpell = victim->GetCurrentSpell(CURRENT_GENERIC_SPELL))
|
||||
if (currSpell->m_spellInfo->Id != e.event.targetCasting.spellId)
|
||||
return;
|
||||
|
||||
ProcessTimedAction(e, e.event.targetCasting.repeatMin, e.event.targetCasting.repeatMax, me->GetVictim());
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_FRIENDLY_HEALTH:
|
||||
@@ -2654,10 +2664,10 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
if (!me || !me->IsInCombat())
|
||||
return;
|
||||
|
||||
Unit* target = DoSelectLowestHpFriendly((float)e.event.friendlyHealt.radius, e.event.friendlyHealt.hpDeficit);
|
||||
Unit* target = DoSelectLowestHpFriendly((float)e.event.friendlyHealth.radius, e.event.friendlyHealth.hpDeficit);
|
||||
if (!target || !target->IsInCombat())
|
||||
return;
|
||||
ProcessTimedAction(e, e.event.friendlyHealt.repeatMin, e.event.friendlyHealt.repeatMax, target);
|
||||
ProcessTimedAction(e, e.event.friendlyHealth.repeatMin, e.event.friendlyHealth.repeatMax, target);
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_FRIENDLY_IS_CC:
|
||||
@@ -3005,7 +3015,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
{
|
||||
uint32 healthPct = uint32((*itr)->ToUnit()->GetHealthPct());
|
||||
|
||||
if (healthPct > e.event.friendlyHealtPct.maxHpPct || healthPct < e.event.friendlyHealtPct.minHpPct)
|
||||
if (healthPct > e.event.friendlyHealthPct.maxHpPct || healthPct < e.event.friendlyHealthPct.minHpPct)
|
||||
continue;
|
||||
|
||||
target = (*itr)->ToUnit();
|
||||
@@ -3018,7 +3028,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
ProcessTimedAction(e, e.event.friendlyHealtPct.repeatMin, e.event.friendlyHealtPct.repeatMax, target);
|
||||
ProcessTimedAction(e, e.event.friendlyHealthPct.repeatMin, e.event.friendlyHealthPct.repeatMax, target);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user