void UpdateAI(const uint32 diff) { if (!Vorpil) { me->DealDamage(me, me->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); return; } if (move <= diff) { if (sacrificed) { SpellEntry *spell = (SpellEntry *)GetSpellStore()->LookupEntry(HeroicMode?H_SPELL_EMPOWERING_SHADOWS:SPELL_EMPOWERING_SHADOWS); if (spell) Vorpil->AddAura(new EmpoweringShadowsAura(spell, 0, NULL, Vorpil, me)); Vorpil->SetHealth(Vorpil->GetHealth()+Vorpil->GetMaxHealth()/25); DoCast(me, SPELL_SHADOW_NOVA, true); me->DealDamage(me, me->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); return; } me->GetMotionMaster()->MoveFollow(Vorpil, 0, 0); if (me->GetDistance(Vorpil) < 3) { DoCast(me, SPELL_SACRIFICE, false); sacrificed = true; move = 500; return; } if (!Vorpil->isInCombat() || Vorpil->isDead()) { me->DealDamage(me, me->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); return; } move = 1000; } else move -= diff; }
void HandleScript(SpellEffIndex /*effIndex*/) { Unit* target = GetHitUnit(); int32 casterHpPct = (int32) GetCaster()->GetHealthPct(); uint32 newHp = target->CountPctFromMaxHealth(casterHpPct); if (newHp <= 0) newHp = target->GetMaxHealth() - 1; target->SetHealth(newHp); }
void EnfeebleResetHealth() { for (uint8 i = 0; i < 5; ++i) { Unit *pTarget = Unit::GetUnit(*me, enfeeble_targets[i]); if (pTarget && pTarget->isAlive()) pTarget->SetHealth(enfeeble_health[i]); enfeeble_targets[i] = 0; enfeeble_health[i] = 0; } }
void EnfeebleResetHealth() { for (uint8 i = 0; i < 5; ++i) { Unit* target = ObjectAccessor::GetUnit(*me, enfeeble_targets[i]); if (target && target->IsAlive()) target->SetHealth(enfeeble_health[i]); enfeeble_targets[i].Clear(); enfeeble_health[i] = 0; } }
void EnfeebleResetHealth() { for(int i = 0; i < 5; ++i) { Unit *target = Unit::GetUnit(*m_creature, enfeeble_targets[i]); if (target && target->isAlive()) target->SetHealth(enfeeble_health[i]); enfeeble_targets[i] = 0; enfeeble_health[i] = 0; } }
bool ChatHandler::HandleKillCommand(const char* args, WorldSession* m_session) { Unit* target = m_session->GetPlayer()->GetMapMgr()->GetUnit(m_session->GetPlayer()->GetSelection()); if(target == 0) { RedSystemMessage(m_session, "A valid selection is required."); return true; } switch(target->GetTypeId()) { case TYPEID_PLAYER: sGMLog.writefromsession(m_session, "used kill command on PLAYER %s", TO< Player* >(target)->GetName()); break; case TYPEID_UNIT: sGMLog.writefromsession(m_session, "used kill command on CREATURE %u [%s], sqlid %u%s", TO< Creature* >(target)->GetEntry(), TO< Creature* >(target)->GetCreatureInfo()->Name, TO< Creature* >(target)->GetSQL_id(), m_session->GetPlayer()->InGroup() ? ", in group" : ""); break; } // If we're killing a player, send a message indicating a gm killed them. if(target->IsPlayer()) { Player* plr = TO< Player* >(target); // cebernic: kill just is kill,don't use dealdamage for it // godcheat will not stop the killing,godcheat for DealDamage() only. //m_session->GetPlayer()->DealDamage(plr, plr->GetHealth()*2,0,0,0); plr->SetHealth(0); plr->KillPlayer(); BlueSystemMessageToPlr(plr, "%s killed you with a GM command.", m_session->GetPlayer()->GetName()); } else { // Cast insta-kill. SpellEntry* se = dbcSpell.LookupEntryForced(5); if(se == NULL) return false; SpellCastTargets targets(target->GetGUID()); Spell* sp = sSpellFactoryMgr.NewSpell(m_session->GetPlayer(), se, true, 0); sp->prepare(&targets); target->SetHealth(0); /* SpellEntry * se = dbcSpell.LookupEntry(20479); if(se == 0) return false; SpellCastTargets targets(target->GetGUID()); Spell * sp = sSpellFactoryMgr.NewSpell(target, se, true, 0); sp->prepare(&targets);*/ } return true; }
Unit* Map::CreateUnit( UnitType* unitType, Faction* owner, const Vec2s& tilePos, int health, int ammo, int supplies ) { // Create a new Unit. Unit* unit = new Unit(); // Load Unit properties. unit->SetUnitType( unitType ); unit->SetOwner( owner ); // Get the Tile where the Unit will be placed. Iterator tile = GetTile( tilePos ); assertion( tile.IsValid(), "Cannot create Unit at invalid Tile (%d,%d)!", tilePos.x, tilePos.y ); assertion( tile->IsEmpty(), "Cannot create Unit at Tile (%d,%d) because the Tile is occupied by another Unit!", tilePos.x, tilePos.y ); // Set the health and ammo for the Unit. if( health >= 0 ) { unit->SetHealth( health ); } else { unit->ResetHealth(); } if( ammo >= 0 ) { unit->SetAmmo( ammo ); } else { unit->ResetAmmo(); } if( supplies >= 0 ) { unit->SetSupplies( supplies ); } else { unit->ResetSupplies(); } // Initialize the Unit. unit->Init( this, tile ); // Place the Unit into the Tile. tile->SetUnit( unit ); // Add the Unit to the list of Units. mUnits.push_back( unit ); return unit; }
void DamageTaken(Unit * /*done_by*/, uint32 &damage) { Unit *pOtherBoss = GetOtherBoss(); if (pOtherBoss) { float dPercent = ((float) damage) / ((float) me->GetMaxHealth()); int odmg = (int) (dPercent * ((float) pOtherBoss->GetMaxHealth())); int ohealth = pOtherBoss->GetHealth() - odmg; pOtherBoss->SetHealth(ohealth > 0 ? ohealth : 0); if (ohealth <= 0) { pOtherBoss->setDeathState(JUST_DIED); pOtherBoss->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } } }
//Edit Player HP static bool HandleModifyHPCommand(ChatHandler* handler, const char* args) { if (!*args) return false; int32 hp = atoi((char*)args); int32 hpm = atoi((char*)args); if (hpm < hp) { hpm = hp; } if (hp < 1) { handler->SendSysMessage(LANG_BAD_VALUE); handler->SetSentErrorMessage(true); return false; } if (handler->GetSession()->GetSecurity() >= SEC_ADMINISTRATOR) // admins can set HP of any unit { Unit *unit = handler->getSelectedUnit(); if (!unit) return false; unit->SetMaxHealth(hpm); unit->SetHealth(hp); return true; } Player* target = handler->getSelectedPlayer(); if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); handler->SetSentErrorMessage(true); return false; } if (handler->HasLowerSecurity(target, 0)) return false; handler->PSendSysMessage(LANG_YOU_CHANGE_HP, handler->GetNameLink(target).c_str(), hp, hpm); if (handler->needReportToTarget(target)) (ChatHandler(target)).PSendSysMessage(LANG_YOURS_HP_CHANGED, handler->GetNameLink().c_str(), hp, hpm); target->SetMaxHealth(hpm); target->SetHealth(hp); return true; }
void SonicBoomEffect() { std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) { //Not do anything without aura, spell can be resisted! if (pTarget->HasAura(SPELL_SONIC_BOOM_CAST) && m_creature->IsWithinDistInMap(pTarget, 34.0f)) { //This will be wrong calculation. Also, comments suggest it must deal damage pTarget->SetHealth(uint32(pTarget->GetMaxHealth() - pTarget->GetMaxHealth() * 0.8)); } } } }
void SonicBoomEffect() { ThreatList const& tList = m_creature->getThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr) { Unit* target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (target && target->GetTypeId() == TYPEID_PLAYER) { //Not do anything without aura, spell can be resisted! if (target->HasAura(SPELL_SONIC_BOOM_CAST, EFFECT_INDEX_1) && m_creature->IsWithinDistInMap(target, 34.0f)) { //This will be wrong calculation. Also, comments suggest it must deal damage target->SetHealth(uint32(target->GetMaxHealth() - target->GetMaxHealth() * 0.8)); } } } }
void SonicBoomEffect() { ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (target && target->GetTypeId() == TYPEID_PLAYER) { //Not do anything without aura, spell can be resisted! if (target->HasAura(SPELL_SONIC_BOOM_CAST) && me->IsWithinDistInMap(target, 34.0f)) { //This will be wrong calculation. Also, comments suggest it must deal damage target->SetHealth(target->CountPctFromMaxHealth(20)); } } } }
void SonicBoomEffect() { std::vector<ObjectGuid> vGuids; m_creature->FillGuidsListFromThreatList(vGuids); for (std::vector<ObjectGuid>::const_iterator itr = vGuids.begin();itr != vGuids.end(); ++itr) { Unit* target = m_creature->GetMap()->GetUnit(*itr); if (target && target->GetTypeId() == TYPEID_PLAYER) { //Not do anything without aura, spell can be resisted! if (target->HasAura(SPELL_SONIC_BOOM_CAST, EFFECT_INDEX_1) && m_creature->IsWithinDistInMap(target, 34.0f)) { //This will be wrong calculation. Also, comments suggest it must deal damage target->SetHealth(uint32(target->GetMaxHealth() - target->GetMaxHealth() * 0.8)); } } } }
void EnfeebleHealthEffect() { const SpellEntry *info = GetSpellStore()->LookupEntry(SPELL_ENFEEBLE_EFFECT); if (!info) return; ThreatList const& tList = m_creature->getThreatManager().getThreatList(); std::vector<Unit *> targets; if (tList.empty()) return; //begin + 1 , so we don't target the one with the highest threat ThreatList::const_iterator itr = tList.begin(); std::advance(itr, 1); for(; itr!= tList.end(); ++itr) //store the threat list in a different container { Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //only on alive players if (target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER) targets.push_back(target); } //cut down to size if we have more than 5 targets while(targets.size() > 5) targets.erase(targets.begin()+rand()%targets.size()); int i = 0; for(std::vector<Unit *>::iterator iter = targets.begin(); iter!= targets.end(); ++iter, ++i) { Unit *target = *iter; if (target) { enfeeble_targets[i] = target->GetGUID(); enfeeble_health[i] = target->GetHealth(); target->CastSpell(target, SPELL_ENFEEBLE, true, 0, 0, m_creature->GetGUID()); target->SetHealth(1); } } }
SPELL_EFFECT_OVERRIDE_RETURNS AH_16191( Aura *aur, bool apply, uint8 i ) { if( apply == true && aur->GetSpellProto()->eff[i].EffectApplyAuraName == SPELL_AURA_MOD_STAT ) { Unit *c = aur->GetUnitCaster(); if( c ) { Unit *owner = c->GetTopOwner(); aur->mod->m_amount = aur->GetSpellProto()->eff[i].EffectBasePoints * owner->GetStat( STAT_SPIRIT ) / 100; //my max health should be owner's max health uint32 MyMaxHealth = owner->GetMaxHealth() * 10 / 100; if(c->GetMaxHealth() < MyMaxHealth ) { c->SetMaxHealth( MyMaxHealth ); c->SetHealth( MyMaxHealth ); } } } return SPELL_EFFECT_OVERRIDE_CONTINUE_EXECUTION; }
void SpellHit(Unit *caster, const SpellEntry *spell) { // workaround for linked aura /*if(spell->Id == SPELL_VAPOR_FORCE) { caster->CastSpell(caster, SPELL_VAPOR_TRIGGER, true); }*/ // workaround for mind control if(spell->Id == SPELL_FOG_INFORM) { float x, y, z; caster->GetPosition(x, y, z); Unit* summon = m_creature->SummonCreature(MOB_DEAD, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); if(summon) { summon->SetMaxHealth(caster->GetMaxHealth()); summon->SetHealth(caster->GetMaxHealth()); summon->CastSpell(summon, SPELL_FOG_CHARM, true); summon->CastSpell(summon, SPELL_FOG_CHARM2, true); } m_creature->DealDamage(caster, caster->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } }
void StartIntro() { if (!Intro || IsIntro) return; error_log("Start Intro"); Madrigosa = Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_MADRIGOSA)); if (Madrigosa) { ((Creature*)Madrigosa)->Respawn(); Madrigosa->setActive(true); IsIntro = true; Madrigosa->SetMaxHealth(m_creature->GetMaxHealth()); Madrigosa->SetHealth(m_creature->GetMaxHealth()); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->Attack(Madrigosa, true); Madrigosa->Attack(m_creature, true); }else { //Madrigosa not found, end intro error_log("Madrigosa was not found"); EndIntro(); } }
void createClassMirrors() { for (int i = 0; i <= 5; i++) { Map* pMap = m_creature->GetMap(); Map::PlayerList const &players = pMap->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if(Unit* target = m_creature->GetMap()->GetUnit(itr->getSource()->GetGUID())) { Unit* pClone = m_creature->SummonCreature(m_bIsRegularMode ? CLONE : CLONE_H, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (pClone) { pClone->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_PASSIVE); pClone->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE); pClone->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); pClone->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_UNK_6); pClone->SetDisplayId(target->GetNativeDisplayId()); pClone->SetName(target->GetName()); pClone->setFaction(FAC_HOSTILE); switch (target->getClass()) { case CLASS_PRIEST: pClone->SetMaxHealth(m_bIsRegularMode ? CLONE_HEALTH_PRIEST : CLONE_HEALTH_PRIEST_H); break; case CLASS_PALADIN: pClone->SetMaxHealth(m_bIsRegularMode ? CLONE_HEALTH_PALA : CLONE_HEALTH_PALA_H); break; case CLASS_WARLOCK: pClone->SetMaxHealth(m_bIsRegularMode ? CLONE_HEALTH_WARLOCK : CLONE_HEALTH_WARLOCK_H); break; case CLASS_MAGE: pClone->SetMaxHealth(m_bIsRegularMode ? CLONE_HEALTH_MAGE : CLONE_HEALTH_MAGE_H); break; case CLASS_ROGUE: pClone->SetMaxHealth(m_bIsRegularMode ? CLONE_HEALTH_ROGUE : CLONE_HEALTH_ROGUE_H); break; case CLASS_WARRIOR: pClone->SetMaxHealth(m_bIsRegularMode ? CLONE_HEALTH_WARRIOR : CLONE_HEALTH_WARRIOR_H); break; case CLASS_DRUID: pClone->SetMaxHealth(m_bIsRegularMode ? CLONE_HEALTH_DRUID : CLONE_HEALTH_DRUID_H); break; case CLASS_SHAMAN: pClone->SetMaxHealth(m_bIsRegularMode ? CLONE_HEALTH_SHAMAN : CLONE_HEALTH_SHAMAN_H); break; case CLASS_HUNTER: pClone->SetMaxHealth(m_bIsRegularMode ? CLONE_HEALTH_HUNT : CLONE_HEALTH_HUNT_H); break; case CLASS_DEATH_KNIGHT: pClone->SetMaxHealth(m_bIsRegularMode ? CLONE_HEALTH_DK : CLONE_HEALTH_DK_H); break; default: break; } pClone->SetHealth(pClone->GetMaxHealth()); pClone->Attack(target, true); pClone->AddThreat(target, 10.0f); cloneGUIDList.push_back(pClone->GetGUID()); } switch(i) { case 1: pClone->SetPhaseMask(16, true); clone16GUIDList.push_back(pClone->GetGUID()); break; case 2: pClone->SetPhaseMask(32, true); clone32GUIDList.push_back(pClone->GetGUID()); break; case 3: pClone->SetPhaseMask(64, true); clone64GUIDList.push_back(pClone->GetGUID()); break; case 4: pClone->SetPhaseMask(128, true); clone128GUIDList.push_back(pClone->GetGUID()); break; case 5: pClone->SetPhaseMask(256, true); clone256GUIDList.push_back(pClone->GetGUID()); break; default: break; } } } } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if(StormCount) { Unit* target = Unit::GetUnit(*m_creature, CloudGUID); if(!target || !target->isAlive()) { EnterEvadeMode(); return; } else if(Unit* Cyclone = Unit::GetUnit(*m_creature, CycloneGUID)) Cyclone->CastSpell(target, 25160, true); // keep casting or... if(StormSequenceTimer < diff) { HandleStormSequence(target); }else StormSequenceTimer -= diff; return; } if (Enrage_Timer < diff) { DoYell(SAY_ONENRAGE, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_ONENRAGE); m_creature->CastSpell(m_creature, SPELL_BERSERK, true); Enrage_Timer = 600000; }else Enrage_Timer -= diff; if (StaticDisruption_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if(!target) target = m_creature->getVictim(); TargetGUID = target->GetGUID(); m_creature->CastSpell(target, SPELL_STATIC_DISRUPTION, false); m_creature->SetInFront(m_creature->getVictim()); StaticDisruption_Timer = (10+rand()%8)*1000; // < 20s /*if(float dist = m_creature->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f) dist = 5.0f; SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/ }else StaticDisruption_Timer -= diff; if (GustOfWind_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if(!target) target = m_creature->getVictim(); DoCast(target, SPELL_GUST_OF_WIND); GustOfWind_Timer = (20+rand()%10)*1000; //20 to 30 seconds(bosskillers) } else GustOfWind_Timer -= diff; if (CallLighting_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_CALL_LIGHTNING); CallLighting_Timer = (12 + rand()%5)*1000; //totaly random timer. can't find any info on this } else CallLighting_Timer -= diff; if (!isRaining && ElectricalStorm_Timer < 8000 + rand()%5000) { SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f); isRaining = true; } if (ElectricalStorm_Timer < diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); if(!target) { EnterEvadeMode(); return; } target->CastSpell(target, 44007, true);//cloud visual m_creature->CastSpell(target, SPELL_ELECTRICAL_STORM, false);//storm cyclon + visual float x,y,z; target->GetPosition(x,y,z); if (target) { target->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); target->SendMonsterMove(x,y,m_creature->GetPositionZ()+15,0); } Unit *Cloud = m_creature->SummonTrigger(x, y, m_creature->GetPositionZ()+16, 0, 15000); if(Cloud) { CloudGUID = Cloud->GetGUID(); Cloud->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); Cloud->StopMoving(); Cloud->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); Cloud->setFaction(35); Cloud->SetMaxHealth(9999999); Cloud->SetHealth(9999999); Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } ElectricalStorm_Timer = 60000; //60 seconds(bosskillers) StormCount = 1; StormSequenceTimer = 0; } else ElectricalStorm_Timer -= diff; if (SummonEagles_Timer < diff) { DoYell(SAY_ONSUMMON, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_ONSUMMON); float x, y, z; m_creature->GetPosition(x, y, z); for (uint8 i = 0; i < 8; i++) { Unit* bird = Unit::GetUnit(*m_creature,BirdGUIDs[i]); if(!bird)//they despawned on die { if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { x = target->GetPositionX() + 10 - rand()%20; y = target->GetPositionY() + 10 - rand()%20; z = target->GetPositionZ() + 6 + rand()%5 + 10; if(z > 95) z = 95 - rand()%5; } Creature *pCreature = m_creature->SummonCreature(MOB_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (pCreature) { pCreature->AddThreat(m_creature->getVictim(), 1.0f); pCreature->AI()->AttackStart(m_creature->getVictim()); BirdGUIDs[i] = pCreature->GetGUID(); } } } SummonEagles_Timer = 999999; } else SummonEagles_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; //Check_Timer for the death of LorKhan and Zath. if (!WasDead && Check_Timer < diff) { if (m_pInstance) { if (m_pInstance->GetData(TYPE_LORKHAN) == SPECIAL) { //Resurrect LorKhan if (Unit *pLorKhan = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_LORKHAN))) { pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pLorKhan->setFaction(14); pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pLorKhan->SetHealth(int(pLorKhan->GetMaxHealth()*1.0)); m_pInstance->SetData(TYPE_LORKHAN, DONE); } } if (m_pInstance->GetData(TYPE_ZATH) == SPECIAL) { //Resurrect Zath Unit *pZath = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_ZATH)); if (pZath) { pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pZath->setFaction(14); pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pZath->SetHealth(int(pZath->GetMaxHealth()*1.0)); m_pInstance->SetData(TYPE_ZATH, DONE); } } } Check_Timer = 5000; }else Check_Timer -= diff; if (!PhaseTwo && MortalCleave_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MORTALCLEAVE); MortalCleave_Timer = 15000 + rand()%5000; }else MortalCleave_Timer -= diff; if (!PhaseTwo && Silence_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SILENCE); Silence_Timer = 20000 + rand()%5000; }else Silence_Timer -= diff; if (!PhaseTwo && !WasDead && m_creature->GetHealth() <= m_creature->GetMaxHealth() * 0.05) { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetStandState(UNIT_STAND_STATE_SLEEP); m_creature->AttackStop(); if (m_pInstance) m_pInstance->SetData(TYPE_THEKAL, SPECIAL); WasDead=true; } //Thekal will transform to Tiger if he died and was not resurrected after 10 seconds. if (!PhaseTwo && WasDead) { if (Resurrect_Timer < diff) { DoCast(m_creature,SPELL_TIGER_FORM); m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f); m_creature->SetStandState(UNIT_STAND_STATE_STAND); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetHealth(int(m_creature->GetMaxHealth()*1.0)); const CreatureInfo *cinfo = m_creature->GetCreatureInfo(); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40))); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40))); m_creature->UpdateDamagePhysical(BASE_ATTACK); DoResetThreat(); PhaseTwo = true; }else Resurrect_Timer -= diff; } if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth() == 100) && WasDead) { WasDead = false; } if (PhaseTwo) { if (Charge_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) { DoCast(target,SPELL_CHARGE); DoResetThreat(); AttackStart(target); } Charge_Timer = 15000 + rand()%7000; }else Charge_Timer -= diff; if (Frenzy_Timer < diff) { DoCast(m_creature,SPELL_FRENZY); Frenzy_Timer = 30000; }else Frenzy_Timer -= diff; if (ForcePunch_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SILENCE); ForcePunch_Timer = 16000 + rand()%5000; }else ForcePunch_Timer -= diff; if (SummonTigers_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SUMMONTIGERS); SummonTigers_Timer = 10000 + rand()%4000; }else SummonTigers_Timer -= diff; if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 11) && !Enraged) { DoCast(m_creature, SPELL_ENRAGE); Enraged = true; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; // Mortal Wound if (m_uiMortalWoundTimer < uiDiff) { DoCast(m_creature->getVictim(), SPELL_MORTALWOUND); m_uiMortalWoundTimer = 10000; } else m_uiMortalWoundTimer -= uiDiff; //Decimate_Timer if (m_uiDecimateTimer < uiDiff) { DoCast(m_creature->getVictim(),SPELL_DECIMATE); // need core support // workaround below std::list<HostileReference*> t_list = m_creature->getThreatManager().getThreatList(); if (t_list.size()) { //begin + 1 , so we don't target the one with the highest threat std::list<HostileReference*>::iterator itr = t_list.begin(); std::advance(itr, 1); for(; itr!= t_list.end(); ++itr) { Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER && (target->GetHealth() > target->GetMaxHealth() * 0.05)) target->SetHealth(target->GetMaxHealth() * 0.05); } } // Move Zombies if (!m_lZombieGUIDList.empty()) { for(std::list<uint64>::iterator itr = m_lZombieGUIDList.begin(); itr != m_lZombieGUIDList.end(); ++itr) if (Creature* pTemp = (Creature*)Unit::GetUnit(*m_creature, *itr)) if (pTemp->isAlive()) { ((mob_zombie_chowsAI*)pTemp->AI())->bIsForceMove = true; if (m_creature->GetHealth() > m_creature->GetMaxHealth() * 0.05) // remove when SPELL_DECIMATE is working pTemp->SetHealth(pTemp->GetMaxHealth() * 0.02); pTemp->AddThreat(m_creature, 1000000000.0f); // force move toward to Gluth } } m_uiDecimateTimer = (m_bIsRegularMode ? 100000 : 120000); }else m_uiDecimateTimer -= uiDiff; // Enrage if (m_uiEnrageTimer < uiDiff) { DoCast(m_creature, m_bIsRegularMode ? SPELL_ENRAGE : SPELL_ENRAGE_H); m_uiEnrageTimer = 60000; } else m_uiEnrageTimer -= uiDiff; if (RangeCheck_Timer < uiDiff) { if (!m_lZombieGUIDList.empty()) { for(std::list<uint64>::iterator itr = m_lZombieGUIDList.begin(); itr != m_lZombieGUIDList.end(); ++itr) if (Creature* pTemp = (Creature*)Unit::GetUnit(*m_creature, *itr)) if (pTemp->isAlive() && m_creature->IsWithinDistInMap(pTemp, ATTACK_DISTANCE)) { DoScriptText(EMOTE_ZOMBIE, m_creature); m_creature->SetHealth(m_creature->GetHealth() + m_creature->GetMaxHealth() * 0.05); pTemp->ForcedDespawn(); } } RangeCheck_Timer = 1000; }else RangeCheck_Timer -= uiDiff; //Summon_Timer if (Summon_Timer < uiDiff) { for(uint8 i = 0; i < (m_bIsRegularMode ? 1 : 2); i++) { if (Creature* pZombie = m_creature->SummonCreature(NPC_ZOMBIE_CHOW,ADD_1X,ADD_1Y,ADD_1Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000)) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { pZombie->AddThreat(pTarget); m_lZombieGUIDList.push_back(pZombie->GetGUID()); } } } Summon_Timer = 10000; } else Summon_Timer -= uiDiff; // Berserk if (m_uiBerserkTimer < uiDiff) { DoCastSpellIfCan(m_creature, SPELL_BERSERK, CAST_TRIGGERED); m_uiBerserkTimer = MINUTE*5*IN_MILLISECONDS; } else m_uiBerserkTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (StormCount) { Unit* pTarget = Unit::GetUnit(*me, CloudGUID); if (!pTarget || !pTarget->IsAlive()) { EnterEvadeMode(); return; } else if (Unit* Cyclone = Unit::GetUnit(*me, CycloneGUID)) Cyclone->CastSpell(pTarget, 25160, true); // keep casting or... if (StormSequenceTimer <= diff) HandleStormSequence(pTarget); else StormSequenceTimer -= diff; return; } if (Enrage_Timer <= diff) { me->MonsterYell(SAY_ONENRAGE, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_ONENRAGE); DoCast(me, SPELL_BERSERK, true); Enrage_Timer = (diff - Enrage_Timer) + 600000; } else Enrage_Timer -= diff; if (StaticDisruption_Timer <= diff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!pTarget) pTarget = me->GetVictim(); TargetGUID = pTarget->GetGUID(); DoCast(pTarget, SPELL_STATIC_DISRUPTION, false); me->SetInFront(me->GetVictim()); StaticDisruption_Timer = (diff - StaticDisruption_Timer) + (10 + rand() % 8) * 1000; // < 20s /*if (float dist = me->IsWithinDist3d(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 5.0f) dist = 5.0f; SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/ } else StaticDisruption_Timer -= diff; if (GustOfWind_Timer <= diff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!pTarget) pTarget = me->GetVictim(); DoCast(pTarget, SPELL_GUST_OF_WIND); GustOfWind_Timer = (diff - GustOfWind_Timer) + (20 + rand() % 10) * 1000; //20 to 30 seconds(bosskillers) } else GustOfWind_Timer -= diff; if (CallLighting_Timer <= diff) { DoCastVictim( SPELL_CALL_LIGHTNING); CallLighting_Timer = (diff - CallLighting_Timer) + (12 + rand() % 5) * 1000; //totaly random timer. can't find any info on this } else CallLighting_Timer -= diff; if (!isRaining && ElectricalStorm_Timer < 8000 + urand(0, 5000)) { SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f); isRaining = true; } if (ElectricalStorm_Timer <= diff) { Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); if (!pTarget) { EnterEvadeMode(); return; } pTarget->CastSpell(pTarget, SPELL_ELECTRICAL_STORM_VISUAL, true);//cloud visual DoCast(pTarget, SPELL_ELECTRICAL_STORM, false);//storm cyclon + visual float x, y, z; pTarget->GetPosition(x, y, z); pTarget->SetLevitate(true); Movement::MoveSplineInit init(*me); init.MoveTo(x, y, me->GetPositionZ() + 15.0f, true); init.Launch(); Unit* Cloud = me->SummonTrigger(x, y, me->GetPositionZ() + 16, 0, 15000); if (Cloud) { CloudGUID = Cloud->GetGUID(); Cloud->SetLevitate(true); Cloud->StopMoving(); Cloud->SetObjectScale(1.0f); Cloud->setFaction(35); Cloud->SetMaxHealth(9999999); Cloud->SetHealth(9999999); Cloud->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } ElectricalStorm_Timer = (diff - ElectricalStorm_Timer) + 60000; //60 seconds (bosskillers) StormCount = 1; StormSequenceTimer = 0; } else ElectricalStorm_Timer -= diff; if (SummonEagles_Timer <= diff) { if (urand(0, 1)) { me->MonsterYell(SAY_ONSUMMON2, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_ONSUMMON1); } else { me->MonsterYell(SAY_ONSUMMON2, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_ONSUMMON2); } float x, y, z; me->GetPosition(x, y, z); for (uint8 i = 0; i < 8; ++i) { if (!Unit::GetUnit(*me, BirdGUIDs[i])) // they despawn on death { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { x = pTarget->GetPositionX() + irand(-10, 10); y = pTarget->GetPositionY() + irand(-10, 10); z = pTarget->GetPositionZ() + urand(16, 20); if (z > 95) z = 95 - urand(0, 5); } if (Creature* pCreature = me->SummonCreature(MOB_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0)) { pCreature->AddThreat(me->GetVictim(), 1.0f); pCreature->AI()->AttackStart(me->GetVictim()); BirdGUIDs[i] = pCreature->GetGUID(); } } } SummonEagles_Timer = (diff - SummonEagles_Timer) + 999999; } else SummonEagles_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) return; //MortalWound_Timer if (MortalWound_Timer < diff) { //Cast DoCast(m_creature->getVictim(),SPELL_MORTALWOUND); //10 seconds MortalWound_Timer = 10000; }else MortalWound_Timer -= diff; //Decimate_Timer if (Decimate_Timer < diff) { //Cast DoCast(m_creature,SPELL_DECIMATE); Unit* Temp = NULL; std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); for (; i != m_creature->getThreatManager().getThreatList().end(); ++i) { Temp = Unit::GetUnit((*m_creature),(*i)->getUnitGuid()); if (Temp ) Temp->SetHealth(Temp->GetMaxHealth()* 0.05); } //105 seconds until we should cast this agian Decimate_Timer = 105000; }else Decimate_Timer -= diff; //TerrifyingRoar_Timer if (TerrifyingRoar_Timer < diff) { //Cast DoCast(m_creature->getVictim(),SPELL_TERRIFYINGROAR); //20 seconds until we should cast this agian TerrifyingRoar_Timer = 20000; }else TerrifyingRoar_Timer -= diff; //Frenzy_Timer if (Frenzy_Timer < diff) { //Cast DoCast(m_creature,SPELL_FRENZY); //10.5 seconds until we should cast this agian Frenzy_Timer = 10500; }else Frenzy_Timer -= diff; if (Enrage_Timer < diff) { //Cast DoCast(m_creature,SPELL_ENRAGE); //61 seconds until we should cast this agian Enrage_Timer = 61000; }else Enrage_Timer -= diff; //Summon_Timer if (Summon_Timer < diff) { Unit* target = NULL; Unit* SummonedZombies = NULL; for (int i = 0; i < 6; i++); { switch (rand()%9) { case 0: SummonedZombies = m_creature->SummonCreature(16360,ADD_1X,ADD_1Y,ADD_1Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); if (SummonedZombies) { target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) SummonedZombies->AddThreat(target,0.0f); } break; case 1: SummonedZombies = m_creature->SummonCreature(16360,ADD_2X,ADD_2Y,ADD_2Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); if (SummonedZombies) { target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) SummonedZombies->AddThreat(target,0.0f); } case 2: SummonedZombies = m_creature->SummonCreature(16360,ADD_3X,ADD_3Y,ADD_3Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); if (SummonedZombies) { target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) SummonedZombies->AddThreat(target,0.0f); } break; case 3: SummonedZombies = m_creature->SummonCreature(16360,ADD_4X,ADD_4Y,ADD_4Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); if (SummonedZombies) { target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) SummonedZombies->AddThreat(target,0.0f); } break; case 4: SummonedZombies = m_creature->SummonCreature(16360,ADD_5X,ADD_5Y,ADD_5Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); if (SummonedZombies) { target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) SummonedZombies->AddThreat(target,0.0f); } break; case 5: SummonedZombies = m_creature->SummonCreature(16360,ADD_6X,ADD_6Y,ADD_6Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); if (SummonedZombies) { target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) SummonedZombies->AddThreat(target,0.0f); } break; case 6: SummonedZombies = m_creature->SummonCreature(16360,ADD_7X,ADD_7Y,ADD_7Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); if (SummonedZombies) { target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) SummonedZombies->AddThreat(target,0.0f); } break; case 7: SummonedZombies = m_creature->SummonCreature(16360,ADD_8X,ADD_8Y,ADD_8Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); if (SummonedZombies) { target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) SummonedZombies->AddThreat(target,0.0f); } break; case 8: SummonedZombies = m_creature->SummonCreature(16360,ADD_9X,ADD_9Y,ADD_9Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); if (SummonedZombies) { target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) SummonedZombies->AddThreat(target,0.0f); } break; } } //24 seconds until we should cast this agian Summon_Timer = 120000; } else Summon_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_STATIC_DISRUPTION: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!target) target = me->GetVictim(); if (target) { TargetGUID = target->GetGUID(); DoCast(target, SPELL_STATIC_DISRUPTION, false); me->SetInFront(me->GetVictim()); } /*if (float dist = me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f) dist = 5.0f; SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/ events.ScheduleEvent(EVENT_STATIC_DISRUPTION, urand(10000, 18000)); break; } case EVENT_GUST_OF_WIND: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!target) target = me->GetVictim(); if (target) DoCast(target, SPELL_GUST_OF_WIND); events.ScheduleEvent(EVENT_GUST_OF_WIND, urand(20000, 30000)); break; } case EVENT_CALL_LIGHTNING: DoCastVictim(SPELL_CALL_LIGHTNING); events.ScheduleEvent(EVENT_CALL_LIGHTNING, urand(12000, 17000)); // totaly random timer. can't find any info on this break; case EVENT_ELECTRICAL_STORM: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); if (!target) { EnterEvadeMode(); return; } target->CastSpell(target, 44007, true); // cloud visual DoCast(target, SPELL_ELECTRICAL_STORM, false); // storm cyclon + visual float x, y, z; target->GetPosition(x, y, z); /// @todo: fix it in correct way, that causes player to can fly until logout /* if (target) { target->SetDisableGravity(true); target->MonsterMoveWithSpeed(x, y, me->GetPositionZ()+15, 0); } */ Unit* Cloud = me->SummonTrigger(x, y, me->GetPositionZ()+16, 0, 15000); if (Cloud) { CloudGUID = Cloud->GetGUID(); Cloud->SetDisableGravity(true); Cloud->StopMoving(); Cloud->SetObjectScale(1.0f); Cloud->setFaction(35); Cloud->SetMaxHealth(9999999); Cloud->SetHealth(9999999); Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } StormCount = 1; events.ScheduleEvent(EVENT_ELECTRICAL_STORM, 60000); // 60 seconds(bosskillers) events.ScheduleEvent(EVENT_RAIN, urand(47000, 52000)); break; } case EVENT_RAIN: if (!isRaining) { SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f); isRaining = true; } else events.ScheduleEvent(EVENT_RAIN, 1000); break; case EVENT_STORM_SEQUENCE: { Unit* target = ObjectAccessor::GetUnit(*me, CloudGUID); if (!target || !target->IsAlive()) { EnterEvadeMode(); return; } else if (Unit* Cyclone = ObjectAccessor::GetUnit(*me, CycloneGUID)) Cyclone->CastSpell(target, SPELL_SAND_STORM, true); // keep casting or... HandleStormSequence(target); break; } case EVENT_SUMMON_EAGLES: Talk(SAY_SUMMON); float x, y, z; me->GetPosition(x, y, z); for (uint8 i = 0; i < 8; ++i) { Unit* bird = ObjectAccessor::GetUnit(*me, BirdGUIDs[i]); if (!bird) //they despawned on die { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { x = target->GetPositionX() + irand(-10, 10); y = target->GetPositionY() + irand(-10, 10); z = target->GetPositionZ() + urand(16, 20); if (z > 95) z = 95.0f - urand(0, 5); } Creature* creature = me->SummonCreature(NPC_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (creature) { creature->AddThreat(me->GetVictim(), 1.0f); creature->AI()->AttackStart(me->GetVictim()); BirdGUIDs[i] = creature->GetGUID(); } } } break; case EVENT_ENRAGE: Talk(SAY_ENRAGE); DoCast(me, SPELL_BERSERK, true); events.ScheduleEvent(EVENT_ENRAGE, 600000); break; default: break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; //MortalWound_Timer if (MortalWound_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MORTALWOUND); MortalWound_Timer = 10000; }else MortalWound_Timer -= diff; //Decimate_Timer if (Decimate_Timer < diff) { m_creature->MonsterTextEmote("Gluth decimates all nearby flesh!", 0, true); DoCast(m_creature->getVictim(), SPELL_DECIMATE); // need core support // workaround below std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); if (t_list.size()) { std::list<HostileReference *>::iterator itr = t_list.begin(); for(; itr!= t_list.end(); ++itr) { Unit* pTarget = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid()); if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER && (pTarget->GetHealth() > pTarget->GetMaxHealth() * 0.05)) pTarget->SetHealth(pTarget->GetMaxHealth() * 0.05); } } // Move Zombies if (!m_lZombieGUIDList.empty()) { for(std::list<uint64>::iterator itr = m_lZombieGUIDList.begin(); itr != m_lZombieGUIDList.end(); ++itr) if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr)) if (pTemp->isAlive()) { ((mob_zombie_chowsAI*)pTemp->AI())->bIsForceMove = true; if (m_creature->GetHealth() > m_creature->GetMaxHealth() * 0.05) // remove when SPELL_DECIMATE is working pTemp->SetHealth(pTemp->GetMaxHealth() * 0.05); pTemp->AddThreat(m_creature, 1000000000.0f); // force move toward to Gluth } } Decimate_Timer = (m_bIsRegularMode ? 120000 : 90000); }else Decimate_Timer -= diff; //Enrage_Timer if (Enrage_Timer < diff) { m_creature->MonsterTextEmote("Gluth becomes enraged!", 0, true); DoCast(m_creature, m_bIsRegularMode ? SPELL_ENRAGE : SPELL_ENRAGE_H); Enrage_Timer = 30000; }else Enrage_Timer -= diff; if (RangeCheck_Timer < diff) { if (!m_lZombieGUIDList.empty()) { for(std::list<uint64>::iterator itr = m_lZombieGUIDList.begin(); itr != m_lZombieGUIDList.end(); ++itr) if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr)) if (pTemp->isAlive() && m_creature->IsWithinDistInMap(pTemp, ATTACK_DISTANCE)) { DoScriptText(EMOTE_ZOMBIE, m_creature); m_creature->SetHealth(m_creature->GetHealth() + m_creature->GetMaxHealth() * 0.05); pTemp->ForcedDespawn(); } } RangeCheck_Timer = 1000; }else RangeCheck_Timer -= diff; //Summon_Timer if (Summon_Timer < diff) { for(uint8 i = 0; i < (m_bIsRegularMode ? 1 : 2); i++) { if (Creature* pZombie = m_creature->SummonCreature(NPC_ZOMBIE_CHOW, ZOMBIE_X + urand (0, 4), ZOMBIE_Y + urand (0, 4), ZOMBIE_Z, ZOMBIE_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 150000)) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { pZombie->SetSpeedRate(MOVE_RUN, 1.0f); pZombie->AI()->AttackStart(pTarget); m_lZombieGUIDList.push_back(pZombie->GetGUID()); } } } Summon_Timer = 10000; } else Summon_Timer -= diff; //m_uiBerserkTimer if (m_uiBerserkTimer < diff) { DoCast(m_creature, SPELL_BERSERK, true); m_uiBerserkTimer = MINUTE*5*IN_MILLISECONDS; }else m_uiBerserkTimer -= diff; DoMeleeAttackIfReady(); }