• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ UnitPointer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中UnitPointer的典型用法代码示例。如果您正苦于以下问题:C++ UnitPointer类的具体用法?C++ UnitPointer怎么用?C++ UnitPointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UnitPointer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: getSelectedChar

bool ChatHandler::HandleCastSpellCommand(const char* args, WorldSession *m_session)
{
	UnitPointer caster = m_session->GetPlayer();
	UnitPointer target = getSelectedChar(m_session, false);
	if(!target)
		target = getSelectedCreature(m_session, false);
	if(!target)
	{
		RedSystemMessage(m_session, "Must select a char or creature.");
		return false;
	}

	uint32 spellid = atol(args);
	SpellEntry *spellentry = dbcSpell.LookupEntry(spellid);
	if(!spellentry)
	{
		RedSystemMessage(m_session, "Invalid spell id!");
		return false;
	}
	
	SpellPointer sp(new Spell(caster, spellentry, false, NULLAURA));
	if(!sp)
	{
		RedSystemMessage(m_session, "Spell failed creation!");
		sp->Destructor();
		sp = NULLSPELL;
		return false;
	}

	BlueSystemMessage(m_session, "Casting spell %d on target.", spellid);
	SpellCastTargets targets;
	targets.m_unitTarget = target->GetGUID();
	sp->prepare(&targets);
	return true;
}
开发者ID:CadeLaRen,项目名称:Xeon-MMORPG-Emulator,代码行数:35,代码来源:Level2.cpp


示例2: HandleListAIAgentCommand

bool ChatHandler::HandleListAIAgentCommand(const char* args, WorldSession *m_session)
{
	UnitPointer target = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(m_session->GetPlayer()->GetSelection()));
	if(!target)
	{
		RedSystemMessage(m_session, "You have to select a Creature!");
		return false;
	}

	std::stringstream sstext;
	sstext << "agentlist of creature: " << target->GetGUID() << '\n';

	std::stringstream ss;
	ss << "SELECT * FROM ai_agents where entry=" << target->GetUInt32Value(OBJECT_FIELD_ENTRY);
	QueryResult *result = WorldDatabase.Query( ss.str().c_str() );

	if( !result )
		return false;

	do
	{
		Field *fields = result->Fetch();
		sstext << "agent: "   << fields[1].GetUInt16()
			<< " | spellId: " << fields[5].GetUInt32()
			<< " | Event: "   << fields[2].GetUInt32()
			<< " | chance: "  << fields[3].GetUInt32()
			<< " | count: "   << fields[4].GetUInt32() << '\n';
	} while( result->NextRow() );

	delete result;

	SendMultilineMessage(m_session, sstext.str().c_str());

	return true;
}
开发者ID:CadeLaRen,项目名称:Xeon-MMORPG-Emulator,代码行数:35,代码来源:Level2.cpp


示例3: Execute

bool Execute(uint32 i, SpellPointer pSpell)
{
    //uint32 uSpellId = pSpell->m_spellInfo->Id;
    uint32 base_dmg = pSpell->damage;
    /*
    Attempt to finish off a wounded foe, causing 125 damage and converting each extra point
    of rage into 3 additional damage.  Only usable on enemies that have less than 20% health.
    */

    UnitPointer target = pSpell->GetUnitTarget();
    if(!target || !pSpell->u_caster) return true;

    // "Only usable on enemies that have less than 20% health."
    if(target->GetHealthPct() > 20)
    {
        // send failed
        pSpell->SendCastResult(SPELL_FAILED_BAD_TARGETS);
        return true;
    }

    // get the caster's rage points, and convert them
    // formula is 3 damage * spell rank * rage points
    uint32 add_damage = (3 * pSpell->m_spellInfo->RankNumber);
    add_damage *= pSpell->u_caster->GetUInt32Value(UNIT_FIELD_POWER2) / 10;   // rage is *10 always
    
    // send spell damage log
	//pSpell->u_caster->SpellNonMeleeDamageLog(target, 20647, base_dmg + add_damage, false);
	SpellEntry *sp_for_the_logs = dbcSpell.LookupEntry(20647);
	pSpell->u_caster->Strike( target, MELEE, sp_for_the_logs, base_dmg + add_damage, 0, 0, true, true );
	// zero rage
    pSpell->u_caster->SetUInt32Value(UNIT_FIELD_POWER2, 0);
    return true;
}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:33,代码来源:WarriorSpells.cpp


示例4: HandleRangeCheckCommand

