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


C++ Ousters::hasSkill方法代码示例

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


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

示例1: execute

void CGDownSkillHandler::execute (CGDownSkill* pPacket , Player* pPlayer)
throw(ProtocolException, Error)
{
    __BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

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

    GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
    Assert(pGamePlayer != NULL);

    PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pGamePlayer->getCreature());
    Assert(pPC != NULL);

    SkillType_t targetSkillType = pPacket->getSkillType();

    GCDownSkillFailed failpkt;
    failpkt.setSkillType(targetSkillType);

    if (!pPC->isOusters() )
    {
        failpkt.setDesc(NOT_OUSTERS);
        pPlayer->sendPacket(&failpkt);

        return;
    }

    Ousters* pOusters = dynamic_cast<Ousters*>(pPC);
    Assert(pOusters != NULL);
    OustersSkillSlot* pTargetSkillSlot = pOusters->getSkill(targetSkillType);

    if (pTargetSkillSlot == NULL )
    {
        failpkt.setDesc(HAVE_NOT_SKILL);
        pPlayer->sendPacket(&failpkt);
        return;
    }

    SkillInfo* pTargetSkillInfo = NULL;

    try
    {
        pTargetSkillInfo = g_pSkillInfoManager->getSkillInfo(targetSkillType);
    }
    catch(Exception& e)
    {
        failpkt.setDesc(INVALID_SKILL);
        pPlayer->sendPacket(&failpkt);

        return;
    }

    if (pTargetSkillSlot->getExpLevel() <= 1 )
    {
        if (!pTargetSkillInfo->canDelete() )
        {
            failpkt.setDesc(TOO_LOW);
            pPlayer->sendPacket(&failpkt);
            return;
        }

        list<SkillType_t>& rRequiredSkills = pTargetSkillInfo->getRequiredSkills();
        list<SkillType_t>::iterator itr = rRequiredSkills.begin();

        for (; itr != rRequiredSkills.end(); ++itr )
        {
            if (pOusters->hasSkill(*itr) != NULL )
            {
                bool canDrop = false;
                SkillInfo* pFollowingSkillInfo = g_pSkillInfoManager->getSkillInfo(*itr);
                list<SkillType_t>& rRequireSkills = pFollowingSkillInfo->getRequireSkills();
                list<SkillType_t>::iterator itr2 = rRequireSkills.begin();
                for (; itr2 != rRequireSkills.end(); ++itr2 )
                {
                    if ((*itr2) != targetSkillType && pOusters->hasSkill(*itr2) != NULL )
                    {
                        SkillInfo* pAlternativeSkillInfo = g_pSkillInfoManager->getSkillInfo(*itr2);
                        if (getSkillMapID((ElementalDomain)pAlternativeSkillInfo->getElementalDomain()) == getSkillMapID((ElementalDomain)pTargetSkillInfo->getElementalDomain()) )
                            canDrop = true;
                    }
                }

                if (!canDrop )
                {
                    failpkt.setDesc(CANNOT_DROP_SKILL);
                    pPlayer->sendPacket(&failpkt);
                    return;
                }
            }
        }
    }

    /*	if (pTargetSkillSlot->getExpLevel() >= 30 )
    	{
    		failpkt.setDesc(TOO_HIGH);
    		pPlayer->sendPacket(&failpkt);
    		return;
    	}*/
//.........这里部分代码省略.........
开发者ID:opendarkeden,项目名称:server,代码行数:101,代码来源:CGDownSkillHandler.cpp

示例2: execute

