本文整理汇总了C++中Creature::DealDamage方法的典型用法代码示例。如果您正苦于以下问题:C++ Creature::DealDamage方法的具体用法?C++ Creature::DealDamage怎么用?C++ Creature::DealDamage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Creature
的用法示例。
在下文中一共展示了Creature::DealDamage方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reset
void Reset()
{
LeechingThrow_Timer = 20000;
TheBeastWithin_Timer = 30000;
Multishot_Timer = 15000;
Pet_Timer = 10000;
pet = false;
Creature* Pet = Unit::GetCreature(*me, SummonedPet);
if (Pet && Pet->IsAlive())
Pet->DealDamage(Pet, Pet->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
SummonedPet = 0;
if (pInstance)
pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED);
}
示例2: DeSpawnAdds
void DeSpawnAdds()
{
for (uint8 i = 0; i < 4 ; ++i)
{
Creature* Temp = NULL;
if (AddGUID[i])
{
Temp = Creature::GetCreature((*me),AddGUID[i]);
if (Temp && Temp->isAlive())
{
(*Temp).GetMotionMaster()->Clear(true);
Temp->DealDamage(Temp, Temp->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
Temp->RemoveCorpse();
}
}
}
}
示例3: DoEndEvent
void DoEndEvent()
{
if (!m_pInstance || m_bEventEnd)
return;
// Prevent further handling for next council uiMember death
m_bEventEnd = true;
// Kill all the other council members
for (unsigned int i : aCouncilMember)
{
Creature* pMember = m_pInstance->GetSingleCreatureFromStorage(i);
if (pMember && pMember->isAlive())
pMember->DealDamage(pMember, pMember->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
// Self kill the voice trigger and the controller
if (Creature* pVoiceTrigger = m_pInstance->GetSingleCreatureFromStorage(NPC_COUNCIL_VOICE))
pVoiceTrigger->DealDamage(pVoiceTrigger, pVoiceTrigger->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
m_creature->DealDamage(m_creature, m_creature->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
示例4: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (!m_bDrainingCrystal)
{
uint32 uiMaxPowerMana = m_creature->GetMaxPower(POWER_MANA);
if (uiMaxPowerMana && ((m_creature->GetPower(POWER_MANA)*100 / uiMaxPowerMana) < 10))
{
if (m_uiDrainLifeTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
if (DoCastSpellIfCan(pTarget, SPELL_DRAIN_LIFE) == CAST_OK)
m_uiDrainLifeTimer = 10000;
}
}
else
m_uiDrainLifeTimer -= uiDiff;
// Heroic only
if (!m_bIsRegularMode)
{
if (m_uiDrainManaTimer < uiDiff)
{
Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1);
if (!pTarget)
pTarget = m_creature->getVictim();
if (DoCastSpellIfCan(pTarget, SPELL_DRAIN_MANA) == CAST_OK)
m_uiDrainManaTimer = 10000;
}
else
m_uiDrainManaTimer -= uiDiff;
}
}
if (m_uiFelExplosionTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_FEL_EXPLOSION) == CAST_OK)
m_uiFelExplosionTimer = 2000;
}
else
m_uiFelExplosionTimer -= uiDiff;
// If below 10% mana, start recharging
uiMaxPowerMana = m_creature->GetMaxPower(POWER_MANA);
if (uiMaxPowerMana && ((m_creature->GetPower(POWER_MANA)*100 / uiMaxPowerMana) < 10))
{
if (m_uiDrainCrystalTimer < uiDiff)
{
SelectNearestCrystal();
if (m_bIsRegularMode)
m_uiDrainCrystalTimer = urand(20000, 25000);
else
m_uiDrainCrystalTimer = urand(10000, 15000);
}
else
m_uiDrainCrystalTimer -= uiDiff;
}
DoMeleeAttackIfReady();
}
else // if m_bDrainingCrystal
{
if (m_bIsDraining)
{
if (m_uiEmpowerTimer < uiDiff)
{
m_bIsDraining = false;
m_bDrainingCrystal = false;
DoScriptText(SAY_EMPOWERED, m_creature);
Creature* CrystalChosen = m_creature->GetMap()->GetCreature(m_crystalGuid);
if (CrystalChosen && CrystalChosen->isAlive())
// Use Deal Damage to kill it, not SetDeathState.
CrystalChosen->DealDamage(CrystalChosen, CrystalChosen->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
m_crystalGuid.Clear();
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
}
else
m_uiEmpowerTimer -= uiDiff;
}
}
}
示例5: UpdateAI
void UpdateAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (!m_bDrainingCrystal)
{
if (m_creature->GetPower(POWER_MANA) * 100 / m_creature->GetMaxPower(POWER_MANA) < 10)
{
if (m_uiDrainLifeTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_DRAIN_LIFE : SPELL_DRAIN_LIFE_H) == CAST_OK)
m_uiDrainLifeTimer = 10000;
}
}
else
m_uiDrainLifeTimer -= uiDiff;
// Heroic only
if (!m_bIsRegularMode)
{
if (m_uiDrainManaTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_DRAIN_MANA, SELECT_FLAG_POWER_MANA))
{
if (DoCastSpellIfCan(pTarget, SPELL_DRAIN_MANA) == CAST_OK)
m_uiDrainManaTimer = 10000;
}
}
else
m_uiDrainManaTimer -= uiDiff;
}
if (m_uiDrainCrystalTimer < uiDiff)
{
if (DoSelectNearestCrystal())
m_uiDrainCrystalTimer = m_bIsRegularMode ? urand(20000, 25000) : urand(10000, 15000);
}
else
m_uiDrainCrystalTimer -= uiDiff;
}
if (m_uiFelExplosionTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_FEL_EXPLOSION) == CAST_OK)
m_uiFelExplosionTimer = 2000;
}
else
m_uiFelExplosionTimer -= uiDiff;
DoMeleeAttackIfReady();
}
else
{
if (m_uiManaRageTimer)
{
if (m_uiManaRageTimer <= uiDiff)
{
DoScriptText(SAY_EMPOWERED, m_creature);
ManaRageComplete();
// Kill the drained crystal
Creature* pCrystalChosen = m_creature->GetMap()->GetCreature(m_crystalGuid);
if (pCrystalChosen && pCrystalChosen->isAlive())
pCrystalChosen->DealDamage(pCrystalChosen, pCrystalChosen->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
m_uiManaRageTimer = 0;
}
else
m_uiManaRageTimer -= uiDiff;
}
}
}
示例6: JustDidDialogueStep
void instance_arcatraz::JustDidDialogueStep(int32 iEntry)
{
Creature* pMellichar = GetSingleCreatureFromStorage(NPC_MELLICHAR);
if (!pMellichar)
return;
switch (iEntry)
{
case SPELL_TARGET_ALPHA:
pMellichar->CastSpell(pMellichar, SPELL_TARGET_ALPHA, false);
if (Creature* pTarget = GetSingleCreatureFromStorage(NPC_PRISON_APHPA_POD))
pMellichar->SetFacingToObject(pTarget);
SetData(TYPE_WARDEN_1, IN_PROGRESS);
break;
case YELL_MELLICHAR_RELEASE1:
pMellichar->SummonCreature(urand(0, 1) ? NPC_BLAZING_TRICKSTER : NPC_PHASE_HUNTER, aSummonPosition[0].m_fX, aSummonPosition[0].m_fY, aSummonPosition[0].m_fZ, aSummonPosition[0].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0);
break;
case YELL_MELLICHAR_RELEASE2:
if (Creature* pTarget = GetSingleCreatureFromStorage(NPC_PRISON_BETA_POD))
pMellichar->SetFacingToObject(pTarget);
break;
case SPELL_TARGET_BETA:
pMellichar->CastSpell(pMellichar, SPELL_TARGET_BETA, false);
SetData(TYPE_WARDEN_2, IN_PROGRESS);
break;
case TYPE_WARDEN_2:
pMellichar->SummonCreature(NPC_MILLHOUSE, aSummonPosition[1].m_fX, aSummonPosition[1].m_fY, aSummonPosition[1].m_fZ, aSummonPosition[1].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0);
break;
case SPELL_TARGET_DELTA:
pMellichar->CastSpell(pMellichar, SPELL_TARGET_DELTA, false);
if (Creature* pTarget = GetSingleCreatureFromStorage(NPC_PRISON_DELTA_POD))
pMellichar->SetFacingToObject(pTarget);
SetData(TYPE_WARDEN_3, IN_PROGRESS);
break;
case TYPE_WARDEN_3:
pMellichar->SummonCreature(urand(0, 1) ? NPC_AKKIRIS : NPC_SULFURON, aSummonPosition[2].m_fX, aSummonPosition[2].m_fY, aSummonPosition[2].m_fZ, aSummonPosition[2].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0);
pMellichar->CastSpell(pMellichar, SPELL_TARGET_OMEGA, false);
if (Creature* pTarget = GetSingleCreatureFromStorage(NPC_PRISON_BOSS_POD))
pMellichar->SetFacingToObject(pTarget);
break;
case YELL_MELLICHAR_RELEASE4:
pMellichar->InterruptNonMeleeSpells(false);
if (Creature* pTarget = GetSingleCreatureFromStorage(NPC_PRISON_GAMMA_POD))
pMellichar->SetFacingToObject(pTarget);
break;
case SPELL_TARGET_GAMMA:
pMellichar->CastSpell(pMellichar, SPELL_TARGET_GAMMA, false);
if (Creature* pTarget = GetSingleCreatureFromStorage(NPC_PRISON_GAMMA_POD))
pMellichar->SetFacingToObject(pTarget);
SetData(TYPE_WARDEN_4, IN_PROGRESS);
break;
case TYPE_WARDEN_4:
pMellichar->SummonCreature(urand(0, 1) ? NPC_TW_DRAKONAAR : NPC_BL_DRAKONAAR, aSummonPosition[3].m_fX, aSummonPosition[3].m_fY, aSummonPosition[3].m_fZ, aSummonPosition[3].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0);
pMellichar->CastSpell(pMellichar, SPELL_TARGET_OMEGA, false);
if (Creature* pTarget = GetSingleCreatureFromStorage(NPC_PRISON_BOSS_POD))
pMellichar->SetFacingToObject(pTarget);
break;
case YELL_MELLICHAR_RELEASE5:
pMellichar->InterruptNonMeleeSpells(false);
SetData(TYPE_WARDEN_5, IN_PROGRESS);
break;
case TYPE_WARDEN_5:
if (Creature* pSkyriss = pMellichar->SummonCreature(NPC_SKYRISS, aSummonPosition[4].m_fX, aSummonPosition[4].m_fY, aSummonPosition[4].m_fZ, aSummonPosition[4].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0))
pSkyriss->CastSpell(pSkyriss, SPELL_SIMPLE_TELEPORT, false);
break;
case YELL_MELLICAR_WELCOME:
if (Creature* pSkyriss = GetSingleCreatureFromStorage(NPC_SKYRISS))
pSkyriss->CastSpell(pSkyriss, SPELL_MIND_REND, false);
break;
case SAY_SKYRISS_AGGRO:
// Kill Mellichar and start combat
if (Creature* pSkyriss = GetSingleCreatureFromStorage(NPC_SKYRISS))
{
pSkyriss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE);
pMellichar->DealDamage(pMellichar, pMellichar->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
DoUseDoorOrButton(GO_SEAL_SPHERE);
break;
}
}
示例7: NextStep
uint32 NextStep(uint32 Step)
{
Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID);
Map* map = me->GetMap();
switch (Step)
{
case 0: return 9999999;
case 1:
me->Yell(SAY_DIALOG_MEDIVH_1, LANG_UNIVERSAL);
return 10000;
case 2:
if (arca)
arca->Yell(SAY_DIALOG_ARCANAGOS_2, LANG_UNIVERSAL);
return 20000;
case 3:
me->Yell(SAY_DIALOG_MEDIVH_3, LANG_UNIVERSAL);
return 10000;
case 4:
if (arca)
arca->Yell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL);
return 20000;
case 5:
me->Yell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL);
return 20000;
case 6:
if (arca)
arca->Yell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL);
return 10000;
case 7:
FireArcanagosTimer = 500;
return 5000;
case 8:
FireMedivhTimer = 500;
DoCast(me, SPELL_MANA_SHIELD);
return 10000;
case 9:
me->TextEmote(EMOTE_DIALOG_MEDIVH_7);
return 10000;
case 10:
if (arca)
DoCast(arca, SPELL_CONFLAGRATION_BLAST, false);
return 1000;
case 11:
if (arca)
arca->Yell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL);
return 5000;
case 12:
if (arca)
{
arca->GetMotionMaster()->MovePoint(0, -11010.82f, -1761.18f, 156.47f);
arca->setActive(true);
arca->InterruptNonMeleeSpells(true);
arca->SetSpeed(MOVE_FLIGHT, 2.0f);
}
return 10000;
case 13:
me->Yell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL);
return 10000;
case 14:
me->SetVisible(false);
me->ClearInCombat();
if (map->IsDungeon())
{
InstanceMap::PlayerList const &PlayerList = map->GetPlayers();
for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (i->GetSource()->IsAlive())
{
if (i->GetSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE)
i->GetSource()->CompleteQuest(9645);
}
}
}
return 50000;
case 15:
if (arca)
arca->DealDamage(arca, arca->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
return 5000;
default : return 9999999;
}
}
示例8: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!EventBegun) return;
if (EndEventTimer)
{
if (EndEventTimer <= diff)
{
if (DeathCount > 3)
{
if (pInstance)
{
if (Creature* VoiceTrigger = (Unit::GetCreature(*me, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))))
VoiceTrigger->DealDamage(VoiceTrigger, VoiceTrigger->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, DONE);
//me->SummonCreature(AKAMAID, 746.466980f, 304.394989f, 311.90208f, 6.272870f, TEMPSUMMON_DEAD_DESPAWN, 0);
}
me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
return;
}
Creature* pMember = (Unit::GetCreature(*me, Council[DeathCount]));
if (pMember && pMember->isAlive())
pMember->DealDamage(pMember, pMember->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
++DeathCount;
EndEventTimer = 1500;
} else EndEventTimer -= diff;
}
if (CheckTimer)
{
if (CheckTimer <= diff)
{
uint8 EvadeCheck = 0;
for (uint8 i = 0; i < 4; ++i)
{
if (Council[i])
{
if (Creature* Member = (Unit::GetCreature((*me), Council[i])))
{
// This is the evade/death check.
if (Member->isAlive() && !Member->getVictim())
++EvadeCheck; //If all members evade, we reset so that players can properly reset the event
else if (!Member->isAlive()) // If even one member dies, kill the rest, set instance data, and kill self.
{
EndEventTimer = 1000;
CheckTimer = 0;
return;
}
}
}
}
if (EvadeCheck > 3)
Reset();
CheckTimer = 2000;
} else CheckTimer -= diff;
}
}
示例9: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (!DrainingCrystal)
{
uint32 maxPowerMana = m_creature->GetMaxPower(POWER_MANA);
if (maxPowerMana && ((m_creature->GetPower(POWER_MANA)*100 / maxPowerMana) < 10))
{
if (DrainLifeTimer < diff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
DoCastSpellIfCan(pTarget, SPELL_DRAIN_LIFE);
DrainLifeTimer = 10000;
}else DrainLifeTimer -= diff;
// Heroic only
if (!m_bIsRegularMode)
{
if (DrainManaTimer < diff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1))
DoCastSpellIfCan(pTarget, SPELL_DRAIN_MANA);
DrainManaTimer = 10000;
}else DrainManaTimer -= diff;
}
}
if (FelExplosionTimer < diff)
{
if (!m_creature->IsNonMeleeSpellCasted(false))
{
DoCastSpellIfCan(m_creature, SPELL_FEL_EXPLOSION);
FelExplosionTimer = 2000;
}
}else FelExplosionTimer -= diff;
// If below 10% mana, start recharging
maxPowerMana = m_creature->GetMaxPower(POWER_MANA);
if (maxPowerMana && ((m_creature->GetPower(POWER_MANA)*100 / maxPowerMana) < 10))
{
if (DrainCrystalTimer < diff)
{
SelectNearestCrystal();
if (m_bIsRegularMode)
DrainCrystalTimer = urand(20000, 25000);
else
DrainCrystalTimer = urand(10000, 15000);
}else DrainCrystalTimer -= diff;
}
}else
{
if (IsDraining)
{
if (EmpowerTimer < diff)
{
IsDraining = false;
DrainingCrystal = false;
DoScriptText(SAY_EMPOWERED, m_creature);
Creature* CrystalChosen = m_creature->GetMap()->GetCreature(CrystalGUID);
if (CrystalChosen && CrystalChosen->isAlive())
// Use Deal Damage to kill it, not SetDeathState.
CrystalChosen->DealDamage(CrystalChosen, CrystalChosen->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
CrystalGUID = 0;
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
}else EmpowerTimer -= diff;
}
}
DoMeleeAttackIfReady(); // No need to check if we are draining crystal here, as the spell has a stun.
}
示例10: UpdateAI
//.........这里部分代码省略.........
if (m_uiFrostBoltNovaTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_FROST_BOLT_NOVA : SPELL_FROST_BOLT_NOVA_H) == CAST_OK)
m_uiFrostBoltNovaTimer = 15000;
}
else
m_uiFrostBoltNovaTimer -= uiDiff;
//Check for Mana Detonation
if (m_uiManaDetonationTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,1))
if (pTarget->getPowerType() == POWER_MANA)
{
int32 curPower = pTarget->GetPower(POWER_MANA);
if (curPower < (m_bIsRegularMode ? 4000 : 5500))
return;
m_creature->CastSpell(pTarget,SPELL_MANA_DETONATION, true);
int32 manareduction = m_bIsRegularMode ? urand(2500,4000) : urand(3500,5500);
int32 mana = curPower - manareduction;
pTarget->SetPower(POWER_MANA, mana);
Map *map = m_creature->GetMap();
if (map->IsDungeon())
{
Map::PlayerList const &PlayerList = map->GetPlayers();
if (!PlayerList.isEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (i->getSource()->isAlive() && pTarget->GetDistance2d(i->getSource()->GetPositionX(), i->getSource()->GetPositionY()) < 15)
i->getSource()->DealDamage(i->getSource(), manareduction, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, true);
}
}
}
if (rand()%2)
DoScriptText(SAY_SPECIAL1_MANA_DET, m_creature);
m_uiManaDetonationTimer = 15000;
}else m_uiManaDetonationTimer -= uiDiff;
if (m_uiShadowFissureTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
m_creature->CastSpell(pTarget,SPELL_SHADOW_FISSURE,true);
m_uiShadowFissureActiveTimer = 3000;
if (urand(0, 1))
DoScriptText(SAY_SPECIAL3_MANA_DET, m_creature);
}
m_uiShadowFissureTimer = 25000;
}
else
m_uiShadowFissureTimer -= uiDiff;
if(m_uiShadowFissureActiveTimer)
if(m_uiShadowFissureActiveTimer < uiDiff)
{
// hack for shadow fissure
// TODO: find energy beam visual spell
m_uiShadowFissureActiveTimer = 0;
Creature* pFissure = GetClosestCreatureWithEntry(m_creature, NPC_SHADOW_FISSURE, 100.0f);
示例11: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
if (step)
{
if (timer < uiDiff)
{
Creature* curr = NULL;
switch (step)
{
case 1:
float fX, fY, fZ;
if (GameObject* pKeg = me->FindNearestGameObject(GO_TAINTED_KEG, 10.000000))
{
std::list<Creature*> lCrea;
me->GetCreatureListWithEntryInGrid(lCrea, NPC_CAPTURED_FARMER, 30.0f);
for (std::list<Creature*>::iterator it = lCrea.begin(); it != lCrea.end(); ++it)
{
if ((*it)->isAlive())
{
Farmers.push_back((*it)->GetGUID());
pKeg->GetContactPoint((*it), fX, fY, fZ, CONTACT_DISTANCE);
(*it)->GetMotionMaster()->MovePoint(1, fX, fY, fZ, MOVE_PATHFINDING);
}
}
}
timer = 4500;
step++;
break;
case 2:
if (curr = me->GetMap()->GetCreature(Farmers.front()))
curr->SetStandState(UNIT_STAND_STATE_KNEEL);
timer = 2000;
step++;
break;
case 3:
if (GameObject* pBaril = me->FindNearestGameObject(GO_TAINTED_KEG, 10.000000))
{
float fX, fY, fZ;
pBaril->GetPosition(fX, fY, fZ);
me->SummonGameObject(GO_TAINTED_KEG_SMOKE, fX, fY, fZ + 1, 0, 0, 0, 0, 0, 120);
}
if (curr = me->GetMap()->GetCreature(Farmers.front()))
curr->SetStandState(UNIT_STAND_STATE_STAND);
curr = NULL;
while (!Farmers.empty())
{
if (curr = me->GetMap()->GetCreature(Farmers.front()))
curr->DealDamage(curr, curr->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
Farmers.pop_front();
curr = NULL;
}
timer = 20000;
step++;
break;
case 4:
timer = 0;
step = 0;
break;
}
}
else
timer -= uiDiff;
}
}