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


C++ Slayer::putAdvancedBonusToDEX方法代码示例

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


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

示例1: execute

void CGUseBonusPointHandler::execute (CGUseBonusPoint* pPacket , Player* pPlayer)
	 throw(Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX
	__BEGIN_DEBUG
		
#ifdef __GAME_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);

	// 정상적인 상태가 아니라면 리턴
	GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
	if (pGamePlayer->getPlayerStatus() != GPS_NORMAL) return;

	Creature*      pCreature  = pGamePlayer->getCreature();
	BYTE           which      = pPacket->getWhich();
	Attr_t         cur        = 0;

	if (pCreature->isSlayer() )
	{
		Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
		if (pSlayer->getBonus() <= 0 )
		{
			GCUseBonusPointFail failPkt;
			pPlayer->sendPacket(&failPkt);
			return;
		}

		bool success = false;
		if (which == INC_INT )
		{
			success = pSlayer->putAdvancedBonusToINT();
		}
		else if (which == INC_STR)
		{
			success = pSlayer->putAdvancedBonusToSTR();
		}
		else if (which == INC_DEX)
		{
			success = pSlayer->putAdvancedBonusToDEX();
		}

		if (success )
		{
			GCUseBonusPointOK okpkt;
			pGamePlayer->sendPacket (&okpkt);

			pSlayer->saveExps();
			pSlayer->initAllStatAndSend();
		}
		else
		{
			GCUseBonusPointFail failPkt;
			pPlayer->sendPacket(&failPkt);
			return;
		}
	}
	else if (pCreature->isVampire() ) 
	{
		// 보너스 포인트가 없다면 리턴
		Vampire* pVampire = dynamic_cast<Vampire*>(pCreature);
		if (pVampire->getBonus() <= 0)
		{
			GCUseBonusPointFail failPkt;
			pPlayer->sendPacket(&failPkt);
			return;
		}

		VAMPIRE_RECORD oldRecord;
		// 능력치를 올리기 전에 기존의 능력치를 저장한다.
		pVampire->getVampireRecord(oldRecord);

		if (which == INC_INT)
		{
			cur = pVampire->getINT(ATTR_BASIC) + 1;
			pVampire->setINT(cur, ATTR_BASIC);

			StringStream sst;
			sst << "INTE = " << (int)cur;
			pVampire->tinysave(sst.toString());
			
			/*
			// INT가 증가하면 새로운 기술을 배울 수 있는 가능성이 있다.
			SkillType_t lastSkill = pVampire->findLastSkill();


			// lastSkill의 다음 level의 기술을 찾는다.
			// 못찾았다면 더이상 배울것이 없다는 것.
			for(int i = SKILL_BLOOD_DRAIN + 1 ; i < SKILL_MAX; i++)
			{
				SkillParentInfo* pParentInfo = g_pSkillParentInfoManager->getSkillParentInfo(i);

				if (pParentInfo->hasParent(lastSkill))// 찾았다!
				{
					SkillInfo* pNewSkillInfo = g_pSkillInfoManager->getSkillInfo(i);
					if (pNewSkillInfo->getEXP() <= cur && pVampire->hasSkill(i) == NULL)
					{
						//cout << "(" << pVampire->getName() << ") can learn new skill >> ";

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


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