本文整理汇总了C++中MoonScriptCreatureAI类的典型用法代码示例。如果您正苦于以下问题:C++ MoonScriptCreatureAI类的具体用法?C++ MoonScriptCreatureAI怎么用?C++ MoonScriptCreatureAI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MoonScriptCreatureAI类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AIUpdate
/*
At <= 50% He will spawn 2 Defias Blackguards
ToDo: Make them despawn WHEN he dies, also make them unlootable
*/
void AIUpdate()
{
if(GetHealthPercent() <= 75 && GetPhase() == 1)
{
Emote("Lap dogs, all of you.", Text_Yell, 5782);
SetPhase(2);
}
else if(GetHealthPercent() <= 50 && GetPhase() == 2)
{
Emote("Fools! Our cause is righteous.", Text_Yell, 5783);
// Defias Blackguard x 2
MoonScriptCreatureAI* Guard = NULL;
for(int x=0; x<2; x++)
{
Guard = SpawnCreature(636);
if(Guard == NULL)
continue;
Guard->SetDespawnWhenInactive(true);
Guard->GetUnit()->m_noRespawn = true;
Guard = NULL;
}
SetPhase(3);
}
else if(GetHealthPercent() <= 25 && GetPhase() == 3)
{
Emote("The brotherhood shall remain.", Text_Yell, 5784);
SetPhase(4);
}
ParentClass::AIUpdate();
}
示例2: AIUpdate
void AIUpdate()
{
if (GetHealthPercent() <= 75 && GetPhase() == 1)
{
_unit->SendScriptTextChatMessage(7723); // Lapdogs, all of you!
SetPhase(2);
}
else if (GetHealthPercent() <= 50 && GetPhase() == 2)
{
_unit->SendScriptTextChatMessage(7725); // Fools! Our cause is righteous!
for (int x = 0; x < 2; x++)
{
MoonScriptCreatureAI* Guard = SpawnCreature(636);
if (Guard != NULL)
{
Guard->SetDespawnWhenInactive(true);
Guard->GetUnit()->m_noRespawn = true;
}
}
SetPhase(3);
}
else if (GetHealthPercent() <= 25 && GetPhase() == 3)
{
_unit->SendScriptTextChatMessage(7727); // The Brotherhood shall prevail!
SetPhase(4);
}
ParentClass::AIUpdate();
}
示例3: OnDied
void OnDied(Unit* pKiller)
{
MoonScriptCreatureAI* mLadySacrolash = GetNearestCreature(CN_LADY_SACROLASH);
if( mLadySacrolash != NULL && mLadySacrolash->IsAlive() )
{
mLadySacrolash->Emote("Alythess! Your fire burns within me!", Text_Yell, 12488);
}
ParentClass::OnDied(pKiller);
}
示例4: SetupPatrol
void SetupPatrol(uint32 entry)
{
MoonScriptCreatureAI* Patrol = NULL;
Patrol = SpawnCreature(entry, (-216.863632f+RandomFloat(10)-10), (514.258423f+RandomFloat(10)-10), 51.537754f, 1.480364f);
if(Patrol == NULL)
return;
Patrol->AddWaypoint(Patrol->CreateWaypoint(1, 2500, Flag_Walk, PatrolCoords[3]));
Patrol->AddWaypoint(Patrol->CreateWaypoint(2, 2500, Flag_Walk, PatrolCoords[4]));
Patrol->ForceWaypointMove(1);
Patrol = NULL;
}
示例5: SpawnCreature
MoonScriptCreatureAI* MoonScriptCreatureAI::SpawnCreature(uint32 pCreatureId, float pX, float pY, float pZ, float pO, bool pForceSameFaction, Unit *pTarget)
{
Creature *NewCreature = _unit->GetMapMgr()->GetMapScript()->SpawnCreature(pCreatureId, pX, pY, pZ, pO);
MoonScriptCreatureAI* CreatureScriptAI = ( NewCreature ) ? static_cast<MoonScriptCreatureAI*>(NewCreature->GetScript()) : NULL;
if( pForceSameFaction && NewCreature )
{
uint32 FactionTemplate = _unit->GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE);
NewCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, FactionTemplate);
}
if (pTarget!=NULLUNIT)
CreatureScriptAI->AttackPlayer(pTarget);
return CreatureScriptAI;
}
示例6: OnDied
void OnDied(Unit* pKiller)
{
GetUnit()->SendChatMessageAlternateEntry(4275, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Who dares interfere with the Sons of Arugal?");
GetUnit()->PlaySoundToSet(5791);
MoonScriptCreatureAI* voidwalker = NULL;
// Spawn 4 x Arugal's Voidwalkers
for(int x = 1; x < 5; x++)
{
voidwalker = SpawnCreature(4627, VWSpawns[x].x, VWSpawns[x].y, VWSpawns[x].z, VWSpawns[x].o);
if(voidwalker)
{
voidwalker->AggroNearestPlayer();
voidwalker = NULL;
}
}
ParentClass::OnDied(pKiller);
}
示例7: OnReachWP
void OnReachWP(uint32 iWaypointId, bool bForwards)
{
if( iWaypointId == 1 )
{
switch( RandomUInt(2) )
{
case 0: Emote( "Life from the lifelessness... death for you.", Text_Yell, 13961); break;
case 1: Emote( "Nothing is wasted in the process. You will see....", Text_Yell, 13962); break;
};
MoonScriptCreatureAI* pAnvil = GetNearestCreature( CN_VOLKHANS_ANVIL );
if( pAnvil )
_unit->CastSpell( pAnvil->GetUnit(), SPELL_TEMPER, true );
else
_unit->CastSpell( GetUnit(), SPELL_TEMPER, true );
SetCanEnterCombat( true );
_unit->GetAIInterface()->AttackReaction( GetNearestPlayer() , 1 ); // hackfix
};
};
示例8: AIUpdate
void AIUpdate()
{
// Every 25% Halazzi calls on the lynx
if(!mLynx && GetHealthPercent() <= (100 - SplitCount * 25))
Split();
// Lynx OR Halazzi is at 20% HP Merge them together again
if(mLynx && (mLynx->GetHealthPct() <= 20 || GetHealthPercent() <= 20))
Merge();
// At <25% Phase 3 begins
if(GetHealthPercent() < 25 && GetPhase() == 1)
{
ResetTimer(mTotemTimer, 30000);
SetPhase(3);
}
if(GetPhase() == 2 || GetPhase() == 3)
{
if(IsTimerFinished(mTotemTimer))
{
MoonScriptCreatureAI* Totem = NULL;
Totem = SpawnCreature(CN_TOTEM, (_unit->GetPositionX() + RandomFloat(3) - 3), (_unit->GetPositionY() + RandomFloat(3) - 3), _unit->GetPositionZ(), 0, true);
if(Totem)
{
Totem->Despawn(60000); // Despawn in 60 seconds
Totem->AggroNearestPlayer();
Totem = NULL;
}
switch(GetPhase())
{
case 2:
ResetTimer(mTotemTimer, 60000);
break;
case 3:
ResetTimer(mTotemTimer, 30000);
break; // Spawn them faster then phase 2
}
}
}
}
示例9: ForceofNeltharakuSpell
bool ForceofNeltharakuSpell(uint32 i, SpellPointer pSpell) // Becoming a Shadoweave Tailor
{
if(pSpell->u_caster->IsPlayer() == false)
return true;
PlayerPointer pPlayer= TO_PLAYER(pSpell->u_caster);
UnitPointer pUnit = TO_UNIT(pPlayer->GetMapMgr()->GetCreature(GET_LOWGUID_PART(pPlayer->GetSelection())));
if(pUnit == NULLUNIT)
return true;
if(!pUnit->IsCreature())
return true;
CreaturePointer pTarget = TO_CREATURE(pUnit);
QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry(10854);
if(pQuest == NULL)
return true;
if(pTarget->GetEntry() == 21722 && pPlayer->CalcDistance(pUnit)<30)
{
if ( pQuest && pQuest->GetMobCount(0) < pQuest->GetQuest()->required_mobcount[0] )
{
pTarget->CastSpell(pPlayer, dbcSpell.LookupEntry(38775), true);
pQuest->SetMobCount(0, pQuest->GetMobCount(0)+1);
pQuest->SendUpdateAddKill(0);
pQuest->UpdatePlayerFields();
if ( pTarget->GetScript() != NULL )
{
MoonScriptCreatureAI *pDrakeAI = static_cast<MoonScriptCreatureAI*>(pTarget->GetScript());
pDrakeAI->SetCanMove(true);
pDrakeAI->SetWaypointToMove(0);
}
}
}
return true;
}
示例10: AIUpdate
void AIUpdate()
{
ParentClass::AIUpdate();
if( IsTimerFinished( mSummonTime ) )
{
MoonScriptCreatureAI *Eagle = NULL;
// Spawn 3 Soaring Eagles
for(int x=0; x<3; x++)
{
Eagle = SpawnCreature(CN_SOARING_EAGLE, ( _unit->GetPositionX() + RandomFloat( 12 ) - 10 ), ( _unit->GetPositionY()+ RandomFloat( 12 ) - 15 ),
_unit->GetPositionZ(), _unit->GetOrientation(), true);
if(Eagle)
{
Eagle->AggroNearestUnit();
Eagle->SetDespawnWhenInactive(true);
}
}
Eagle = NULL;
Emote("Feed, me bruddahs!", Text_Yell, 12019);
// Restart the timer
ResetTimer( mSummonTime, 120000);
}
}
示例11: RestartEncounter
void RestartEncounter()
{
for( vector<Creature*>::iterator CreatureIter = mEncounterArray.begin(); CreatureIter != mEncounterArray.end(); ++CreatureIter )
{
Creature* pCreature = (*CreatureIter);
if( pCreature != NULL )
{
if( pCreature->isAlive() )
pCreature->Despawn( 1000, 0);
else
sEventMgr.AddEvent( pCreature, &Creature::SafeDelete, EVENT_CREATURE_REMOVE_CORPSE, 1000, 1, 0);
}
};
mEncounterArray.clear();
// lets remove adds =>
for( std::set< Object* >::iterator itr = _unit->GetInRangeSetBegin(); itr != _unit->GetInRangeSetEnd(); ++itr )
{
if( (*itr)->IsInWorld() && (*itr)->IsCreature() )
{
Creature* pAdd = static_cast<Creature*>(*itr);
if( pAdd->isAlive() && ( pAdd->GetEntry() == CN_FELFIRE_PORTAL || pAdd->GetEntry() == CN_VOLATILE_FELFIRE_FIEND ) )
pAdd->Despawn( 1000, 0 );
};
};
MoonScriptCreatureAI* Anveena = SpawnCreature(CN_ANVEENA, 1698.550049f, 628.033020f, 72.541901f, 3.864760f);
if( Anveena && Anveena->GetUnit() )
AddEncounterCreature( Anveena->GetUnit() );
for( int i = 0; i < 3; ++i )
{
MoonScriptCreatureAI* pHand = SpawnCreature( CN_HAND_OF_THE_DECEIVER, HandSpawn[i].mX, HandSpawn[i].mY, HandSpawn[i].mZ, HandSpawn[i].mO );
if( pHand && pHand->GetUnit() )
AddEncounterCreature( pHand->GetUnit() );
};
mStartCount = 0;
ApplyAura( 46410 );
};
示例12: VoidZoneArc
void VoidZoneArc()
{
ResetTimer(VoidTimer, (RandomUInt(10) + 30) * 1000);
std::vector<Player*> TargetTable;
set< Object* >::iterator Itr = _unit->GetInRangePlayerSetBegin();
for (; Itr != _unit->GetInRangePlayerSetEnd(); Itr++)
{
Player* RandomTarget = NULL;
if (!(*Itr)->IsPlayer())
continue;
RandomTarget = TO< Player* >(*Itr);
if (RandomTarget && RandomTarget->isAlive() && isHostile(*Itr, _unit))
TargetTable.push_back(RandomTarget);
}
if (!TargetTable.size())
return;
size_t RandTarget = rand() % TargetTable.size();
Player* RTarget = TargetTable[RandTarget];
if (!RTarget)
return;
float vzX = RandomUInt(5) * cos(RandomFloat(6.28f)) + RTarget->GetPositionX();
float vzY = RandomUInt(5) * cos(RandomFloat(6.28f)) + RTarget->GetPositionY();
float vzZ = RTarget->GetPositionZ();
MoonScriptCreatureAI* VoidZone = SpawnCreature(CN_VOIDZONEARC, vzX, vzY, vzZ);
VoidZone->GetUnit()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
VoidZone->GetUnit()->m_noRespawn = true;
if (!VoidZone->GetUnit()->IsInWorld())
{
VoidZone->Despawn();
return;
}
RTarget = NULL;
VoidZone->Despawn(60000, 0);
}
示例13: AIUpdate
void AIUpdate()
{
if(IsTimerFinished(mJovaanTimer))
{
switch(mJovaanPhase)
{
case 0:
{
MoonScriptCreatureAI* pRazuunAI = SpawnCreature(21502, -3300.47f, 2927.22f, 173.870f, 2.42924f, false); // Spawn Razuun
if(pRazuunAI != NULL)
{
pRazuunAI->GetUnit()->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
pRazuunAI->SetCanEnterCombat(false);
pRazuunAI->SetMoveType(Move_DontMoveWP);
pRazuunAI->SetCanMove(false);
}
_unit->SetStandState(STANDSTATE_KNEEL);
_unit->Emote(EMOTE_ONESHOT_TALK);
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Everything is in readiness, warbringer.");
mJovaanPhase = 1;
ResetTimer(mJovaanTimer, 6000);
}
break;
case 1:
{
_unit->Emote(EMOTE_ONESHOT_TALK);
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Warbringer, that will require the use of all the hold's infernals. It may leave us vulnerable to a counterattack.");
mJovaanPhase = 2;
ResetTimer(mJovaanTimer, 11000);
}
break;
case 2:
{
_unit->SetStandState(STANDSTATE_STAND);
mJovaanPhase = 3;
ResetTimer(mJovaanTimer, 1000);
}
break;
case 3:
{
_unit->Emote(EMOTE_ONESHOT_SALUTE);
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "It shall be as you say, warbringer. One last question, if I may...");
mJovaanPhase = 4;
ResetTimer(mJovaanTimer, 10000);
}
break;
case 4:
{
_unit->Emote(EMOTE_ONESHOT_QUESTION);
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "What's in the crate?");
mJovaanPhase = 5;
ResetTimer(mJovaanTimer, 10000);
}
break;
case 5:
{
_unit->Emote(EMOTE_ONESHOT_SALUTE);
mJovaanPhase = -1;
RemoveTimer(mJovaanTimer);
}
break;
}
}
ParentClass::AIUpdate();
}