bool ChatHandler::HandleRangeCheckCommand( const char *args , WorldSession *m_session )
{
	WorldPacket data;
	uint64 guid = m_session->GetPlayer()->GetSelection();
	m_session->SystemMessage( "=== RANGE CHECK ===" );
	if (guid == 0)
	{
		m_session->SystemMessage("No selection imo.");
		return true;
	}

	UnitPointer unit = m_session->GetPlayer()->GetMapMgr()->GetUnit( guid );
	if(!unit)
	{
		m_session->SystemMessage("Invalid selection imo.");
		return true;
	}
	float DistSq = unit->GetDistanceSq( TO_OBJECT(m_session->GetPlayer()) );
	m_session->SystemMessage( "GetDistanceSq  :   %u" , FL2UINT( DistSq ) );
	LocationVector locvec( m_session->GetPlayer()->GetPositionX() , m_session->GetPlayer()->GetPositionY() , m_session->GetPlayer()->GetPositionZ() );
	float DistReal = unit->CalcDistance( locvec );
	m_session->SystemMessage( "CalcDistance   :   %u" , FL2UINT( DistReal ) );
	float Dist2DSq = unit->GetDistance2dSq( TO_OBJECT(m_session->GetPlayer()) );
	m_session->SystemMessage( "GetDistance2dSq:   %u" , FL2UINT( Dist2DSq ) );
	return true;
}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:26,代码来源:Level0.cpp


示例5: SpellCast

    void SpellCast(float val)
    {
        if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())
        {
			float comulativeperc = 0;
		    UnitPointer target = NULLUNIT;
			for(int i=0;i<nrspells;i++)
			{
				if(!spells[i].perctrigger) continue;
				
				if(m_spellcheck[i])
				{
					if (!spells[i].instant)
						_unit->GetAIInterface()->StopMovement(1);


					if (i == 3)
					{
						uint32 t = (uint32)time(NULL);
						if (t > spells[2].casttime && RandomUInt(2) == 1)
						{
							_unit->CastSpell(_unit, spells[2].info, spells[2].instant);

							spells[2].casttime = t + spells[2].cooldown;
						}
					}

					target = _unit->GetAIInterface()->GetNextTarget();
					switch(spells[i].targettype)
					{
						case TARGET_SELF:
						case TARGET_VARIOUS:
							_unit->CastSpell(_unit, spells[i].info, spells[i].instant); break;
						case TARGET_ATTACKING:
							_unit->CastSpell(target, spells[i].info, spells[i].instant); break;
						case TARGET_DESTINATION:
							_unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break;
						case TARGET_RANDOM_FRIEND:
						case TARGET_RANDOM_SINGLE:
						case TARGET_RANDOM_DESTINATION:
							CastSpellOnRandomTarget(i, spells[i].mindist2cast, spells[i].maxdist2cast, spells[i].minhp2cast, spells[i].maxhp2cast); break;
					}

					m_spellcheck[i] = false;
					return;
				}

				uint32 t = (uint32)time(NULL);
				if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger) && t > spells[i].casttime)
				{
					_unit->setAttackTimer(spells[i].attackstoptimer, false);
					spells[i].casttime = t + spells[i].cooldown;
					m_spellcheck[i] = true;
				}
				comulativeperc += spells[i].perctrigger;
			}
        }
    }
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:58,代码来源:Instance_ManaTombs.cpp


示例6: getSelectedCreature

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;
}
开发者ID:CadeLaRen,项目名称:Xeon-MMORPG-Emulator,代码行数:12,代码来源:Level2.cpp


示例7: GuardsOnWave

void GuardsOnWave(PlayerPointer pPlayer, UnitPointer pUnit)
{
	if ( pPlayer == NULLPLR || pUnit == NULLUNIT )
		return;

	// Check if we are friendly with our Guards (they will wave only when You are)
	if (((pUnit->GetEntry() == 68 || pUnit->GetEntry() == 1976) && pPlayer->GetStandingRank(72) >= FRIENDLY) || (pUnit->GetEntry() == 3296 && pPlayer->GetStandingRank(76) >= FRIENDLY))
	{
		uint32 EmoteChance = RandomUInt(100);
		if(EmoteChance < 33) // 1/3 chance to get Bow from Guard
			pUnit->Emote(EMOTE_ONESHOT_WAVE);
	}
}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:13,代码来源:RandomScripts.cpp


示例8: HandleKillCommand

