void UpdateAI(const uint32 uiDiff) { if(!UpdateVictim()) return; if (!m_pInstance || m_pInstance->GetData(DATA_SAURFANG_EVENT) != IN_PROGRESS) me->ForcedDespawn(); if (getDifficulty() == RAID_DIFFICULTY_10MAN_HEROIC || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) { if (m_uiScentOfBloodTimer < uiDiff) { if (!ScentOfBlood && (me->GetHealth()*100) / me->GetMaxHealth() < 20) { if (urand(0,1)) DoCast(me, SPELL_SCENT_OF_BLOOD); ScentOfBlood = true; m_uiScentOfBloodTimer = 9000; // pSaurfang->ModifyPower(pSaurfang->getPowerType(POWER_BLOOD_POWER), +1); } } else m_uiScentOfBloodTimer -= uiDiff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; if (m_uiGastricBloatTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); DoCast(pTarget, SPELL_GASTRIC_BLOAT); m_uiGastricBloatTimer = 21000; } else m_uiGastricBloatTimer -= uiDiff; if(m_uiInhaleBlightTimer < uiDiff) { if (me->HasAura(SPELL_PUNGENT_BLIGHT)) { me->RemoveAurasDueToSpell(SPELL_PUNGENT_BLIGHT); } DoCast(me, SPELL_INHALE_BLIGHT); m_uiInhaleBlightTimer = 33000; } else m_uiInhaleBlightTimer -= uiDiff; if (m_uiVileGasTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); DoCast(pTarget, SPELL_VILE_GAS); m_uiVileGasTimer = 37000; } else m_uiVileGasTimer -= uiDiff; if (getDifficulty() == RAID_DIFFICULTY_10MAN_HEROIC || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) { if (m_uiGasSporesTimer < uiDiff) { DoScriptText(SAY_GAS_SPORES, me); Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); if (pTarget && !pTarget->HasAura(SPELL_GAS_SPORES)) { DoCast(pTarget, SPELL_GAS_SPORES); } m_uiGasSporesTimer = 23000; } else m_uiGasSporesTimer -= uiDiff; } if (m_uiPungentBlightTimer < uiDiff) { DoCastAOE(SPELL_PUNGENT_BLIGHT); m_uiPungentBlightTimer = 120000; m_uiInhaleBlightTimer = 33000; me->RemoveAllAuras(); } else m_uiPungentBlightTimer -= uiDiff; if(m_uiBerserkTimer < uiDiff) { DoCast(me, SPELL_BERSERK); m_uiBerserkTimer = 300000; } DoMeleeAttackIfReady(); }
void Reset() { me->SetReactState(REACT_PASSIVE); if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL || getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); } }
void Reset() { uiNetherPortalEffectTimer = urand (1000,2000); uiSpellNetherPortal = urand (1000,2000); me->SetDisplayId(25206); me->SetReactState(REACT_PASSIVE); m_bIsSummonGuardian = false; if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL || getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); } }
void Reset() { m_uiImpaleTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS); m_uiStaggeringStompTimer = 15*IN_MILLISECONDS; m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);; if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) m_uiSummonCount = 5; else m_uiSummonCount = 4; Summons.DespawnAll(); }
void Reset() { if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) { me->ApplySpellImmune(0, IMMUNITY_MECHANIC, SPELL_EFFECT_BIND, true); me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true); } }
void Reset() { _Reset(); me->SetReactState(REACT_PASSIVE); // Spawn NPC Helpers if (Helper[0] = me->SummonCreature(NPC_FIELD_MEDIC_PENNY, 1983.75, -243.36, 432.767, 1.57, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) if (Creature *pIceBlock = me->SummonCreature(NPC_FLASH_FREEZE, Helper[0]->GetPositionX(), Helper[0]->GetPositionY(), Helper[0]->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN)) { pIceBlock->CastSpell(Helper[0], SPELL_BLOCK_OF_ICE, true); Helper[0]->AddThreat(me, 100); } if (Helper[1] = me->SummonCreature(NPC_EIVI_NIGHTFEATHER, 1999.90, -230.49, 432.767, 1.57, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) if (Creature *pIceBlock = me->SummonCreature(NPC_FLASH_FREEZE, Helper[1]->GetPositionX(), Helper[1]->GetPositionY(), Helper[1]->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN)) { pIceBlock->CastSpell(Helper[1], SPELL_BLOCK_OF_ICE, true); Helper[1]->AddThreat(me, 100); } if (Helper[2] = me->SummonCreature(NPC_ELEMENTALIST_MAHFUUN, 2010.06, -243.45, 432.767, 1.57, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) if (Creature *pIceBlock = me->SummonCreature(NPC_FLASH_FREEZE, Helper[2]->GetPositionX(), Helper[2]->GetPositionY(), Helper[2]->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN)) { pIceBlock->CastSpell(Helper[2], SPELL_BLOCK_OF_ICE, true); Helper[2]->AddThreat(me, 100); } if (Helper[3] = me->SummonCreature(NPC_MISSY_FLAMECUFFS, 2021.12, -236.65, 432.767, 1.57, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) if (Creature *pIceBlock = me->SummonCreature(NPC_FLASH_FREEZE, Helper[3]->GetPositionX(), Helper[3]->GetPositionY(), Helper[3]->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN)) { pIceBlock->CastSpell(Helper[3], SPELL_BLOCK_OF_ICE, true); Helper[3]->AddThreat(me, 100); } if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { if (Helper[4] = me->SummonCreature(NPC_FIELD_MEDIC_JESSY, 1976.60, -233.53, 432.767, 1.57, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) if (Creature *pIceBlock = me->SummonCreature(NPC_FLASH_FREEZE, Helper[4]->GetPositionX(), Helper[4]->GetPositionY(), Helper[4]->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN)) { pIceBlock->CastSpell(Helper[4], SPELL_BLOCK_OF_ICE, true); Helper[4]->AddThreat(me, 100); } if (Helper[5] = me->SummonCreature(NPC_ELLIE_NIGHTFEATHER, 1992.90, -237.54, 432.767, 1.57, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) if (Creature *pIceBlock = me->SummonCreature(NPC_FLASH_FREEZE, Helper[5]->GetPositionX(), Helper[5]->GetPositionY(), Helper[5]->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN)) { pIceBlock->CastSpell(Helper[5], SPELL_BLOCK_OF_ICE, true); Helper[5]->AddThreat(me, 100); } if (Helper[6] = me->SummonCreature(NPC_ELEMENTALIST_AVUUN, 2014.18, -232.80, 432.767, 1.57, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) if (Creature *pIceBlock = me->SummonCreature(NPC_FLASH_FREEZE, Helper[6]->GetPositionX(), Helper[6]->GetPositionY(), Helper[6]->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN)) { pIceBlock->CastSpell(Helper[6], SPELL_BLOCK_OF_ICE, true); Helper[6]->AddThreat(me, 100); } if (Helper[7] = me->SummonCreature(NPC_SISSY_FLAMECUFFS, 2028.10, -244.66, 432.767, 1.57, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) if (Creature *pIceBlock = me->SummonCreature(NPC_FLASH_FREEZE, Helper[7]->GetPositionX(), Helper[7]->GetPositionY(), Helper[7]->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN)) { pIceBlock->CastSpell(Helper[7], SPELL_BLOCK_OF_ICE, true); Helper[7]->AddThreat(me, 100); } } }
void EnterCombat(Unit* who) { if (!instance->CheckRequiredBosses(DATA_LADY_DEATHWHISPER, who->ToPlayer())) { EnterEvadeMode(); instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); return; } me->setActive(true); DoZoneInCombat(); events.Reset(); events.SetPhase(PHASE_ONE); // phase-independent events events.ScheduleEvent(EVENT_BERSERK, 600000); events.ScheduleEvent(EVENT_DEATH_AND_DECAY, 10000); // phase one only events.ScheduleEvent(EVENT_P1_SUMMON_WAVE, 5000, 0, PHASE_ONE); events.ScheduleEvent(EVENT_P1_SHADOW_BOLT, urand(5500, 6000), 0, PHASE_ONE); events.ScheduleEvent(EVENT_P1_EMPOWER_CULTIST, urand(20000, 30000), 0, PHASE_ONE); if (getDifficulty() != RAID_DIFFICULTY_10MAN_NORMAL) events.ScheduleEvent(EVENT_DOMINATE_MIND_H, 27000); Talk(SAY_AGGRO); DoStartNoMovement(who); me->RemoveAurasDueToSpell(SPELL_SHADOW_CHANNELING); DoCast(me, SPELL_MANA_BARRIER, true); instance->SetBossState(DATA_LADY_DEATHWHISPER, IN_PROGRESS); }
// summoning function for first phase void SummonWaveP1() { uint8 addIndex = uiAddWaveCounter & 1; uint8 addIndexOther = addIndex ^ 1; _SummonAdd(uiAddEntries[addIndex], addSpawnPos[addIndex*3]); _SummonAdd(uiAddEntries[addIndexOther], addSpawnPos[addIndex*3+1]); _SummonAdd(uiAddEntries[addIndex], addSpawnPos[addIndex*3+2]); if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) { _SummonAdd(uiAddEntries[addIndexOther], addSpawnPos[addIndexOther*3]); _SummonAdd(uiAddEntries[addIndex], addSpawnPos[addIndexOther*3+1]); _SummonAdd(uiAddEntries[addIndexOther], addSpawnPos[addIndexOther*3+2]); _SummonAdd(uiAddEntries[urand(0,1)], addSpawnPos[6]); } ++uiAddWaveCounter; }
void DoGothikSummon(uint32 entry) { if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { switch(entry) { case MOB_LIVE_TRAINEE: { if (Creature *LiveTrigger0 = Unit::GetCreature(*me, LiveTriggerGUID[0])) DoSummon(MOB_LIVE_TRAINEE, LiveTrigger0, 1); if (Creature *LiveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[1])) DoSummon(MOB_LIVE_TRAINEE, LiveTrigger1, 1); if (Creature *LiveTrigger2 = Unit::GetCreature(*me, LiveTriggerGUID[2])) DoSummon(MOB_LIVE_TRAINEE, LiveTrigger2, 1); break; } case MOB_LIVE_KNIGHT: { if (Creature *LiveTrigger3 = Unit::GetCreature(*me, LiveTriggerGUID[3])) DoSummon(MOB_LIVE_KNIGHT, LiveTrigger3, 1); if (Creature *LiveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[5])) DoSummon(MOB_LIVE_KNIGHT, LiveTrigger5, 1); break; } case MOB_LIVE_RIDER: { if (Creature *LiveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4])) DoSummon(MOB_LIVE_RIDER, LiveTrigger4, 1); break; } } } else { switch(entry) { case MOB_LIVE_TRAINEE: { if (Creature *LiveTrigger0 = Unit::GetCreature(*me, LiveTriggerGUID[4])) DoSummon(MOB_LIVE_TRAINEE, LiveTrigger0, 1); if (Creature *LiveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[4])) DoSummon(MOB_LIVE_TRAINEE, LiveTrigger1, 1); break; } case MOB_LIVE_KNIGHT: { if (Creature *LiveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[4])) DoSummon(MOB_LIVE_KNIGHT, LiveTrigger5, 1); break; } case MOB_LIVE_RIDER: { if (Creature *LiveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4])) DoSummon(MOB_LIVE_RIDER, LiveTrigger4, 1); break; } } } }
void JustDied(Unit * /*killer*/) { if (pInstance && getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) { if (Creature *pFaerlina = pInstance->instance->GetCreature(pInstance->GetData64(DATA_FAERLINA))) DoCast(pFaerlina, SPELL_WIDOWS_EMBRACE); } }
void EnterCombat(Unit * /*who*/) { _EnterCombat(); DoScriptText(SAY_AGGRO, me); events.ScheduleEvent(EVENT_IMPALE, 10000 + rand() % 10000); events.ScheduleEvent(EVENT_LOCUST, 90000); events.ScheduleEvent(EVENT_BERSERK, 600000); if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) events.ScheduleEvent(EVENT_SPAWN_GUARDIAN_NORMAL, urand(15000, 20000)); }
void JustDied(Unit * /*killer*/) { if (pInstance && getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) { if (Creature *pFaerlina = pInstance->instance->GetCreature(pInstance->GetData64(DATA_FAERLINA))) { me->InterruptNonMeleeSpells(false); DoCast(pFaerlina, SPELL_WIDOWS_EMBRACE,true); } } }
void Reset() { me->SetSpeed(MOVE_RUN, 1.5f); m_uiStaggeringStompTimer = urand(13*IN_MILLISECONDS,15*IN_MILLISECONDS); m_uiImpaleTimer = urand(30*IN_MILLISECONDS,35*IN_MILLISECONDS); m_uiFireBombTimer = urand(30*IN_MILLISECONDS,40*IN_MILLISECONDS); m_uiFireBombTriggerTimer = urand(10*IN_MILLISECONDS,18*IN_MILLISECONDS); m_uiMaxSnobolds = RAID_MODE(4,5,4,5); m_uiSnoboldsLaunched = 0; m_uiSnoboldTimer = urand(15*IN_MILLISECONDS,30*IN_MILLISECONDS); m_bIsNextPhase = false; if (getDifficulty() == RAID_DIFFICULTY_10MAN_HEROIC || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) { m_uiNextEncounterTimer = 180*IN_MILLISECONDS; } if (m_pInstance) m_pInstance->SetData(PHASE_1, NOT_STARTED); }
void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; if (m_uiGrabTimer < uiDiff) { if(InVehicle == false) { if(Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1)) { pTarget->EnterVehicle(vehicle); InVehicle = true; DoCast(me, SPELL_WINGS_OF_THE_DAMNED); if (getDifficulty() == RAID_DIFFICULTY_10MAN_HEROIC || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) { DoCast(pTarget, SPELL_LIFE_SIPHON); } } } m_uiGrabTimer = 120000; } else m_uiGrabTimer -= uiDiff; if (m_uiMovementTimer < uiDiff) { me->GetMotionMaster()->MovePoint(0, ValkyrMoveMent); m_uiMovementTimer = 120000; } else m_uiMovementTimer -= uiDiff; if (m_uiFallPlayerTimer < uiDiff) { if(!OutVehicle) { vehicle->RemoveAllPassengers(); OutVehicle = true; } m_uiFallPlayerTimer = 120000; } else m_uiFallPlayerTimer -= uiDiff; }
// summoning function for second phase void SummonWaveP2() { if (getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) { uint8 addIndex = uiAddWaveCounter & 1; _SummonAdd(uiAddEntries[addIndex], addSpawnPos[addIndex*3]); _SummonAdd(uiAddEntries[addIndex ^ 1], addSpawnPos[addIndex*3+1]); _SummonAdd(uiAddEntries[addIndex], addSpawnPos[addIndex*3+2]); } else _SummonAdd(uiAddEntries[urand(0,1)], addSpawnPos[6]); ++uiAddWaveCounter; }
void EnterPhaseGround() { me->SetReactState(REACT_AGGRESSIVE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoZoneInCombat(); if (me->getThreatManager().isThreatListEmpty()) EnterEvadeMode(); else { events.ScheduleEvent(EVENT_BALCONY, 110000); events.ScheduleEvent(EVENT_CURSE, 10000 + rand() % 15000); events.ScheduleEvent(EVENT_WARRIOR, 30000); if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) events.ScheduleEvent(EVENT_BLINK, 20000 + rand() % 20000); } }
void Reset() { _Reset(); if (Creature* Sentry = me->SummonCreature(NPC_SANCTUM_SENTRY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) Sentry->GetMotionMaster()->MoveFollow(me, 0.5, 1.5, MOTION_SLOT_ACTIVE); if (Creature* Sentry = me->SummonCreature(NPC_SANCTUM_SENTRY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) Sentry->GetMotionMaster()->MoveFollow(me, 0.5, -1.5, MOTION_SLOT_ACTIVE); if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { if (Creature* Sentry = me->SummonCreature(NPC_SANCTUM_SENTRY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) Sentry->GetMotionMaster()->MoveFollow(me, -2.5, 1.5, MOTION_SLOT_ACTIVE); if (Creature* Sentry = me->SummonCreature(NPC_SANCTUM_SENTRY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) Sentry->GetMotionMaster()->MoveFollow(me, -2.5, -1.5, MOTION_SLOT_ACTIVE); } }
void Reset() { m_uiPhase = 1; m_uiSummonWaveTimer = 15000; m_uiDeathandDecayTimer = 10000; m_uiIntroText = 0; m_uiIntroTextTimer = 12000; m_uiFrostBoltTimer = 15000; m_uiFrostValleyTimer = 5000; m_uiShadowBoltTimer = urand(5000,10000); m_uiDarkEmpoweredTimer = 30000; if (!getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) m_uiDominateMindTimer = 15000; if (m_pInstance) m_pInstance->SetData(DATA_DEATHWHISPER_EVENT, NOT_STARTED); }
void sudokuBoard::obfuscateBoard() { vector <int> options; for (int i=1; i<11; ++i) options.push_back(i); // 1 2 3 4 5 6 7 8 9 10 int percent = 5; int curr_opt = 0; int count = 0; for (int i = 0; i<BOARDSIZE; i++) { for (int j = 0; j<BOARDSIZE; j++) { display_board[i][j] = current_board[i][j]; } } switch( getDifficulty() ) { case (1): cout << "\n\033[1;32mNew Easy Puzzle\033[0m" << endl; percent = 6; break; case (2): cout << "\n\033[1;32mNew Medium Puzzle\033[0m" << endl; percent = 5; break; case (3): cout << "\n\033[1;32mNew Hard Puzzle\033[0m" << endl; percent = 4; break; case (4): cout << "\n\033[1;32mNew Expert Puzzle\033[0m" << endl; percent = 3; break; default: return; } while (count < BOARDSIZE*BOARDSIZE) { random_shuffle ( options.begin(), options.end(), myrandom ); curr_opt = options.back(); if ( curr_opt > percent ) { display_board[count/BOARDSIZE][count%BOARDSIZE] = 0; } count++; } return; }
void Reset() { _Reset(); hasTaunted = false; if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { Position pos; // respawn guard using home position, // otherwise, after a wipe, they respawn where boss was at wipe moment. pos = me->GetHomePosition(); pos.m_positionY -= 10.0f; me->SummonCreature(MOB_CRYPT_GUARD, pos, TEMPSUMMON_CORPSE_DESPAWN); pos = me->GetHomePosition(); pos.m_positionY += 10.0f; me->SummonCreature(MOB_CRYPT_GUARD, pos, TEMPSUMMON_CORPSE_DESPAWN); } }
void EnterCombat(Unit* who) { events.Reset(); events.SetPhase(PHASE_ONE); // phase-independent events events.ScheduleEvent(EVENT_BERSERK, 600000); events.ScheduleEvent(EVENT_DEATH_AND_DECAY, 10000); // phase one only events.ScheduleEvent(EVENT_P1_SUMMON_WAVE, 5000, 0, PHASE_ONE); events.ScheduleEvent(EVENT_P1_SHADOW_BOLT, urand(5500, 6000), 0, PHASE_ONE); events.ScheduleEvent(EVENT_P1_EMPOWER_CULTIST, urand(20000, 30000), 0, PHASE_ONE); if (getDifficulty() != RAID_DIFFICULTY_10MAN_NORMAL) events.ScheduleEvent(EVENT_DOMINATE_MIND_H, 27000); DoScriptText(SAY_AGGRO, me); DoStartNoMovement(who); me->RemoveAurasDueToSpell(SPELL_SHADOW_CHANNELING); DoCast(me, SPELL_MANA_BARRIER, true); instance->SetBossState(DATA_LADY_DEATHWHISPER, IN_PROGRESS); }
void DoGothikSummon(uint32 entry) { if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { switch(entry) { case MOB_LIVE_TRAINEE: DoSummon(MOB_LIVE_TRAINEE, liveTrigger[0], 1); DoSummon(MOB_LIVE_TRAINEE, liveTrigger[1], 1); DoSummon(MOB_LIVE_TRAINEE, liveTrigger[2], 1); break; case MOB_LIVE_KNIGHT: DoSummon(MOB_LIVE_KNIGHT, liveTrigger[3], 1); DoSummon(MOB_LIVE_KNIGHT, liveTrigger[5], 1); break; case MOB_LIVE_RIDER: DoSummon(MOB_LIVE_RIDER, liveTrigger[4], 1); break; } } else { switch(entry) { case MOB_LIVE_TRAINEE: DoSummon(MOB_LIVE_TRAINEE, liveTrigger[0], 1); DoSummon(MOB_LIVE_TRAINEE, liveTrigger[1], 1); break; case MOB_LIVE_KNIGHT: DoSummon(MOB_LIVE_KNIGHT, liveTrigger[5], 1); break; case MOB_LIVE_RIDER: DoSummon(MOB_LIVE_RIDER, liveTrigger[4], 1); break; } } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim() || !CheckInRoom()) return; events.Update(diff); if (!thirtyPercentReached && HealthBelowPct(30) && phaseTwo) { thirtyPercentReached = true; if (instance) instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); } if (me->HasUnitState(UNIT_STAT_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_SUMMON: if (waves[waveCount].entry) { if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) DoGothikSummon(waves[waveCount].entry); else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) DoGothikSummon(waves[waveCount].entry); else if (waves[waveCount].mode == 1) DoGothikSummon(waves[waveCount].entry); // if group is not splitted, open gate and merge both sides at ~ 2 minutes (wave 11) if (waveCount == 11) { if (!CheckGroupSplitted()) { if (instance) instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); summons.DoAction(0, 0); summons.DoZoneInCombat(); mergedSides = true; } } if (waves[waveCount].mode == 1) events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); else if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); else events.ScheduleEvent(EVENT_SUMMON, 0); ++waveCount; } else { phaseTwo = true; DoScriptText(SAY_TELEPORT, me); DoTeleportTo(PosGroundLiveSide); me->SetReactState(REACT_AGGRESSIVE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); summons.DoAction(0, 0); summons.DoZoneInCombat(); events.ScheduleEvent(EVENT_BOLT, 1000); events.ScheduleEvent(EVENT_HARVEST, urand(3000, 15000)); events.ScheduleEvent(EVENT_TELEPORT, 20000); } break; case EVENT_BOLT: DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT)); events.ScheduleEvent(EVENT_BOLT, 1000); break; case EVENT_HARVEST: DoCast(me->getVictim(), SPELL_HARVEST_SOUL, true); events.ScheduleEvent(EVENT_HARVEST, urand(20000, 25000)); break; case EVENT_TELEPORT: if (!thirtyPercentReached) { me->AttackStop(); if (IN_LIVE_SIDE(me)) { DoTeleportTo(PosGroundDeadSide); } else { DoTeleportTo(PosGroundLiveSide); } me->getThreatManager().resetAggro(NotOnSameSide(me)); if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) { me->getThreatManager().addThreat(pTarget, 100.0f); AttackStart(pTarget); } events.ScheduleEvent(EVENT_TELEPORT, 20000); } break; } } DoMeleeAttackIfReady(); }
void MenuManager::play() { bool keyCatch = false; // To get only 1 key per keydown SDL_Event event; bool done = false; // Here, we need to create an instance of the Manager, // the one that manages the game: Manager manager; manager.pause(); while ( not done ) { drawBackground(); menu.draw(); SDL_Flip(screen); SDL_PollEvent(&event); if (event.type == SDL_QUIT) { break; } if(event.type == SDL_KEYDOWN) { switch ( event.key.keysym.sym ) { case SDLK_ESCAPE : case SDLK_q : { done = true; break; } case SDLK_RETURN : { if ( !keyCatch ) { menu.lightOn(); if ( menu.getIconClicked() == "Start Game" ) { // Here is where we call the play() function in Manager: std::cout << "Starting game ..." << std::endl; Manager manager; manager.setDifficulty(difficulty); manager.unpause(); manager.play(); manager.pause(); } if ( menu.getIconClicked() == "Difficulty" ) { getDifficulty(); // After we get the number, we must pass it to Manager: std::cout<<difficulty<<std::endl; manager.setDifficulty(difficulty); } if ( menu.getIconClicked() == "Help" ) { // Here is where we explain how to play the game" std::cout << "Give help ..." << std::endl; getHelp(); } if ( menu.getIconClicked() == "Exit" ) { drawBackground(); menu.draw(); SDL_Flip(screen); SDL_Delay(250); done = true; } } break; } case SDLK_DOWN : { if ( !keyCatch ) { menu.increment(); } break; } case SDLK_UP : { if ( !keyCatch ) { menu.decrement(); } break; } default : break; } keyCatch = true; } if(event.type == SDL_KEYUP) { keyCatch = false; menu.lightOff(); } } }
void UpdateAI(const uint32 uiDiff) { if (m_uiIntroText == 1 || m_uiIntroText == 2 || m_uiIntroText == 3 || m_uiIntroText == 4 || m_uiIntroText == 5 || m_uiIntroText == 6) { if (m_uiIntroTextTimer < uiDiff) { switch(m_uiIntroText) { case 1: DoScriptText(SAY_INTRO_2, me); break; case 2: DoScriptText(SAY_INTRO_3, me); break; case 3: DoScriptText(SAY_INTRO_4, me); break; case 4: DoScriptText(SAY_INTRO_5, me); break; case 5: DoScriptText(SAY_INTRO_6, me); break; case 6: DoScriptText(SAY_INTRO_7, me); break; } m_uiIntroText++; m_uiIntroTextTimer = 10500; } else m_uiIntroTextTimer -= uiDiff; } if (!UpdateVictim()) return; if (m_uiPhase == 1) { if (m_uiShadowBoltTimer < uiDiff) { Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM); DoCast(pTarget, SPELL_SHADOW_BOLT); m_uiShadowBoltTimer = urand(5000,10000); } else m_uiShadowBoltTimer -= uiDiff; if (m_uiDarkEmpoweredTimer < uiDiff) { DoScriptText(SAY_EMPOWERMENT, me); switch(rand() % 2) { case 0: AdherentList(me); break; case 1: FanaticList(me); break; } m_uiDarkEmpoweredTimer = urand(25000,30000); } else m_uiDarkEmpoweredTimer -= uiDiff; if (m_uiSummonWaveTimer < uiDiff) { for (uint8 i = 0; i < RAID_MODE(3,6,3,6); ++i) { me->SummonCreature(RAND(NPC_CULT_FANATIC, NPC_CULT_ADHERENT), SpawnLoc[i][0], SpawnLoc [i][1], SpawnLoc[i][2],0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); } m_uiSummonWaveTimer = 60000; } else m_uiSummonWaveTimer -= uiDiff; if (!me->HasAura(SPELL_MANA_BARRIER)) DoCast(me, SPELL_MANA_BARRIER); if (!me->HasAura(SPELL_ROOT)) DoCast(me, SPELL_ROOT); if (m_uiPhase == 1 || m_uiPhase == 2) { if (m_uiDominateMindTimer < uiDiff) { uint32 count = RAID_MODE(0,1,1,3); for (uint8 i = 1; i <= count; i++) { Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true); if (pTarget && !pTarget->isCharmed()) { DoCast(pTarget, SPELL_DOMINATE_MIND); } } m_uiDominateMindTimer = urand(15000,30000); } else m_uiDominateMindTimer -= uiDiff; if (m_uiDeathandDecayTimer < uiDiff) { Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM); DoCast(pTarget, SPELL_DEATH_AND_DECAY); m_uiDeathandDecayTimer = urand(10000,12000); } else m_uiDeathandDecayTimer -= uiDiff; if (getDifficulty() == RAID_DIFFICULTY_10MAN_HEROIC || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) if (m_uiSummonWaveTimer < uiDiff) { for (uint8 i = 0; i < RAID_MODE(3,3,3,3); ++i) { me->SummonCreature(RAND(NPC_CULT_FANATIC, NPC_CULT_ADHERENT), HeroicSpawnLoc[i][0], HeroicSpawnLoc [i][1], HeroicSpawnLoc[i][2],0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); } m_uiSummonWaveTimer = 60000; } else m_uiSummonWaveTimer -= uiDiff; } if ((me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA)) < 1) { DoScriptText(SAY_PHASE_2, me); m_uiPhase = 2; } } if (m_uiPhase == 2) { if (me->HasAura(SPELL_MANA_BARRIER)) me->RemoveAurasDueToSpell(SPELL_MANA_BARRIER); if (me->HasAura(SPELL_ROOT)) me->RemoveAurasDueToSpell(SPELL_ROOT); if (m_uiFrostBoltTimer < uiDiff) { DoCast(me->getVictim(), SPELL_FROST_BOLT); m_uiFrostBoltTimer = urand(5000,10000); } else m_uiFrostBoltTimer -= uiDiff; if (m_uiFrostValleyTimer < uiDiff) { DoCastAOE(SPELL_FROST_BOLT_VALLEY); m_uiFrostValleyTimer = urand(30000,35000); } else m_uiFrostValleyTimer -= uiDiff; DoMeleeAttackIfReady(); } }
void SummonChampions() { Map::PlayerList const &players = pInstance->instance->GetPlayers(); uint32 TeamInInstance = 0; Difficulty diffic = getDifficulty(); uint8 team = (mPlayerTeam==ALLIANCE) ? 1 : 0; uint8 coordsIdx = 0; uint8 guidIdx = 0; uint8 entryIdx = 0; uint8 r = RAID_MODE(2,4); uint8 hm = RAID_MODE(2,3); //Ranged entryIdx = mRChampRnd1; for(coordsIdx=0; coordsIdx < r; ++coordsIdx) { if(Unit *champ = me->SummonCreature(ChampRanged[team][entryIdx], ChampSpawnLocs[team][coordsIdx][0], ChampSpawnLocs[team][coordsIdx][1], ChampSpawnLocs[team][coordsIdx][2], ChampSpawnLocs[team][coordsIdx][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) { mChampionsGUID[guidIdx++] = champ->GetGUID(); } entryIdx = (entryIdx + mRChampRnd2) % 5; } //Healers entryIdx = mHChampRnd1; for(coordsIdx=4; coordsIdx < hm+4; ++coordsIdx) { if(Unit *champ = me->SummonCreature(ChampHealers[team][entryIdx], ChampSpawnLocs[team][coordsIdx][0], ChampSpawnLocs[team][coordsIdx][1], ChampSpawnLocs[team][coordsIdx][2], ChampSpawnLocs[team][coordsIdx][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) { mChampionsGUID[guidIdx++] = champ->GetGUID(); } entryIdx = (entryIdx + mHChampRnd2) % 4; } //Melee entryIdx = mMChampRnd1; for(coordsIdx=7; coordsIdx < hm+7; ++coordsIdx) { if(Unit *champ = me->SummonCreature(ChampMelee[team][entryIdx], ChampSpawnLocs[team][coordsIdx][0], ChampSpawnLocs[team][coordsIdx][1], ChampSpawnLocs[team][coordsIdx][2], ChampSpawnLocs[team][coordsIdx][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) { mChampionsGUID[guidIdx++] = champ->GetGUID(); } entryIdx = (entryIdx + mMChampRnd2) % 5; } mChampionsDead = 0; }
void UpdateAI(const uint32 uiDiff) { if(!UpdateVictim()) return; if (m_uiResetTimer <= uiDiff) { if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 80) EnterEvadeMode(); m_uiResetTimer = 5000; } else m_uiResetTimer -= uiDiff; if(TransitionPhase3 == false) { if (m_uiRandomSpeechTimer < uiDiff) { DoScriptText(SAY_RANDOM, me); m_uiRandomSpeechTimer = 33000; } else m_uiRandomSpeechTimer -= uiDiff; } if (m_uiBerserkTimer < uiDiff) { DoScriptText(SAY_BERSERK, me); DoCast(me, SPELL_BERSERK); m_uiBerserkTimer = 900000; } else m_uiBerserkTimer -= uiDiff; if(m_uiPhase == 1) { if (getDifficulty() == RAID_DIFFICULTY_10MAN_HEROIC || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) { if (m_uiSummonShadowTrap < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); DoCast(pTarget, SPELL_SUMMON_SHADOW_TRAP); m_uiSummonShadowTrap = 30000; } else m_uiSummonShadowTrap -= uiDiff; } if (m_uiInfestTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); DoCast(pTarget, SPELL_INFEST); m_uiInfestTimer = 30000; } else m_uiInfestTimer -= uiDiff; if (m_uiPlagueSiphonTimer < uiDiff) { DoCast(me, SPELL_PLAGUE_SIPHON); m_uiPlagueSiphonTimer = 30000; } else m_uiPlagueSiphonTimer -= uiDiff; if (m_uiSummonDrudgeGhoulsTimer < uiDiff) { DoCast(SPELL_SUMMON_DRUDGE_GHOULS); m_uiSummonDrudgeGhoulsTimer = 20000; } else m_uiSummonDrudgeGhoulsTimer -= uiDiff; if (m_uiSummonShamblingHorrorTimer < uiDiff) { DoCast(me, SPELL_SUMMON_SHAMBLING_HORROR); m_uiSummonShamblingHorrorTimer = 40000; } else m_uiSummonShamblingHorrorTimer -= uiDiff; if (m_uiNecroticPlagueTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); DoCast(pTarget, SPELL_NECROTIC_PLAGUE); m_uiNecroticPlagueTimer = 5000; } else m_uiNecroticPlagueTimer -= uiDiff; } if(TransitionPhase1 == true) { if (m_uiRemorselesWinterTimer < uiDiff) { DoScriptText(SAY_REMORSELESS_WINTER, me); DoCast(me, SPELL_REMORSELES_WINTER); m_uiRemorselesWinterTimer = 90000; } else m_uiRemorselesWinterTimer -= uiDiff; if (m_uiSummonSpiritTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); DoCast(pTarget, SPELL_SUMMON_RAGING_SPIRIT); m_uiSummonSpiritTimer = 16000; } else m_uiSummonSpiritTimer -= uiDiff; if (m_uiIcePulsSummonTimer < uiDiff) { DoCast(SPELL_SUMMON_ICE_SPEHERE); m_uiIcePulsSummonTimer = 15000; } else m_uiIcePulsSummonTimer -= uiDiff; if (m_uiPainandSufferingTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); DoCast(pTarget, SPELL_PAIN_AND_SUFFERING); m_uiPainandSufferingTimer = 2000; } else m_uiPainandSufferingTimer -= uiDiff; if (m_uiQuakeTimer < uiDiff) { DoScriptText(SAY_BROKEN_ARENA, me); DoCast(SPELL_QUAKE); me->SetReactState(REACT_AGGRESSIVE); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->getVictim()); m_uiPhase = 2; TransitionPhase1 = false; } else m_uiQuakeTimer -= uiDiff; } if(m_uiPhase == 2) { if (m_uiDefileTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); DoCast(pTarget, SPELL_SPAWN_DEFILE); m_uiDefileTimer = 20000; } else m_uiDefileTimer -= uiDiff; if (m_uiSummonValkyrTimer < uiDiff) { DoScriptText(SAY_SUMMON_VALKYR, me); DoCast(me, SPELL_SUMMON_VALKYR); m_uiSummonValkyrTimer = 20000; } else m_uiSummonValkyrTimer -= uiDiff; if (m_uiSoulReaperTimer < uiDiff) { DoCast(me->getVictim(), SPELL_SOUL_REAPER); m_uiSoulReaperTimer = 20000; } else m_uiSoulReaperTimer -= uiDiff; if (m_uiInfestTimer < uiDiff) { DoCast(me, SPELL_INFEST); m_uiInfestTimer = 30000; } else m_uiInfestTimer -= uiDiff; } if(TransitionPhase2 = true) { if (m_uiRemorselesWinterTimer < uiDiff) { DoScriptText(SAY_REMORSELESS_WINTER, me); DoCast(me, SPELL_REMORSELES_WINTER); m_uiRemorselesWinterTimer = 90000; } else m_uiRemorselesWinterTimer -= uiDiff; if (m_uiSummonSpiritTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); DoCast(pTarget, SPELL_SUMMON_RAGING_SPIRIT); m_uiSummonSpiritTimer = 16000; } else m_uiSummonSpiritTimer -= uiDiff; if (m_uiIcePulsSummonTimer < uiDiff) { DoCast(me, SPELL_SUMMON_ICE_SPEHERE); m_uiIcePulsSummonTimer = 15000; } else m_uiIcePulsSummonTimer -= uiDiff; if (m_uiPainandSufferingTimer < uiDiff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); DoCast(pTarget, SPELL_PAIN_AND_SUFFERING); m_uiPainandSufferingTimer = 3000; } else m_uiPainandSufferingTimer -= uiDiff; if (m_uiQuakeTimer < uiDiff) { DoScriptText(SAY_BROKEN_ARENA, me); DoCast(me, SPELL_QUAKE); me->SetReactState(REACT_AGGRESSIVE); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->getVictim()); m_uiPhase = 3; TransitionPhase2 = false; } else m_uiQuakeTimer -= uiDiff; } if(m_uiPhase == 3) { if (m_uiSummonVileSpiritTimer < uiDiff) { DoCast(me, SPELL_SUMMON_VILE_SPIRIT); m_uiSummonVileSpiritTimer = 30000; } else m_uiSummonVileSpiritTimer -= uiDiff; if (m_uiHarvestSoulTimer < uiDiff) { DoScriptText(SAY_HARVEST_SOUL, me); Unit* pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); DoCast(pTarget, SPELL_HARVEST_SOULS); m_uiHarvestSoulTimer = 70000; } else m_uiHarvestSoulTimer -= uiDiff; } DoMeleeAttackIfReady(); if (m_uiEndingTimer <= uiDiff) EndingPhase(); else m_uiEndingTimer -= uiDiff; if(me->GetHealth()*100 / me->GetMaxHealth() < 70) { if(TransitionPhase1 = false) { TransitionPhase1 = true; Phasenswitch(); } } if(me->GetHealth()*100 / me->GetMaxHealth() < 40) { if(TransitionPhase2 = false) { m_uiPhase = 3; m_uiRemorselesWinterTimer = 5000; m_uiQuakeTimer = 70000; m_uiIcePulsSummonTimer = 10000; m_uiPainandSufferingTimer = 10000; m_uiSummonSpiritTimer = 18000; Phasenswitch(); TransitionPhase2 = true; } } if(me->GetHealth()*100 / me->GetMaxHealth() < 11) { if(!TriggerSpawned) { pSafeZone = me->SummonCreature(CREATURE_TRIGGER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN, 360000); pSafeZone->AI()->AttackStart(me); pSafeZone->SetDisplayId(MODEL_INVISIBLE); TriggerSpawned = true; } } if(me->GetHealth()*100 / me->GetMaxHealth() < 10) { if(TransitionPhase3 = false) { TransitionPhase3 = true; SetEnding(); } } }
// This function does boundary checking on the ball, also determines where // it hits the paddle, and changes the behavior of the ball depending. void checkBallCollisions(int paddlePos) { // first check for any brick collisions char detected = drawBricks(&ball); // if no bricks hit, continue with normal collision detection if(detected == 'n') { // right wall if(ball.x >= SCREEN_WIDTH - BALL_RADIUS) { ball.x = SCREEN_WIDTH - (BALL_RADIUS + 1); xdir = -xdir; playTone(500, 50); return; } // left wall if(ball.x <= BALL_RADIUS) { ball.x = BALL_RADIUS + 1; xdir = -xdir; playTone(500, 50); return; } // ceiling if(ball.y >= SCREEN_HEIGHT - BALL_RADIUS) { ydir = -1.0; playTone(500, 50); return; } // middle of paddle if(ball.y <= 19 && (ball.x <= paddlePos + (PADDLE_WIDTH / 2) + (BALL_RADIUS + 1) && ball.x >= paddlePos + (PADDLE_WIDTH / 2) - (BALL_RADIUS + 1))) { paddleHits++; // increase ball speed slightly with every 6 paddle hits if((paddleHits % 18 == 0) && (paddleHits <= 36)) speed += 1.0; ball.y = 20; ydir = 1.0; playTone(500,50); return; } // right side of paddle else if(ball.y <= 19 && ((ball.x <= paddlePos + PADDLE_WIDTH) && (ball.x > paddlePos + (PADDLE_WIDTH / 2) + (BALL_RADIUS + 1)))) { paddleHits++; // increase ball speed slightly with every 6 paddle hits if((paddleHits % 18 == 0) && (paddleHits <= 36)) speed += 1.0; ball.y = 20; ydir = 1.0; xdir += 1.0; playTone(500, 50); return; } // left side of paddle else if(ball.y <= 19 && ((ball.x >= paddlePos) && (ball.x < paddlePos + (PADDLE_WIDTH / 2) - (BALL_RADIUS + 1)))) { paddleHits++; // increase ball speed slightly with every 6 paddle hits if((paddleHits % 18 == 0) && (paddleHits <= 36)) speed += 1.0; ball.y = 20; ydir = 1.0; xdir -= 1.0; playTone(500, 50); return; } // ball hits floor, lives lost, score deducted if(ball.y <= 10 && ((ball.x < paddlePos) || (ball.x > paddlePos + PADDLE_WIDTH))) { playTone(50,500); tft.fillCircle(ball.y, ball.x, BALL_RADIUS, ST7735_BLACK); drawPaddle(); initializeBall(getDifficulty()); decreaseLives(); displayStats(); delay(20); } } // brick collision detected, adjust ball accordingly else { // corner of brick hit if(detected == 'c') { xdir = -xdir; ydir = -ydir; playTone(200,50); return; } else { // left/right side of brick hit if(detected == 'x') { xdir = -xdir; playTone(200,50); return; } // top/bottom of brick hit else if(detected == 'y') { ydir = -ydir; playTone(200,50); return; } } } }
void UpdateAI(const uint32 diff) { if (!UpdateCombatState()) return; events.Update(diff); if (Phase == 1) { while(uint32 eventId = events.GetEvent()) { switch (eventId) { case EVENT_WASTE: DoSummon(NPC_WASTE, Pos[RAND(0,3,6,9)]); events.RepeatEvent(urand(2000,5000)); break; case EVENT_ABOMIN: if (nAbomination < 8) { DoSummon(NPC_ABOMINATION, Pos[RAND(1,4,7,10)]); nAbomination++; events.RepeatEvent(20000); } else events.PopEvent(); break; case EVENT_WEAVER: if (nWeaver < 8) { DoSummon(NPC_WEAVER, Pos[RAND(0,3,6,9)]); nWeaver++; events.RepeatEvent(25000); } else events.PopEvent(); break; case EVENT_TRIGGER: if (GameObject *pKTTrigger = m_creature->GetMap()->GetGameObject(KTTriggerGUID)) pKTTrigger->SetPhaseMask(2, true); events.PopEvent(); break; case EVENT_PHASE: events.Reset(); DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); spawns.DespawnAll(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); me->CastStop(); DoStartMovement(me->getVictim()); events.ScheduleEvent(EVENT_BOLT, urand(5000,10000)); events.ScheduleEvent(EVENT_NOVA, 15000); events.ScheduleEvent(EVENT_DETONATE, urand(30000,40000)); events.ScheduleEvent(EVENT_FISSURE, urand(10000,30000)); events.ScheduleEvent(EVENT_BLAST, urand(60000,120000)); if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) events.ScheduleEvent(EVENT_CHAIN, urand(30000,60000)); Phase = 2; break; default: events.PopEvent(); break; } } } else { //start phase 3 when we are 45% health if (Phase != 3) { if (HealthBelowPct(45)) { Phase = 3 ; DoScriptText(SAY_REQUEST_AID, m_creature); //here Lich King should respond to KelThuzad but I don't know which Creature to make talk //so for now just make Kelthuzad says it. DoScriptText(SAY_ANSWER_REQUEST, m_creature); for (uint8 i = 0; i <= 3; ++i) { if (GameObject *pPortal = m_creature->GetMap()->GetGameObject(PortalsGUID[i])) { if (pPortal->getLootState() == GO_READY) pPortal->UseDoorOrButton(); } } } } else if (nGuardiansOfIcecrownCount < RAID_MODE(2,4)) { if (uiGuardiansOfIcecrownTimer <= diff) { // TODO : Add missing text if (Creature* pGuardian = DoSummon(NPC_ICECROWN, Pos[RAND(2,5,8,11)])) pGuardian->SetFloatValue(UNIT_FIELD_COMBATREACH, 2); ++nGuardiansOfIcecrownCount; uiGuardiansOfIcecrownTimer = 5000; } else uiGuardiansOfIcecrownTimer -= diff; } if (me->hasUnitState(UNIT_STAT_CASTING)) return; if (uint32 eventId = events.GetEvent()) { switch (eventId) { case EVENT_BOLT: DoCastVictim(RAID_MODE(SPELL_FROST_BOLT,H_SPELL_FROST_BOLT)); events.RepeatEvent(urand(5000,10000)); break; case EVENT_NOVA: DoCastAOE(RAID_MODE(SPELL_FROST_BOLT_AOE,H_SPELL_FROST_BOLT_AOE)); events.RepeatEvent(urand(15000,30000)); break; case EVENT_CHAIN: { uint32 count = urand(1,3); for (uint8 i = 1; i <= count; i++) { Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true); if (pTarget && !pTarget->isCharmed() && (chained.find(pTarget->GetGUID()) == chained.end())) { DoCast(pTarget, SPELL_CHAINS_OF_KELTHUZAD); float scale = pTarget->GetFloatValue(OBJECT_FIELD_SCALE_X); chained.insert(std::make_pair(pTarget->GetGUID(), scale)); pTarget->SetFloatValue(OBJECT_FIELD_SCALE_X, scale * 2); events.ScheduleEvent(EVENT_CHAINED_SPELL, 2000); //core has 2000ms to set unit flag charm } } if (!chained.empty()) DoScriptText(RAND(SAY_CHAIN_1,SAY_CHAIN_2), me); events.RepeatEvent(urand(100000,180000)); break; } case EVENT_CHAINED_SPELL: { std::map<uint64, float>::iterator itr; for (itr = chained.begin(); itr != chained.end();) { if (Unit* player = Unit::GetPlayer((*itr).first)) { if (!player->isCharmed()) { player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); std::map<uint64, float>::iterator next = itr; ++next; chained.erase(itr); itr = next; continue; } if (Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, NotCharmedTargetSelector())) { switch(player->getClass()) { case CLASS_DRUID: if (urand(0,1)) player->CastSpell(pTarget, SPELL_MOONFIRE, false); else player->CastSpell(m_creature, SPELL_LIFEBLOOM, false); break; case CLASS_HUNTER: player->CastSpell(pTarget, RAND(SPELL_MULTI_SHOT, SPELL_VOLLEY), false); break; case CLASS_MAGE: player->CastSpell(pTarget, RAND(SPELL_FROST_FIREBOLT, SPELL_ARCANE_MISSILES), false); break; case CLASS_WARLOCK: player->CastSpell(pTarget, RAND(SPELL_CURSE_OF_AGONY, SPELL_SHADOW_BOLT), true); break; case CLASS_WARRIOR: player->CastSpell(pTarget, RAND(SPELL_BLADESTORM, SPELL_CLEAVE), false); break; case CLASS_PALADIN: if (urand(0,1)) player->CastSpell(pTarget, SPELL_HAMMER_OF_JUSTICE, false); else player->CastSpell(m_creature, SPELL_HOLY_SHOCK, false); break; case CLASS_PRIEST: if (urand(0,1)) player->CastSpell(pTarget, SPELL_VAMPIRIC_TOUCH, false); else player->CastSpell(m_creature, SPELL_RENEW, false); break; case CLASS_SHAMAN: if (urand(0,1)) player->CastSpell(pTarget, SPELL_EARTH_SHOCK, false); else player->CastSpell(m_creature, SPELL_HEALING_WAVE, false); break; case CLASS_ROGUE: player->CastSpell(pTarget, RAND(SPELL_HEMORRHAGE, SPELL_MUTILATE), false); break; case CLASS_DEATH_KNIGHT: if (urand(0,1)) player->CastSpell(pTarget, SPELL_PLAGUE_STRIKE, true); else player->CastSpell(pTarget, SPELL_HOWLING_BLAST, true); break; } } } itr++; } if (chained.empty()) events.PopEvent(); else events.RepeatEvent(5000); break; } case EVENT_DETONATE: { std::vector<Unit*> unitList; std::list<HostileReference*> *threatList = &me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr) { if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA && (*itr)->getTarget()->GetPower(POWER_MANA)) unitList.push_back((*itr)->getTarget()); } if (!unitList.empty()) { std::vector<Unit*>::iterator itr = unitList.begin(); advance(itr, rand()%unitList.size()); DoCast(*itr, SPELL_MANA_DETONATION); DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2,SAY_SPECIAL_3), me); } events.RepeatEvent(urand(20000,50000)); break; } case EVENT_FISSURE: if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(pTarget, SPELL_SHADOW_FISURE); events.RepeatEvent(urand(10000,45000)); break; case EVENT_BLAST: if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1,0), 0, true)) DoCast(pTarget, SPELL_FROST_BLAST); if (rand()%2) DoScriptText(SAY_FROST_BLAST, m_creature); events.RepeatEvent(urand(30000,90000)); break; default: events.PopEvent(); break; } } DoMeleeAttackIfReady(); } }