AI/SmartScripts: Add SMART_ACTION_DISABLE_EVADE (117).
This commit is contained in:
1 parent
c2fd73c95d
commit
0e47f961c9
5 files changed
+31
-1
No files matched your search
@@ -42,6 +42,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
|
||||
// spawn in run mode
|
||||
me->SetWalk(false);
|
||||
mRun = false;
|
||||
mEvadeDisabled = false;
|
||||
|
||||
mLastOOCPos = me->GetPosition();
|
||||
|
||||
@@ -415,6 +416,12 @@ void SmartAI::EnterEvadeMode(EvadeReason /*why*/)
|
||||
if (!me->IsAlive() || me->IsInEvadeMode())
|
||||
return;
|
||||
|
||||
if (mEvadeDisabled)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_EVADE);
|
||||
return;
|
||||
}
|
||||
|
||||
me->RemoveAurasOnEvade();
|
||||
|
||||
me->AddUnitState(UNIT_STATE_EVADE);
|
||||
@@ -693,6 +700,11 @@ void SmartAI::SetSwim(bool swim)
|
||||
me->SetSwim(swim);
|
||||
}
|
||||
|
||||
void SmartAI::SetEvadeDisabled(bool disable)
|
||||
{
|
||||
mEvadeDisabled = disable;
|
||||
}
|
||||
|
||||
void SmartAI::sGossipHello(Player* player)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_HELLO, player);
|
||||
|
||||
@@ -172,6 +172,8 @@ class TC_GAME_API SmartAI : public CreatureAI
|
||||
|
||||
void SetSwim(bool swim = true);
|
||||
|
||||
void SetEvadeDisabled(bool disable = true);
|
||||
|
||||
void SetInvincibilityHpLevel(uint32 level) { mInvincibilityHpLevel = level; }
|
||||
|
||||
void sGossipHello(Player* player) override;
|
||||
@@ -217,6 +219,7 @@ class TC_GAME_API SmartAI : public CreatureAI
|
||||
uint32 GetWPCount() const { return mWayPoints ? uint32(mWayPoints->size()) : 0; }
|
||||
bool mCanRepeatPath;
|
||||
bool mRun;
|
||||
bool mEvadeDisabled;
|
||||
bool mCanAutoAttack;
|
||||
bool mCanCombatMove;
|
||||
bool mForcedPaused;
|
||||
|
||||
@@ -2366,6 +2366,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
delete targets;
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_DISABLE_EVADE:
|
||||
{
|
||||
if (!IsSmart())
|
||||
break;
|
||||
|
||||
ENSURE_AI(SmartAI, me->AI())->SetEvadeDisabled(e.action.disableEvade.disable != 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
break;
|
||||
|
||||
@@ -1280,6 +1280,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
case SMART_ACTION_SUMMON_CREATURE_GROUP:
|
||||
case SMART_ACTION_MOVE_OFFSET:
|
||||
case SMART_ACTION_SET_CORPSE_DELAY:
|
||||
case SMART_ACTION_DISABLE_EVADE:
|
||||
break;
|
||||
default:
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
|
||||
|
||||
@@ -552,8 +552,9 @@ enum SMART_ACTION
|
||||
SMART_ACTION_MOVE_OFFSET = 114,
|
||||
SMART_ACTION_RANDOM_SOUND = 115, // soundId1, soundId2, soundId3, soundId4, soundId5, onlySelf
|
||||
SMART_ACTION_SET_CORPSE_DELAY = 116, // timer
|
||||
SMART_ACTION_DISABLE_EVADE = 117, // 0/1 (1 = disabled, 0 = enabled)
|
||||
|
||||
SMART_ACTION_END = 117
|
||||
SMART_ACTION_END = 118
|
||||
};
|
||||
|
||||
struct SmartAction
|
||||
@@ -1049,6 +1050,11 @@ struct SmartAction
|
||||
uint32 timer;
|
||||
} corpseDelay;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 disable;
|
||||
} disableEvade;
|
||||
|
||||
//! Note for any new future actions
|
||||
//! All parameters must have type uint32
|
||||
|
||||
|
||||
Reference in new issue
Block a user