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


C++ Monster::addEffect方法代码示例

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


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

示例1: addOffering

bool DynamicZoneAlterOfBlood::addOffering()
{
	Assert(m_pZone != NULL);

	for (int i = 0; i < 5; ++i )
	{
		// 제물을 생성하여 추가한다. 제물은 뇌가 없는 몬스터다
		Monster* pMonster = new Monster(OfferingTemplate[m_Race].MonsterType);
		Assert(pMonster != NULL);

		pMonster->setName(OfferingTemplate[m_Race].Name[i]);
		pMonster->setFlag(Effect::EFFECT_CLASS_NO_DAMAGE);

		EffectCauseCriticalWounds* pEffect = new EffectCauseCriticalWounds(pMonster);
		pEffect->setDeadline(999999);
		pMonster->addEffect(pEffect);
		pMonster->setFlag(Effect::EFFECT_CLASS_CAUSE_CRITICAL_WOUNDS);

		try
		{
			m_pZone->addCreature(pMonster, OfferingCoordinate[i].X, OfferingCoordinate[i].Y, 2);

/*			NPCInfo* pNPCInfo = new NPCInfo;
			pNPCInfo->setName(pMonster->getName());
			pNPCInfo->setNPCID(pMonster->getMonsterType());
			pNPCInfo->setX(pMonster->getX());
			pNPCInfo->setY(pMonster->getY());

			m_pZone->addNPCInfo(pNPCInfo);*/

			m_OfferingObjectID[i] = pMonster->getObjectID();
		}
		catch (EmptyTileNotExistException& )
		{
			SAFE_DELETE(pMonster);
		}
	}

	return true;
}
开发者ID:hillwah,项目名称:darkeden,代码行数:40,代码来源:DynamicZoneAlterOfBlood.cpp

示例2: execute


//.........这里部分代码省略.........
Poison Resistance = 70% 
Acid Resistance = 60% 
Curse Resistance = 100% 
Blood Resistance = 50% 
Regen = 1 HP per 1 sec
*/
			Monster* pGroundElemental = new Monster(GROUND_ELEMENTAL_TYPE);
			pGroundElemental->setName("대지 정령");
			pGroundElemental->setHP(1000 + input.SkillLevel * 100);
			pGroundElemental->setHP(1000 + input.SkillLevel * 100, ATTR_MAX);
			pGroundElemental->setDefense(0);
			pGroundElemental->setProtection(0);
			pGroundElemental->setResist(MAGIC_DOMAIN_POISON, 0);
			pGroundElemental->setResist(MAGIC_DOMAIN_ACID, 0);
			pGroundElemental->setResist(MAGIC_DOMAIN_CURSE, 0);
			pGroundElemental->setResist(MAGIC_DOMAIN_BLOOD, 0);
			pGroundElemental->setFlag(Effect::EFFECT_CLASS_IMMUNE_TO_CURSE);
			pGroundElemental->removeFlag(Effect::EFFECT_CLASS_HIDE);
			pGroundElemental->setMoveMode(Creature::MOVE_MODE_WALKING);

			// 무뇌정령
			pGroundElemental->setBrain(NULL);

			pZone->addCreature(pGroundElemental, X, Y, 2);
			X = pGroundElemental->getX();
			Y = pGroundElemental->getY();

			//cout << pGroundElemental->toString() << " 을 " << X << ", " << Y << " 에 불러냈습니다." << endl;

			EffectGroundElemental* pCreatureEffect = new EffectGroundElemental(pGroundElemental);
			pCreatureEffect->setDeadline(output.Duration);

			pGroundElemental->setFlag(pCreatureEffect->getEffectClass());
			pGroundElemental->addEffect(pCreatureEffect);

			GCAddEffect gcAddEffect;
			gcAddEffect.setObjectID(pGroundElemental->getObjectID());
			gcAddEffect.setEffectID(pCreatureEffect->getSendEffectClass());
			pZone->broadcastPacket(X, Y, &gcAddEffect);

//			addSimpleCreatureEffect(pGroundElemental, Effect::EFFECT_CLASS_GROUND_ELEMENTAL_CENTER);

//			for (int i = 0; i < m_MaskIndex[Grade]; ++i )
			for (oX = X - 2 ; oX <= X + 2 ; ++oX )
			for (oY = Y - 2 ; oY <= Y + 2 ; ++oY )
			{
//				oX = m_ElementalMask[Grade][i].x;
//				oY = m_ElementalMask[Grade][i].y;

				if (!rect.ptInRect(oX, oY)) continue;
				if (oX == X && oY == Y ) continue;

				Tile&   tile  = pZone->getTile(oX, oY);
				if (!tile.canAddEffect()) continue;

				if (tile.getEffect(Effect::EFFECT_CLASS_TRYING_POSITION) ) continue;
				
				// 같은 이펙트가 이미 존재한다면 삭제한다.
				Effect* pOldEffect = tile.getEffect(Effect::EFFECT_CLASS_GROUND_ELEMENTAL_AURA);
				if (pOldEffect != NULL)
				{
					ObjectID_t effectID = pOldEffect->getObjectID();
					pZone->deleteEffect(effectID);
				}

				// 이펙트 오브젝트를 생성한다.
开发者ID:hillwah,项目名称:darkeden,代码行数:67,代码来源:SummonGroundElemental.cpp


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