All pastes #829236 Raw Edit

Anonymous

public text v1 · immutable
#829236 ·published 2007-12-23 00:39 UTC
rendered paste body
#define stomp 6432
class MrSmiteAI : public CreatureAIScript
{
public:
    ADD_CREATURE_FACTORY_FUNCTION(MrSmiteAI);

    MrSmiteAI(Creature * pCreature) : CreatureAIScript(pCreature) 
	{
		smite_stomp = dbcSpell.LookupEntry(stomp);
	}

    void OnCombatStart(Unit * mTarget)
    {
        phase = 0;
    }

    void OnDamageTaken(Unit * mAttacker, float fAmount)
    {
        if(_unit->GetHealthPct() <= 66 && phase == 0)
        {
			Playr = _unit->GetAIInterface()->GetNextTarget();

            _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You landlubbers are tougher than I thought. I'll have to improvise!");
            _unit->PlaySoundToSet(5778);
			_unit->CastSpell(Playr, smite_stomp, true);
            phase++;
			_unit->GetAIInterface()->SetAIState(STATE_SCRIPTMOVE);
            _unit->GetAIInterface()->MoveTo(1.100060f, -780.026367f, 9.811194f, 5.452218f);
            RegisterAIUpdateEvent(500);
        }
        else if(_unit->GetHealthPct() <= 33 && phase == 1)
        {
			Playr = _unit->GetAIInterface()->GetNextTarget();

            _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "D'ah! Now you're making me angry!");
            _unit->PlaySoundToSet(5779);
			_unit->CastSpell(Playr, smite_stomp, true);
            phase++;
			_unit->GetAIInterface()->SetAIState(STATE_SCRIPTMOVE);
            _unit->GetAIInterface()->MoveTo(1.100060f, -780.026367f, 9.811194f, 5.452218f);
            RegisterAIUpdateEvent(500);
        }
    }

    void OnCombatStop(Unit * mTarget)
    {
        _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
        _unit->GetAIInterface()->SetAIState(STATE_IDLE);
        RemoveAIUpdateEvent();
        phase = 0;
        weapons();
    }

    void OnDied(Unit * mKiller)
    {
        RemoveAIUpdateEvent();
    }

    void AIUpdate()
    {
		_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "AIUPDATE WORKS");
		if( _unit->GetPositionX() == 1.100060 && _unit->GetPositionY() == -780.026367 && _unit->GetPositionZ() == 9.811194 )
		{
		_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "DEBUG DEBUG DEBUG DEBUG");
		//_unit->Emote(EMOTE_ONESHOT_LOOT);
		weapons();
		_unit->GetAIInterface()->SetAIState(STATE_ATTACKING);
		//ModifyAIUpdateEvent(3000);   fix later
		}
    }

    void weapons()
    {
        switch(phase)
        {
        case 0:
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 7420);
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, 33490690);
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_01, 768);
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY_01, 0);
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_02, 0);
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_03, 0);
            break;
        case 1:
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY_01, 7419);
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_02, 33490690);
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_03, 781);
            break;
        case 2:
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 19610);
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, 33488898);
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_01, 0);
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY_01, 0);
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_02, 0);
            _unit->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_03, 0);
            //_unit->SetUInt32Value(UNIT_FIELD_BYTES_2, 1);
        }
        RemoveAIUpdateEvent();
    }

protected:
	SpellEntry * smite_stomp;
	Unit * Playr;
    int phase;
};