本文整理汇总了C++中UnitPointer::CastSpell方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitPointer::CastSpell方法的具体用法?C++ UnitPointer::CastSpell怎么用?C++ UnitPointer::CastSpell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitPointer
的用法示例。
在下文中一共展示了UnitPointer::CastSpell方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleMonsterCastCommand
bool ChatHandler::HandleMonsterCastCommand(const char * args, WorldSession * m_session)
{
UnitPointer crt = getSelectedCreature(m_session, false);
if(!crt)
{
RedSystemMessage(m_session, "Please select a creature before using this command.");
return true;
}
uint32 spellId = (uint32)atoi(args);
crt->CastSpell(m_session->GetPlayer()->GetGUID(),spellId,true);
return true;
}
示例2: OnDamageTaken
void OnDamageTaken(UnitPointer mAttacker, float fAmount)
{
if( (int)( last_creation_hp - DISPARSE_HP ) >= _unit->GetHealthPct() )
{
switch(rand()%2)
{
case 0:
_unit->SendChatMessage( CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "The slightest spark shall be your undoing." );
break;
case 1:
_unit->SendChatMessage( CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "No one is safe!" );
break;
}
spark_timer = getMSTime() + SPARK_PHASE_DURATION;
last_creation_hp = _unit->GetHealthPct();
_unit->CastSpell(_unit, 52770, true);//disperse, dummy
_unit->Root();
_unit->GetAIInterface()->disable_combat = false;
_unit->m_invisible = false;
_unit->UpdateVisibility();
//disparse
for( uint8 i=0; i<SPARKS_COUNT; i++)
if( sparks[i] != 0 )
{
UnitPointer Spark = _unit->GetMapMgr()->GetUnit( sparks[i] );
if( Spark )
{
uint32 spellid = heroic ? 59833 : 52667;
Spark->CastSpell(Spark, spellid, true);
Spark->UnRoot();
_unit->GetAIInterface()->disable_combat = false;
PlayerPointer p_target = GetRandomPlayerTarget();
if( p_target )
{
Spark->GetAIInterface()->MoveTo(p_target->GetPositionX(),p_target->GetPositionY(), p_target->GetPositionZ(), p_target->GetOrientation());
}
}
}
}
}