void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (!bTransformated && HealthBelowPct(50)) //transform at least once at 50% health { bTransformated = true; uiPhaseCounter = 2; } switch (Phase) { case TROLL: if (uiPhaseCounter >= 2) { if (uiTransformationTimer <= diff) { me->SetDisplayId(DISPLAY_RHINO); Phase = RHINO; uiPhaseCounter = 0; DoScriptText(SAY_TRANSFORM_1, me); uiTransformationTimer = 5*IN_MILLISECONDS; bStartOfTransformation = true; bTransformated = true; me->ClearUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); me->SetReactState(REACT_AGGRESSIVE); } else { uiTransformationTimer -= diff; if (bStartOfTransformation) { bStartOfTransformation = false; me->AddUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); me->SetReactState(REACT_PASSIVE); } } } else { if (uiStampedeTimer <= diff) { DoCast(me, SPELL_STAMPEDE); DoScriptText(RAND(SAY_SUMMON_1,SAY_SUMMON_2,SAY_SUMMON_3),me); uiStampedeTimer = urand(10*IN_MILLISECONDS,15*IN_MILLISECONDS); } else uiStampedeTimer -= diff; if (uiWhirlingSlashTimer <= diff) { DoCast(me->getVictim(), DUNGEON_MODE(SPELL_WHIRLING_SLASH, H_SPELL_WHIRLING_SLASH)); uiWhirlingSlashTimer = urand(18*IN_MILLISECONDS,22*IN_MILLISECONDS);; ++uiPhaseCounter; } else uiWhirlingSlashTimer -= diff; } break; case RHINO: if (uiPhaseCounter >= 2) { if (uiTransformationTimer <= diff) { me->SetDisplayId(DISPLAY_TROLL); Phase = TROLL; uiPhaseCounter = 0; DoScriptText(SAY_TRANSFORM_2, me); uiTransformationTimer = 6*IN_MILLISECONDS; bStartOfTransformation = true; me->ClearUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); me->SetReactState(REACT_AGGRESSIVE); } else { uiTransformationTimer -= diff; if (bStartOfTransformation) { bStartOfTransformation = false; me->AddUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); me->SetReactState(REACT_PASSIVE); } } } else { if (uiPunctureTimer <= diff) { DoCast(me->getVictim(), DUNGEON_MODE(SPELL_PUNCTURE, H_SPELL_PUNCTURE)); uiPunctureTimer = 15*IN_MILLISECONDS; } else uiPunctureTimer -= diff; if (uiEnrageTimer <= diff) { DoCast(me->getVictim(), DUNGEON_MODE(SPELL_ENRAGE, H_SPELL_ENRAGE)); uiEnrageTimer = 20*IN_MILLISECONDS; } else uiEnrageTimer -= diff; if (uiStompTimer <= diff) { DoCast(me->getVictim(), DUNGEON_MODE(SPELL_STOMP, H_SPELL_STOMP)); uiStompTimer = urand(10*IN_MILLISECONDS,15*IN_MILLISECONDS); } else uiStompTimer -= diff; if (uiImpalingChargeTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) { DoCast(target, DUNGEON_MODE(SPELL_IMPALING_CHARGE, H_SPELL_IMPALING_CHARGE)); target->CastSpell(me, SPELL_IMPALING_CHARGE_VEHICLE, true); // needs vehicle id and take dmg while seated CheckAchievement(target->GetGUID()); } uiImpalingChargeTimer = 20*IN_MILLISECONDS; ++uiPhaseCounter; } else uiImpalingChargeTimer -= diff; } break; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; switch (Phase) { case TROLL: if (uiPhaseCounter == 2) { if (uiTransformationTimer <= diff) { me->SetDisplayId(DISPLAY_RHINO); Phase = RHINO; uiPhaseCounter = 0; DoScriptText(SAY_TRANSFORM_1, me); uiTransformationTimer = 5*IN_MILLISECONDS; bStartOfTransformation = true; me->ClearUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT); me->SetReactState(REACT_AGGRESSIVE); } else { uiTransformationTimer -= diff; if (bStartOfTransformation) { bStartOfTransformation = false; me->AddUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT); me->SetReactState(REACT_PASSIVE); } } } else { if (uiStampedeTimer <= diff) { DoCast(me, SPELL_STAMPEDE); DoScriptText(RAND(SAY_SUMMON_RHINO_1, SAY_SUMMON_RHINO_2, SAY_SUMMON_RHINO_3), me); uiStampedeTimer = 15*IN_MILLISECONDS; } else uiStampedeTimer -= diff; if (uiWhirlingSlashTimer <= diff) { DoCast(me->getVictim(), SPELL_WHIRLING_SLASH); uiWhirlingSlashTimer = 21*IN_MILLISECONDS; ++uiPhaseCounter; } else uiWhirlingSlashTimer -= diff; } break; case RHINO: if (uiPhaseCounter == 2) { if (uiTransformationTimer <= diff) { me->SetDisplayId(DISPLAY_TROLL); Phase = TROLL; uiPhaseCounter = 0; DoScriptText(SAY_TRANSFORM_2, me); uiTransformationTimer = 9*IN_MILLISECONDS; bStartOfTransformation = true; me->ClearUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT); me->SetReactState(REACT_AGGRESSIVE); } else { uiTransformationTimer -= diff; if (bStartOfTransformation) { bStartOfTransformation = false; me->AddUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT); me->SetReactState(REACT_PASSIVE); } } } else { if (uiPunctureTimer <= diff) { DoCast(me->getVictim(), SPELL_PUNCTURE); uiPunctureTimer = 8*IN_MILLISECONDS; } else uiPunctureTimer -= diff; if (uiEnrageTimer <= diff) { DoCast(me->getVictim(), SPELL_ENRAGE); uiEnrageTimer = 20*IN_MILLISECONDS; } else uiEnrageTimer -= diff; if (uiStompTimer <= diff) { DoCast(me->getVictim(), SPELL_STOMP); uiStompTimer = 20*IN_MILLISECONDS; } else uiStompTimer -= diff; if (uiImpalingChargeTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { DoCast(target, SPELL_IMPALING_CHARGE); CheckAchievement(target->GetGUID()); } uiImpalingChargeTimer = 31*IN_MILLISECONDS; ++uiPhaseCounter; } else uiImpalingChargeTimer -= diff; } break; } DoMeleeAttackIfReady(); }