mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
fix(Scripts/BlackMorass): Fixed amount of Medivh's Integrity shield t… (#14948)
This commit is contained in:
@@ -48,8 +48,8 @@ public:
|
||||
GuidSet encounterNPCs;
|
||||
uint32 encounters[MAX_ENCOUNTER];
|
||||
ObjectGuid _medivhGUID;
|
||||
uint8 _currentRift;
|
||||
uint8 _shieldPercent;
|
||||
uint8 _currentRift;
|
||||
int8 _shieldPercent;
|
||||
|
||||
void Initialize() override
|
||||
{
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void SetData(uint32 type, uint32 /*data*/) override
|
||||
void SetData(uint32 type, uint32 data) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -187,10 +187,19 @@ public:
|
||||
Events.RescheduleEvent(EVENT_NEXT_PORTAL, 3000);
|
||||
break;
|
||||
case DATA_DAMAGE_SHIELD:
|
||||
--_shieldPercent;
|
||||
{
|
||||
_shieldPercent -= data;
|
||||
if (_shieldPercent < 0)
|
||||
{
|
||||
_shieldPercent = 0;
|
||||
}
|
||||
|
||||
DoUpdateWorldState(WORLD_STATE_BM_SHIELD, _shieldPercent);
|
||||
|
||||
if (!_shieldPercent)
|
||||
{
|
||||
if (Creature* medivh = instance->GetCreature(_medivhGUID))
|
||||
{
|
||||
if (medivh->IsAlive())
|
||||
{
|
||||
Unit::Kill(medivh, medivh);
|
||||
@@ -198,10 +207,17 @@ public:
|
||||
// Xinef: delete all spawns
|
||||
GuidSet eCopy = encounterNPCs;
|
||||
for (ObjectGuid const& guid : eCopy)
|
||||
{
|
||||
if (Creature* creature = instance->GetCreature(guid))
|
||||
{
|
||||
creature->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -387,16 +387,32 @@ public:
|
||||
{
|
||||
PrepareAuraScript(spell_black_morass_corrupt_medivh_AuraScript);
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
_ticks = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void PeriodicTick(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
if (InstanceScript* instance = GetUnitOwner()->GetInstanceScript())
|
||||
instance->SetData(DATA_DAMAGE_SHIELD, 1);
|
||||
if (++_ticks >= 3)
|
||||
{
|
||||
_ticks = 0;
|
||||
|
||||
if (InstanceScript* instance = GetUnitOwner()->GetInstanceScript())
|
||||
{
|
||||
instance->SetData(DATA_DAMAGE_SHIELD, m_scriptSpellId == SPELL_CORRUPT_AEONUS ? 2 : 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_morass_corrupt_medivh_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||
}
|
||||
|
||||
private:
|
||||
uint8 _ticks = 0;
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
|
||||
Reference in New Issue
Block a user