当前位置: 首页>>代码示例>>C++>>正文


C++ Zone::getMonsterManager方法代码示例

本文整理汇总了C++中Zone::getMonsterManager方法的典型用法代码示例。如果您正苦于以下问题:C++ Zone::getMonsterManager方法的具体用法?C++ Zone::getMonsterManager怎么用?C++ Zone::getMonsterManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zone的用法示例。


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

示例1: execute

//////////////////////////////////////////////////////////////////////////////
// 몬스터 셀프 핸들러
//////////////////////////////////////////////////////////////////////////////
void DuplicateSelf::execute(Monster* pMonster)
	throw(Error)
{
	__BEGIN_TRY

	//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl;

	//cout << "DuplicateSelf" << endl;
	MonsterType_t MType = pMonster->getMonsterType();

	map<MonsterType_t, MonsterType_t>::const_iterator itr = m_DuplicateMonsterTypes.find(MType);

	// 분신할 MonsterType이 없으면 분신 모하지..
	if (itr==m_DuplicateMonsterTypes.end())
	{
		//cout <<"DuplicateSelf::noMonsterType: " << (int)MType << endl;
		return;
	}

	MonsterType_t DuplicateMType = itr->second;

	Assert(pMonster != NULL);

	try 
	{
		Zone* pZone = pMonster->getZone();
		Assert(pZone != NULL);

		if (pMonster->isFlag(Effect::EFFECT_CLASS_HIDE))
		{
			//cout << "DuplicateSelf: hide" << endl;
			return;
		}
		if (pMonster->isFlag(Effect::EFFECT_CLASS_INVISIBILITY))
		{
			addVisibleCreature(pZone, pMonster, true);
		}

		//GCSkillToSelfOK2 _GCSkillToSelfOK2;

		ZoneCoord_t x = pMonster->getX();
		ZoneCoord_t y = pMonster->getY();

		bool bRangeCheck    = checkZoneLevelToUseSkill(pMonster);
		//bool bMoveModeCheck = pMonster->isWalking();

		if (bRangeCheck)// && bMoveModeCheck)
		{
			//cout << "DuplicateSelf OK" << endl;
			GCSkillToTileOK5 _GCSkillToTileOK5;

			_GCSkillToTileOK5.setObjectID(pMonster->getObjectID());
			_GCSkillToTileOK5.setSkillType(getSkillType());
			_GCSkillToTileOK5.setX(x);
			_GCSkillToTileOK5.setY(y);
			_GCSkillToTileOK5.setDuration( 0);

			pZone->broadcastPacket(x, y,  &_GCSkillToTileOK5);

			//--------------------------------------------------------
			// 주위에 knockback되는맞는 애들을 체크해준다.
			//--------------------------------------------------------
			//SkillInput input(pMonster);
			//SkillOutput output;
			//computeOutput(input, output);
			// 몬스터를 존에 추가한다.
			SUMMON_INFO		summonInfo;
			summonInfo.scanEnemy = true;
			summonInfo.hasItem = false;
			summonInfo.initHPPercent = pMonster->getHP(ATTR_CURRENT)*100/pMonster->getHP(ATTR_MAX);
			
			int numFake = min((1+rand()%3), pMonster->getINT()/100);

			//cout << "numDuplicate =  " << numFake<< endl;
			MonsterManager* pMonsterManager = pZone->getMonsterManager();
			Assert(pMonsterManager != NULL);

			list<Monster*> summonedMonsters;

			for (int i=0; i<numFake; i++)
			{
				int X = max(0, min((int)pZone->getWidth()-1, (x - 5 + rand()%11)));
				int Y = max(0, min((int)pZone->getHeight()-1, (y - 5 + rand()%11)));

				try
				{
					pMonsterManager->addMonsters(X, Y, DuplicateMType, 1, summonInfo, &summonedMonsters);
				}
				catch (Throwable& t)
				{
					cerr << t.toString() << endl;
				}
			}

			// 잔상을 보여준다.
			list<Monster*>::const_iterator iMonster = summonedMonsters.begin();

//.........这里部分代码省略.........
开发者ID:hillwah,项目名称:darkeden,代码行数:101,代码来源:DuplicateSelf.cpp


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