bool ChatHandler::HandleKillCommand(const char *args, WorldSession *m_session)
{
	UnitPointer target = m_session->GetPlayer()->GetMapMgr()->GetUnit(m_session->GetPlayer()->GetSelection());
	if(target == 0)
	{
		RedSystemMessage(m_session, "A valid selection is required.");
		return true;
	}

	switch(target->GetTypeId())
	{
	case TYPEID_PLAYER:
		sGMLog.writefromsession(m_session, "used kill command on PLAYER %s", TO_PLAYER( target )->GetName() );
		break;

	case TYPEID_UNIT:
		sGMLog.writefromsession(m_session, "used kill command on CREATURE %s", TO_CREATURE( target )->GetCreatureName() ? TO_CREATURE( target )->GetCreatureName()->Name : "unknown");
		break;
	}
	

	// If we're killing a player, send a message indicating a gm killed them.
	if(target->IsPlayer())
	{
		PlayerPointer plr = TO_PLAYER(target);
		m_session->GetPlayer()->DealDamage(plr, plr->GetUInt32Value(UNIT_FIELD_HEALTH),0,0,0);
		//plr->SetUInt32Value(UNIT_FIELD_HEALTH, 0);
		plr->KillPlayer();
		BlueSystemMessageToPlr(plr, "%s killed you with a GM command.", m_session->GetPlayer()->GetName());
	}
	else
	{

		// Cast insta-kill.
		SpellEntry * se = dbcSpell.LookupEntry(5);
		if(se == 0) return false;

		SpellCastTargets targets(target->GetGUID());
		SpellPointer sp(new Spell(m_session->GetPlayer(), se, true, NULLAURA));
		sp->prepare(&targets);

/*		SpellEntry * se = dbcSpell.LookupEntry(20479);
		if(se == 0) return false;
		
		SpellCastTargets targets(target->GetGUID());
		SpellPointer sp(new Spell(target, se, true, NULLAURA));
		sp->prepare(&targets);*/
	}

	return true;
}
开发者ID:CadeLaRen,项目名称:Xeon-MMORPG-Emulator,代码行数:51,代码来源:Level2.cpp


示例9: SpellCast

void SpellCast(float val)
    {
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())
{
float comulativeperc = 0;
UnitPointer target = NULLUNIT;
for(int i=0;i<nrspells;i++)
{
if(!spells[i].perctrigger) continue;
                
if(m_spellcheck[i])
{
target = _unit->GetAIInterface()->GetNextTarget();
switch(spells[i].targettype)
{
case TARGET_SELF:

case TARGET_VARIOUS:
_unit->CastSpell(_unit, spells[i].info, spells[i].instant);
break;

case TARGET_ATTACKING:
_unit->CastSpell(target, spells[i].info, spells[i].instant);
break;

case TARGET_DESTINATION:
_unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant);
break;
}

if (spells[i].speech != "")
{
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, spells[i].speech.c_str());
_unit->PlaySoundToSet(spells[i].soundid);
}

m_spellcheck[i] = false;
return;
}

if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger))
{
_unit->setAttackTimer(spells[i].attackstoptimer, false);
m_spellcheck[i] = true;
}

comulativeperc += spells[i].perctrigger;
}
}
}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:50,代码来源:Instance_ScarletMonastery.cpp


示例10: DEBUG_LOG

void WorldSession::HandleAddDynamicTargetOpcode(WorldPacket & recvPacket)
{

	DEBUG_LOG( "WORLD"," got CMSG_PET_CAST_SPELL." );
	uint64 guid;
	uint8 counter;
	uint32 spellid;
	uint8 flags;
	UnitPointer caster;
	SpellCastTargets targets;
	SpellEntry *sp;
	SpellPointer pSpell;
	list<AI_Spell*>::iterator itr;

	recvPacket >> guid >> counter >> spellid >> flags;
	sp = dbcSpell.LookupEntry(spellid);

	// Summoned Elemental's Freeze
    if (spellid == 33395)
	{
		caster = _player->m_Summon;
		if( caster && TO_PET(caster)->GetAISpellForSpellId(spellid) == NULL )
			return;
	}
	else
	{
		caster = _player->m_CurrentCharm;
		if( caster != NULL )
		{
			for(itr = caster->GetAIInterface()->m_spells.begin(); itr != caster->GetAIInterface()->m_spells.end(); ++itr)
			{
				if( (*itr)->spell->Id == spellid )
					break;
			}

			if( itr == caster->GetAIInterface()->m_spells.end() )
				return;
		}
	}

	if( caster == NULL || guid != caster->GetGUID() )
		return;
	
	targets.read(recvPacket, _player->GetGUID());

	pSpell = SpellPointer(new Spell(caster, sp, false, NULLAURA));
	pSpell->prepare(&targets);
}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:48,代码来源:SpellHandler.cpp


