//##报告凶手 void CPKSys::ReportMurderer(CPlayer* pMurderer,CPlayer* pBMurderer) { long lNum=0; if( pMurderer && pBMurderer ) { if( IsSameCamp(pMurderer,pBMurderer)) { if (pBMurderer->GetPkValue()==0) { lNum = pMurderer -> GetPkValue() + GlobalSetup::GetSetup()->dwPkCountPerKill; if (lNum > 65535) lNum = 65535; pMurderer->SetPkValue(lNum); } else if(pBMurderer->GetPkValue()>0 && pBMurderer->GetPkValue()<=20 && pMurderer->GetPkValue()<20) { lNum = pMurderer -> GetPkValue() + GlobalSetup::GetSetup()->dwPkCountPerAttack; if (lNum>20) { lNum = 20; } pMurderer->SetPkValue(lNum); } } else { if (pBMurderer->GetPkValue()<=20 && pBMurderer->GetPVPValue()==0) { CServerRegion* pRgn = dynamic_cast<CServerRegion*>(pBMurderer->GetFather()); if(pRgn && pRgn->GetStrongPointFlag()==false) // 未开启据点战标志 { lNum = pMurderer->GetPVPValue() + GlobalSetup::GetSetup()->dwPkCountPerKill; pMurderer->SetAttribute("PVPValue",lNum); pMurderer->UpdateAttribute(); } } } pMurderer -> OnUpdateMurdererSign(); } }
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(); } } }