Пример #1
0
//发送技能失败消息
void COpSendMsg::CreateSKillFailMsg()
{
	CMoveShape* pUser = m_pParam->pUser;

	if(m_strVariaName !="")
	{
		//  [5/4/2009 chenxianj]	
		m_lValue = (long)m_pParam->pVariableList->GetVarValue<double>(m_strVariaName.c_str(),0);		
		//  [5/4/2009 chenxianj]
		
	}
	//技能失败重置吟唱时间
	if (pUser)
	{
		m_pParam->pUser->SetIntonateTime(timeGetTime(),0);
	}
	CMessage msg(MSG_S2C_SKILL_USE);
	msg.Add((CHAR)SKILL_USE_RESULT_FAILED);
	msg.Add( pUser->GetExID());
	//id和等级
	msg.Add((long)m_pParam->nID);
	msg.Add((BYTE)m_pParam->nLvl );
	//全局id
	msg.Add(m_pParam->dwGlobleID);
	//错误类型
	msg.Add((BYTE)m_lValue);
	CMoveShape* pPlayer = pUser;
	if( TYPE_PET == pUser->GetType() )
	{
		pPlayer = pUser->GetHost();
	}

	if(m_eRange == MsgRange_Single)
		msg.SendToPlayer(pPlayer->GetExID(), false);
	else if(m_eRange == MsgRange_Around)
		msg.SendToPlayers(m_pParam->SendMsgPlayers);
#ifdef _DEBUG
	char str[256]="";
	_snprintf(str, 256, "发送技能失败消息:技能ID:%6d,全局ID:%6d,阶段号:%d\n",m_pParam->nID,m_pParam->dwGlobleID, m_pParam->nProceNum);
	OutputDebugString(str);
#endif

}
Пример #2
0
void CPKSys::SetPKValue(CMoveShape *pAttacker,CMoveShape *pBeenAttacker,int nAddSub)
{
	//主动攻击(包含使用减益技能)本国白名玩家,每次攻击将增加20点PK值,因此方法获得的PK值上限为20,若PK值已经达到或超过20,则不会再因此方法而增加。	

	if (pAttacker==NULL || pBeenAttacker==NULL)
	{
		return;
	}
	if (pAttacker->GetType()==TYPE_MONSTER)
	{
		return;		
	}
	if (pBeenAttacker->GetType()==TYPE_MONSTER)
	{
		if (((CMonster*)pBeenAttacker)->GetNpcType()!=NT_Guard)
		{
			return;
		}	
	}

	CMoveShape* pAtker = pAttacker;
	CMoveShape* pDefer = pBeenAttacker;
	if( TYPE_PET == pAtker->GetType() )
	{
		pAtker = pAtker->GetHost();
	}

	if( TYPE_PET == pDefer->GetType() )
	{
		pDefer = pDefer->GetHost();
	}

	if( NULL == pAtker || NULL == pDefer )
	{
		//PutoutLog("Pet", LT_ERROR, "...");
		return;
	}

	// [8/24/2009 chenxianj]
	//////////////////////////////////////////////////////////////////////////
	//竞技区域不进行pk值设定
	CServerRegion* pRegion = dynamic_cast<CServerRegion*>( pAttacker->GetFather() );
	if( !pRegion ) 
	{
		return;
	}

	CRegion::eSecurity eSecurityType = pRegion->GetSecurity(pAttacker->GetTileX(),pAttacker->GetTileY());

	if (eSecurityType==CRegion::SECURTIY_FIGHT)
	{
		return;
	}
	//////////////////////////////////////////////////////////////////////////




	long lNum = pAtker->GetPkValue() + GlobalSetup::GetSetup()->dwPkCountPerAttack;

	//攻击本阵营PK值为0的角色(白名角色)/攻击本国或本阵营PK值大于0小于等于20的角色(紫名角色)
	if (nAddSub==2				&&
		IsSameCamp(pAtker,pDefer)&&
		(pDefer->GetPkValue()>=0 && pDefer->GetPkValue()<=20 )&&
		(pAtker->GetPkValue()<20))
	{
		if (lNum>20)
		{
			lNum = 20;
		}
		pAtker->SetPkValue(lNum);		
	}
	//对紫名、红名玩家释放增益技能,每次使用增益技能将增加20点PK值,因此方法获得的PK值上限为20,若PK值已经达到或超过20,则PK值不会再因此方法增加
	else if (nAddSub==1 && (pDefer->GetPkValue()>0) && (pAtker->GetPkValue()<20) && pAtker!=pDefer)
	{
		if (lNum>20)
		{
			lNum = 20;
		}		
		pAtker->SetPkValue(lNum);
	}
	else if (nAddSub==2 && !IsSameCamp(pAtker,pDefer) && pDefer->GetPVPValue()==0 && pDefer->GetPkValue()<=20 && pAtker->GetPVPValue()<20)
	{
		if(pRegion->GetStrongPointFlag()==false) // 未开启据点战标志
		{
			//攻击非本阵营恶名值为0且PK值小于等于20的角色
			long lNum = pAtker->GetPVPValue() + GlobalSetup::GetSetup()->dwPkCountPerAttack;
			if( lNum > (long) GlobalSetup::GetSetup()->dwPkCountPerAttack)
			{
				lNum = GlobalSetup::GetSetup()->dwPkCountPerAttack;
			}
			pAtker->SetAttribute("PVPValue",lNum);
			pAtker->UpdateAttribute();
		}
	}
	else if (nAddSub==1  && pDefer->GetPVPValue()>0 && pAtker->GetPVPValue()<20 && pAtker!=pDefer)
	{
		if(pRegion->GetStrongPointFlag()==false) // 未开启据点战标志
		{
			//对已有恶名值的角色使用增益技能&& !IsSameCamp(pAtker,pDefer)
			long lNum = pAtker->GetPVPValue() + GlobalSetup::GetSetup()->dwPkCountPerAttack;
			if (lNum>20)
			{
				lNum = 20;
			}
			pAtker->SetAttribute("PVPValue",lNum);	
			pAtker->UpdateAttribute();
		}
	}



}