示例11: OnDied

	void OnDied(UnitPointer mKiller)
	{
		if(!mKiller)
			return;

		if (mKiller->IsPlayer()) 
		{
			QuestLogEntry *en = NULL;
			en = (TO_PLAYER(mKiller))->GetQuestLogForEntry(10703);
			if (en == NULL)
			{
				en = (TO_PLAYER(mKiller))->GetQuestLogForEntry(10702);
				if (en == NULL)
				{
					return;
				}
			}

			if(en->GetMobCount(0) < en->GetQuest()->required_mobcount[0])
			{
				uint32 newcount = en->GetMobCount(0) + 1;
				en->SetMobCount(0, newcount);
				en->SendUpdateAddKill(0);
				en->UpdatePlayerFields();
			}
		}
		return;
	}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:28,代码来源:Shadowmoon.cpp


示例12: SpellFunc_CrystalSpikes

void SpellFunc_CrystalSpikes( SpellDesc* pThis, MoonScriptCreatureAI* pCreatureAI, UnitPointer pTarget, TargetType pType )
{
	if(pCreatureAI != NULL)
	{
		if( pTarget == NULL )
			return;

		for (int i = -2; i < 2; i++)
		{
			float x = pTarget->GetPositionX() + ( i * 3.0 );
			float y = pTarget->GetPositionY() + ( i * 3.0 );

			pCreatureAI->GetUnit()->GetMapMgr()->GetInterface()->SpawnCreature( CN_CRYSTAL_SPIKE, x, y, pTarget->GetPositionZ(), pTarget->GetOrientation(), true, true, NULL, NULL );
		};
		pCreatureAI->Emote( "Bleed!", Text_Yell, 13332 );
	};
};
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:17,代码来源:Instance_Nexus.cpp


示例13: OnCombatStart

	void OnCombatStart(UnitPointer mTarget) 
	{
		_unit->GetAIInterface()->m_canMove = false;
		_unit->GetAIInterface()->disable_melee = true;
		_unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

		UnitPointer antusul = NULLUNIT;
		antusul = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(1815.030029f, 686.817017f, 14.519000f, 8127);
		if(antusul)
		{
			if(antusul->isAlive())
			{
				antusul->GetAIInterface()->AttackReaction(mTarget, 0, 0);
				antusul->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Lunch has arrived, my beutiful childern. Tear them to pieces!");
			}
		}
	}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:17,代码来源:Instance_ZulFarrak.cpp


示例14: HookOnPlayerKill

void ArathiBasin::HookOnPlayerKill(PlayerPointer plr, UnitPointer pVictim)
{
	if(pVictim->IsPlayer())
	{
		plr->m_bgScore.KillingBlows++;
		UpdatePvPData();
	}
}
开发者ID:CadeLaRen,项目名称:Xeon-MMORPG-Emulator,代码行数:8,代码来源:ArathiBasin.cpp


示例15: HookOnPlayerKill

void Arena::HookOnPlayerKill(PlayerPointer plr, UnitPointer pVictim)
{
	if( !pVictim->IsPlayer() )
		return;

	plr->m_bgScore.KillingBlows++;
	UpdatePlayerCounts();
}
开发者ID:CadeLaRen,项目名称:Xeon-MMORPG-Emulator,代码行数:8,代码来源:Arenas.cpp


