rendered paste bodyclass npc_blood_beast : public CreatureScript{ public: npc_blood_beast() : CreatureScript("npc_blood_beast") { } struct npc_blood_beastAI : public ScriptedAI { npc_blood_beastAI(Creature* creature) : ScriptedAI(creature) { } void reset() { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) me->AI()->AttackStart(target); if (IsHeroic()) DoCast(me, SPELL_SCENT_OF_BLOOD); DoCast(me, SPELL_BLOOD_LINK_BEAST, true); DoCast(me, SPELL_RESISTANT_SKIN, true); } void UpdateAI(const uint32 diff) { if (me->isAttackReady()) { //If we are within range melee the target if (me->IsWithinMeleeRange(me->getVictim())) { if(Creature* saurfang = me->FindNearestCreature(NPC_DEATHBRINGER_SAURFANG, 100.0f, true)) { if (saurfang->GetPower(POWER_ENERGY) != saurfang->GetMaxPower(POWER_ENERGY)) { ActPower = 0; ExtraPower = 0; ActPower = saurfang->GetPower(POWER_ENERGY); ExtraPower = saurfang->GetMaxPower(POWER_ENERGY)/100*10; saurfang->SetPower(POWER_ENERGY,ActPower+ExtraPower); } } me->AttackerStateUpdate(me->getVictim()); me->resetAttackTimer(); } } } private: uint32 ActPower; uint32 ExtraPower; }; CreatureAI* GetAI(Creature* creature) const { return GetIcecrownCitadelAI<npc_blood_beastAI>(creature); }};