void CGSkillToInventoryHandler::execute (CGSkillToInventory* pPacket , Player* pPlayer)
	 throw(Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX
		
#ifdef __GAME_SERVER__

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

	GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
	Assert(pGamePlayer != NULL);	// by sigi

	if (pGamePlayer->getPlayerStatus() == GPS_NORMAL) 
	{
		Creature* pCreature = pGamePlayer->getCreature();
		Assert(pCreature != NULL);	// by sigi

		Zone* pZone = pCreature->getZone();
		Assert(pZone != NULL);
	
		SkillType_t SkillType = pPacket->getSkillType();

		// 완전 안전지대라면 기술 사용 불가. by sigi. 2002.11.14
		ZoneLevel_t ZoneLevel = pZone->getZoneLevel(pCreature->getX(), pCreature->getY());
		if ((ZoneLevel & COMPLETE_SAFE_ZONE) ||
            (pCreature->isFlag(Effect::EFFECT_CLASS_PARALYZE)) ||
            (pCreature->isFlag(Effect::EFFECT_CLASS_CAUSE_CRITICAL_WOUNDS)) ||
            (pCreature->isFlag(Effect::EFFECT_CLASS_EXPLOSION_WATER)) ||
            (pCreature->isFlag(Effect::EFFECT_CLASS_COMA)))
		{
			GCSkillFailed1 _GCSkillFailed1;
			_GCSkillFailed1.setSkillType(SkillType);
			pPlayer->sendPacket(&_GCSkillFailed1);

			return;
		}

        if (pCreature->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WERWOLF)) {
            switch(SkillType) {
                case SKILL_ATTACK_MELEE:
                case SKILL_BITE_OF_DEATH:
                case SKILL_UN_TRANSFORM:
                case SKILL_RAPID_GLIDING:
                    break;
                default:
                    GCSkillFailed1 _GCSkillFailed1;
                    _GCSkillFailed1.setSkillType(SkillType);
                    pPlayer->sendPacket(&_GCSkillFailed1);
                    dynamic_cast<Vampire*>(pCreature)->sendVampireSkillInfo();
                    return;
            }
        }

		BYTE        X         = pPacket->getX();
		BYTE        Y         = pPacket->getY();
		BYTE        TX        = pPacket->getTargetX();
		BYTE        TY        = pPacket->getTargetY();

		disableFlags(pCreature, pZone, SkillType);

		if (pCreature->isSlayer()) 
		{
			Slayer*    pSlayer    = dynamic_cast<Slayer*>(pCreature);
			SkillSlot* pSkillSlot = pSlayer->hasSkill(SkillType);
			bool       bSuccess   = true;

			if (pSkillSlot == NULL) bSuccess = false;
			if (SkillType == SKILL_INSTALL_MINE ) {
				bSuccess = true;
				TY = 0;
			} else {
				if (!isAbleToUseInventorySkill(pSlayer, X, Y, TX, TY)) bSuccess = false;
			}
/*			if (pSlayer->isFlag(Effect::EFFECT_CLASS_SNIPING_MODE))
			{
				g_Sniping.checkRevealRatio(pSlayer, 20, 10);
			} */

			if (bSuccess)
			{
				SkillHandler* pSkillHandler = g_pSkillHandlerManager->getSkillHandler(SkillType);
				Assert(pSkillHandler != NULL);
   			 	pSkillHandler->execute(pSlayer, pPacket->getObjectID(), pPacket->getInventoryItemObjectID(), X, Y, TX, TY, pSkillSlot);
   			 }
             else
             {
                 GCSkillFailed1 _GCSkillFailed1;
				_GCSkillFailed1.setSkillType(SkillType);
                 pPlayer->sendPacket(&_GCSkillFailed1);
             }
		} 
		else if (pCreature->isVampire()) 
		{
			Vampire*          pVampire          = dynamic_cast<Vampire*>(pCreature);
			VampireSkillSlot* pVampireSkillSlot = pVampire->hasSkill(SkillType);
			bool              bSuccess          = true;
			
			if (pVampireSkillSlot == NULL) bSuccess = false;
			if (!isAbleToUseInventorySkill(pVampire, X, Y, TX, TY)) bSuccess = false;
//.........这里部分代码省略.........
开发者ID:hillwah,项目名称:darkeden,代码行数:101,代码来源:CGSkillToInventoryHandler.cpp

示例3: execute

void CGSkillToTileHandler::execute (CGSkillToTile* pPacket , Player* pPlayer)
throw(Error)
{
    __BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

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

    try
    {
        // 특수기술 테스트를 위해서 임시로 넣어두는 코드이다.
        GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);

        Assert(pGamePlayer != NULL);	// by sigi

        if (pGamePlayer->getPlayerStatus() == GPS_NORMAL)
        {
            Creature* pCreature = pGamePlayer->getCreature();
            Assert(pCreature != NULL);	// by sigi

            Zone* pZone = pCreature->getZone();
            Assert(pZone != NULL);

            SkillType_t SkillType = pPacket->getSkillType();

            // 완전 안전지대라면 기술 사용 불가. by sigi. 2002.11.14
            ZoneLevel_t ZoneLevel = pZone->getZoneLevel(pCreature->getX(), pCreature->getY());
            if ((ZoneLevel & COMPLETE_SAFE_ZONE) ||
                    (pCreature->isFlag(Effect::EFFECT_CLASS_PARALYZE)) ||
                    (pCreature->isFlag(Effect::EFFECT_CLASS_CAUSE_CRITICAL_WOUNDS)) ||
                    (pCreature->isFlag(Effect::EFFECT_CLASS_EXPLOSION_WATER)) ||
                    (pCreature->isFlag(Effect::EFFECT_CLASS_COMA)))
            {
                GCSkillFailed1 _GCSkillFailed1;
                _GCSkillFailed1.setSkillType(SkillType);
                pPlayer->sendPacket(&_GCSkillFailed1);

                return;
            }
            if (pCreature->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WERWOLF)) {
                switch(SkillType) {
                case SKILL_ATTACK_MELEE:
                case SKILL_BITE_OF_DEATH:
                case SKILL_UN_TRANSFORM:
                case SKILL_RAPID_GLIDING:
                    break;
                default:
                    GCSkillFailed1 _GCSkillFailed1;
                    _GCSkillFailed1.setSkillType(SkillType);
                    pPlayer->sendPacket(&_GCSkillFailed1);
                    dynamic_cast<Vampire*>(pCreature)->sendVampireSkillInfo();
                    return;
                }
            }
            if (pCreature->isFlag(Effect::EFFECT_CLASS_ABERRATION ) )
            {
                EffectAberration* pEffect = dynamic_cast<EffectAberration*>(pCreature->findEffect(Effect::EFFECT_CLASS_ABERRATION));
                if (pEffect != NULL && (rand()%100) < pEffect->getRatio())
                {
                    //cout << "aberration affected " << endl;
                    Dir_t dir = rand()%8;
                    pPacket->setX(pPacket->getX() + dirMoveMask[dir].x*3);
                    pPacket->setY(pPacket->getY() + dirMoveMask[dir].y*3);
                }
            }

            disableFlags(pCreature, pZone, SkillType);

            if (pCreature->isSlayer())
            {
                Slayer*    pSlayer    = dynamic_cast<Slayer*>(pCreature);
                SkillSlot* pSkillSlot = ((Slayer *)pCreature)->hasSkill(SkillType);
                bool       bSuccess   = true;

                if (SkillType == SKILL_BURNING_SOL_LAUNCH )
                {
                    pSkillSlot = ((Slayer *)pCreature)->hasSkill(SKILL_BURNING_SOL_CHARGING);
                }

                if (SkillType == SKILL_SWEEP_VICE_3 || SkillType == SKILL_SWEEP_VICE_5 )
                {
                    pSkillSlot = ((Slayer *)pCreature)->hasSkill(SKILL_SWEEP_VICE_1);
                }

                if (SkillType == SKILL_TURRET_FIRE ) pSkillSlot = ((Slayer *)pCreature)->hasSkill(SKILL_INSTALL_TURRET);

                if (pSkillSlot == NULL) bSuccess = false;
                if (!isAbleToUseTileSkill(pSlayer)) bSuccess = false;

                /*				if (pCreature->isSlayer() && pCreature->isFlag(Effect::EFFECT_CLASS_SNIPING_MODE))
                				{
                					Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
                					Assert(pSlayer != NULL);
                					g_Sniping.checkRevealRatio(pSlayer, 20, 10);
                				} */

                if (bSuccess)
                {
//.........这里部分代码省略.........
开发者ID:opendarkeden,项目名称:server,代码行数:101,代码来源:CGSkillToTileHandler.cpp


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