示例16: OnDied

	void OnDied( UnitPointer pKiller )
	{
		PlayerPointer QuestHolder = NULLPLR;
		if ( pKiller->IsPlayer() )
			QuestHolder = TO_PLAYER( pKiller );
		else if ( pKiller->IsPet() && TO_PET( pKiller )->GetPetOwner() != NULLPLR )
			QuestHolder = TO_PET( pKiller )->GetPetOwner();

		if ( QuestHolder == NULLPLR )
			return;

		// M4ksiu: I don't think the method is correct, but it can stay the way it was until someone gives proper infos
		QuestLogEntry* Quest = QuestHolder->GetQuestLogForEntry( 9670 );
		CreaturePointer RandomCreature = NULLCREATURE;
		if ( Quest == NULL )
		{
			// Creatures from Bloodmyst Isle
			uint32 Id[ 51 ] = { 17681, 17887, 17550, 17323, 17338, 17341, 17333, 17340, 17353, 17320, 17339, 17337, 17715, 17322, 17494, 17654, 17342, 17328, 17331, 17325, 17321, 17330, 17522, 17329, 17524, 17327, 17661, 17352, 17334, 17326, 17324, 17673, 17336, 17346, 17589, 17609, 17608, 17345, 17527, 17344, 17347, 17525, 17713, 17523, 17348, 17606, 17604, 17607, 17610, 17358, 17588 };
			RandomCreature = _unit->GetMapMgr()->GetInterface()->SpawnCreature( Id[ RandomUInt( 50 ) ], _unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), _unit->GetOrientation(), true, false, 0, 0 );
			if ( RandomCreature != NULLCREATURE )
			{
				RandomCreature->m_noRespawn = true;
				RandomCreature->Despawn( 60000, 0 );
			};

			return;
		}
		else
		{
			uint32 Id[ 8 ] = { 17681, 17321, 17330, 17522, 17673, 17336, 17346, 17589 };
			RandomCreature = _unit->GetMapMgr()->GetInterface()->SpawnCreature( Id[ RandomUInt( 7 ) ], _unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), _unit->GetOrientation(), true, false, 0, 0 );
			if ( RandomCreature != NULLCREATURE )
			{
				RandomCreature->m_noRespawn = true;
				RandomCreature->Despawn( 60000, 0 );
				if ( RandomCreature->GetEntry() == 17681 && Quest->GetMobCount( 0 ) < Quest->GetQuest()->required_mobcount[ 0 ] )
				{
					Quest->SetMobCount( 0, Quest->GetMobCount( 0 ) + 1 );
					Quest->SendUpdateAddKill( 0 );
					Quest->UpdatePlayerFields();
				};
			};
		};
	};
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:44,代码来源:BloodmystIsle.cpp


示例17: SpellCast

    void SpellCast(uint32 val)
    {
        if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
        {
			UnitPointer target = _unit->GetAIInterface()->GetNextTarget();
            if(m_shadowbolt)
            {
                _unit->CastSpell(target, infoshadowbolt, true);
                m_shadowbolt = false;
                return;
            }
            
            if(m_gehennascurse)
            {
                _unit->CastSpell(_unit, infogehennascurse, false);
                m_gehennascurse = false;
                return;
            }

			if(m_rainoffire)
            {
                _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), inforainoffire, false);
                m_rainoffire = false;
                return;
            }  

            if(val >= 100 && val <= 180)
            {
                _unit->setAttackTimer(3000, false);
                m_shadowbolt = true;
            }
            if(val > 180 && val <= 260)
            {
                _unit->setAttackTimer(1000, false);
                m_gehennascurse = true;
            }
			if(val > 260 && val <= 300)
            {
                _unit->setAttackTimer(1000, false);
                m_rainoffire = true;
            }
        }
    }
开发者ID:CadeLaRen,项目名称:Xeon-MMORPG-Emulator,代码行数:43,代码来源:Raid_MoltenCore.cpp


示例18: AIUpdate

    void AIUpdate()
    {
		if (!HasSummoned && _unit->GetHealthPct() <= 8)
		{
			UnitPointer Warchief = NULLUNIT;
			Warchief =_unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_REND_BLACKHAND, 157.366516f, -419.779358f, 110.472336f, 3.056772f, true, false, 0, 0);
			if (Warchief != NULL)
			{
				if (_unit->GetAIInterface()->GetNextTarget() != NULL)
				{
					Warchief->GetAIInterface()->AttackReaction(_unit->GetAIInterface()->GetNextTarget(), 1, 0);
				}
			}

			HasSummoned = true;
		}
		
		float val = (float)RandomFloat(100.0f);
        SpellCast(val);
    }
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:20,代码来源:Instance_BlackrockSpire.cpp


示例19: 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());
						}
					}
				}			
		}
	}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:40,代码来源:Instance_HallsOfLightning.cpp


示例20: OnDied

	void OnDied(UnitPointer mKiller)
	{
		if ( mKiller->IsPlayer() )
		{
			QuestLogEntry *pQuest = TO_PLAYER(mKiller)->GetQuestLogForEntry( 9573 );
			if ( pQuest != NULL && pQuest->GetMobCount( 1 ) < pQuest->GetQuest()->required_mobcount[1] )
			{
				pQuest->SetMobCount( 1, pQuest->GetMobCount( 1 ) + 1 );
				pQuest->SendUpdateAddKill( 1 );
				pQuest->UpdatePlayerFields();
			}
		}
	}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:13,代码来源:Azuremyst_Isle.cpp



注:本文中的UnitPointer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ UnitPtr类代码示例发布时间:2022-05-31
下一篇:
C++ UnitObj类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap