Core/SAI: Fixed SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL
Signed-off-by: Subv <[email protected]>
This commit is contained in:
@@ -68,6 +68,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
|
||||
mFollowCredit = 0;
|
||||
mFollowArrivedEntry = 0;
|
||||
mFollowCreditType = 0;
|
||||
mInvinceabilityHpLevel = 0;
|
||||
}
|
||||
|
||||
void SmartAI::UpdateDespawn(const uint32 diff)
|
||||
@@ -637,6 +638,8 @@ void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* spellInfo)
|
||||
void SmartAI::DamageTaken(Unit* doneBy, uint32& damage)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage);
|
||||
if ((me->GetHealth() - damage) <= mInvinceabilityHpLevel)
|
||||
damage -= mInvinceabilityHpLevel;
|
||||
}
|
||||
|
||||
void SmartAI::HealReceived(Unit* doneBy, uint32& addhealth)
|
||||
|
||||
@@ -175,6 +175,8 @@ class SmartAI : public CreatureAI
|
||||
|
||||
void SetSwim(bool swim = true);
|
||||
|
||||
void SetInvinceabilityHpLevel(uint32 level) { mInvinceabilityHpLevel = level; }
|
||||
|
||||
void sGossipHello(Player* player);
|
||||
void sGossipSelect(Player* player, uint32 sender, uint32 action);
|
||||
void sGossipSelectCode(Player* player, uint32 sender, uint32 action, const char* code);
|
||||
@@ -222,6 +224,7 @@ class SmartAI : public CreatureAI
|
||||
bool mCanAutoAttack;
|
||||
bool mCanCombatMove;
|
||||
bool mForcedPaused;
|
||||
uint32 mInvinceabilityHpLevel;
|
||||
|
||||
bool AssistPlayerInCombat(Unit* who);
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ SmartScript::SmartScript()
|
||||
go = NULL;
|
||||
me = NULL;
|
||||
mEventPhase = 0;
|
||||
mInvinceabilityHpLevel = 0;
|
||||
mPathId = 0;
|
||||
mTargetStorage = new ObjectListMap();
|
||||
mStoredEvents.clear();
|
||||
@@ -992,10 +991,15 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (!me)
|
||||
break;
|
||||
|
||||
SmartAI* ai = CAST_AI(SmartAI, me->AI());
|
||||
|
||||
if (!ai)
|
||||
break;
|
||||
|
||||
if (e.action.invincHP.percent)
|
||||
mInvinceabilityHpLevel = me->CountPctFromMaxHealth(e.action.invincHP.percent);
|
||||
ai->SetInvinceabilityHpLevel(me->CountPctFromMaxHealth(e.action.invincHP.percent));
|
||||
else
|
||||
mInvinceabilityHpLevel = e.action.invincHP.minHP;
|
||||
ai->SetInvinceabilityHpLevel(e.action.invincHP.minHP);
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SET_DATA:
|
||||
|
||||
@@ -236,7 +236,6 @@ class SmartScript
|
||||
SmartScriptType mScriptType;
|
||||
uint32 mEventPhase;
|
||||
|
||||
uint32 mInvinceabilityHpLevel;
|
||||
UNORDERED_MAP<int32, int32> mStoredDecimals;
|
||||
uint32 mPathId;
|
||||
SmartAIEventList mStoredEvents;
|
||||
|
||||
Reference in New Issue
Block a user