本文整理汇总了C++中Obj_Character::GetObjType方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj_Character::GetObjType方法的具体用法?C++ Obj_Character::GetObjType怎么用?C++ Obj_Character::GetObjType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj_Character
的用法示例。
在下文中一共展示了Obj_Character::GetObjType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
uint CGAskDetailXinFaListHandler::Execute( CGAskDetailXinFaList* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
Assert( pGamePlayer ) ;
Obj_Human* pHuman = pGamePlayer->GetHuman() ;
Assert( pHuman ) ;
Scene* pScene = pHuman->getScene() ;
if( pScene==NULL )
{
Assert(FALSE) ;
return PACKET_EXE_ERROR ;
}
//检查线程执行资源是否正确
Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;
ObjID_t ObjID = pHuman->GetID();
if( ObjID == INVALID_ID )
{
Assert(FALSE) ;
return PACKET_EXE_ERROR ;
}
Obj_Character *pTarget = (Obj_Character*)(pScene->GetObjManager()->GetObj(pPacket->getTargetID()));
if( pTarget==NULL )
{
Assert( pTarget ) ;
return PACKET_EXE_ERROR ;
}
// 权限判断
// to be continue...
if ( pTarget->GetObjType() != Obj::OBJ_TYPE_HUMAN
&& pTarget->GetObjType() != Obj::OBJ_TYPE_PET )
{
g_pLog->FastSaveLog( LOG_FILE_1, "CGAskDetailXinFaListHandler: faile obj=%d scene=%d",
ObjID, pScene->SceneID() ) ;
return PACKET_EXE_CONTINUE;
}
GCDetailXinFaList Msg;
Msg.setObjID( pTarget->GetID() );
Msg.setXinFaList(pHuman->Skill_GetXinFaList().m_Count, pHuman->Skill_GetXinFaList().m_aXinFa);
pGamePlayer->SendPacket( &Msg ) ;
g_pLog->FastSaveLog( LOG_FILE_1, "CGAskDetailXinFaListHandler: ok obj=%d scene=%d",
ObjID, pScene->SceneID() ) ;
return PACKET_EXE_CONTINUE ;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
}
示例2:
BOOL CommonSkill001_T::EffectOnUnitOnce(Obj_Character& rMe, Obj_Character& rTar, BOOL bCriticalFlag) const
{
__ENTER_FUNCTION
SkillInfo_T& rSkillInfo = rMe.GetSkillInfo();
TargetingAndDepletingParams_T& rParams = rMe.GetTargetingAndDepletingParams();
if(FALSE==rTar.IsAlive() || FALSE == rTar.IsActiveObj() || Obj::OBJ_TYPE_HORSE != rTar.GetObjType())
{
rParams.SetErrCode(OR_INVALID_TARGET);
return FALSE;
}
if(Obj::OBJ_TYPE_HUMAN != rMe.GetObjType())
{
rParams.SetErrCode(OR_U_CANNT_DO_THIS_RIGHT_NOW);
return FALSE;
}
{// Test code
INT nDataIndex = Skill_GetSkillInfoDescriptorValueByIndex(rSkillInfo, 0);
g_ImpactCore.SendImpactToUnit(rTar, nDataIndex, rMe.GetID(), 500);
}
PET_LOG_PARAM PetLogParam;
BOOL bRet = ((Obj_Human*)&rMe)->CaptureHorse(&PetLogParam,rTar.GetID());
GCManipulatePetRet msg;
if(bRet)
{
msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_CAPTURESUCC);
((Obj_Human*)&rMe)->GetPlayer()->SendPacket(&msg);
// 向正在捕获的其它玩家发送失败消息
((Obj_Horse&)rTar).SendCaptureFailedToOthers(rMe.GetID());
// 清空宠物身上所有的玩家数
((Obj_Horse&)rTar).DelCapturer(rMe.GetID());
HorseManager* pHorseMgr = rMe.getScene()->GetHorseManager();
if (pHorseMgr)
{
pHorseMgr->RemoveHorse(rTar.GetID());
}
PetLogParam.OPType = PET_OP_CATCH;
SavePetLog(&PetLogParam);
}
else
{
// 减少该宠物身上的捕获玩家数
((Obj_Horse&)rTar).DelCapturer(rMe.GetID());
msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_CAPTUREFALID);
((Obj_Human*)&rMe)->GetPlayer()->SendPacket(&msg);
}
return TRUE;
__LEAVE_FUNCTION
return FALSE;
}
示例3: MagicalDamage
INT CombatCore_T::MagicalDamage(Obj_Character& rMe, Obj_Character& rTar, INT nAdditionAttack, INT nAdditionDefence)
{
__ENTER_FUNCTION
INT nDamage;
INT nAttack = Attr_VerifyGeneralAttack(rMe.GetAttackMagic()+nAdditionAttack);
INT nDefence = Attr_VerifyDefence(rTar.GetDefenceMagic()+nAdditionDefence);
INT nIgnoreRate = 0;
// calculate damage
if(Obj::OBJ_TYPE_HUMAN==rTar.GetObjType())
{
nIgnoreRate= rTar.ItemValue(IATTRIBUTE_IMMUNITY_P).m_Value;
}
if(0==nAttack+nDefence)
{
//never enter here
nDamage = 0;
}
else
{
nDamage = nAttack*nAttack/(nAttack+nDefence);
}
0>nIgnoreRate?nIgnoreRate=0:NULL;
100<nIgnoreRate?nIgnoreRate=100:NULL;
nDamage = nDamage - Float2Int((nDamage*nIgnoreRate)/100.0f);
0>nDamage?nDamage=0:NULL;
return nDamage;
__LEAVE_FUNCTION
return 0;
}
示例4: CalculateHitRate
INT CombatCore_T::CalculateHitRate(Obj_Character& rAttacker, Obj_Character& rTag)
{
__ENTER_FUNCTION
INT nHit = rAttacker.GetHit();
INT nMiss = rTag.GetMiss();
nHit = Attr_VerifyHitMiss(nHit);
nMiss = Attr_VerifyHitMiss(nMiss);
//INT iItemPointRefix = 0;
//INT iSkillPointRefix = 0;
//if( rAttacker.GetObjType() == Obj::OBJ_TYPE_HUMAN )
//{
// //装备对属性的点数影响
// iItemPointRefix = static_cast<Obj_Human&>(rAttacker).GetIattributeHit();
//}
//iSkillPointRefix = rAttacker.GetHitRefix();
//INT iItemPointRefixMiss = 0;
//INT iSkillPointRefixMiss = 0;
//if( rTag.GetObjType() == Obj::OBJ_TYPE_HUMAN )
//{
// //装备对属性的点数影响
// iItemPointRefixMiss = static_cast<Obj_Human&>(rTag).GetIattributeMiss();
//}
//iSkillPointRefixMiss = rTag.GetMissRefix();
INT iRateHit = 0;
if (Obj::OBJ_TYPE_HUMAN==rAttacker.GetObjType())
{
Obj_Human& rHuman = (Obj_Human&)rAttacker;
_ITEM_EFFECT* pIE=NULL;
pIE = rHuman.ItemEffect(IATTRIBUTE_RATE_HIT);
Assert( pIE );
if( pIE->IsActive() )
{
iRateHit = pIE->m_Attr.m_Value;
}
}
//总命中率=(75+攻击方总命中-受击方总闪避)/100+攻击方装备对命中率的影响+攻击方技能对命中率的影响-受击方装备对闪避率的影响-受击方技能对闪避率的影响
SkillInfo_T& oSkillInf = rAttacker.GetSkillInfo();
INT iRefix = oSkillInf.GetAccuracy();
if( iRefix < 0 )
{
iRefix = 0;
}
INT iFainlHitRate = ((75 + nHit - nMiss)/100.0 + iRateHit/100.0 + iRefix/100.0) * 100.0;
return iFainlHitRate;
__LEAVE_FUNCTION
return 0;
}
示例5: SoilDamage
INT CombatCore_T::SoilDamage(Obj_Character& rMe,Obj_Character& rTar, INT nAdditionalAttack, INT nAdditionalResist)
{
INT nDamage;
INT nAttack = Attr_VerifyTraitAttack(rMe.GetAttackSoil()+nAdditionalAttack);
INT nResist = Attr_VerifyResist(rTar.GetDefenceSoil()+nAdditionalResist);
nDamage = AttrDamage(rMe, nResist, nAttack, IATTRIBUTE_SHIELD_SOIL);
INT nIgnoreRate = 0;
if(Obj::OBJ_TYPE_HUMAN==rTar.GetObjType())
{
nIgnoreRate= (INT)(rTar.ItemValue(IATTRIBUTE_RATE_SOIL_ATT_REDUCE).m_Value);
}
nDamage = nDamage*(100.0-((double)nIgnoreRate))/100.0f;
return nDamage;
}
示例6: GetAiTypeRefix
VOID StdImpact033_T::OnFadeOut(OWN_IMPACT& rImp, Obj_Character& rMe) const
{
INT nValue = 0;
if(Obj::OBJ_TYPE_MONSTER == rMe.GetObjType())
{
Obj_Monster& rMonster = (Obj_Monster&)rMe;
INT nAI_Type = GetAiTypeRefix(rImp);
rMonster.SetAIType(nAI_Type);
AI_Monster * pAI = rMonster.GetMonsterAI();
if(NULL!=pAI)
{
Obj* pObj = Impact_GetCaster(rMe, rImp);
if(NULL!=pObj)
{
pAI->AddPrimaryEnemy(pObj->GetID());
}
}
}
}
示例7: NormalDamage
INT CombatCore_T::NormalDamage( Obj_Character &rTar, INT nAttack, INT nDefence, INT iType )
{
INT nDamage;
INT nIgnoreRate = 0;
// calculate damage
if(Obj::OBJ_TYPE_HUMAN==rTar.GetObjType())
{
nIgnoreRate = rTar.ItemValue(iType).m_Value;
}
if(0==nAttack+nDefence)
{
//never enter here
nDamage = 0;
}
else
{
nDamage = nAttack - nDefence;
}
nDamage -= nIgnoreRate;
0>nDamage?nDamage=0:NULL;
return nDamage;
}
示例8: AttrDamage
INT CombatCore_T::AttrDamage( Obj_Character &rTar, INT &nResist, INT nAttack, INT iType )
{
INT nDamage;
INT nIgnoreRate = 0;
if(MAX_EFFECTIVE_RESIST<nResist)
{
nResist = MAX_EFFECTIVE_RESIST;
}
if(-MAX_EFFECTIVE_RESIST>nResist)
{
nResist = -MAX_EFFECTIVE_RESIST;
}
nDamage = Float2Int(nAttack*(100-nResist)/100);
if(Obj::OBJ_TYPE_HUMAN==rTar.GetObjType())
{
nIgnoreRate = rTar.ItemValue(iType).m_Value;
}
nDamage -= nIgnoreRate;
0>nDamage?nDamage=0:NULL;
return nDamage;
}
示例9: IsCriticalHit
BOOL CombatCore_T::IsCriticalHit(Obj_Character& rAttacker, INT nCriticalRate, INT nRand, INT iToughness)
{
__ENTER_FUNCTION
INT iSkillPointRefix = 0;
SkillInfo_T& rSkillInf = rAttacker.GetSkillInfo();
iSkillPointRefix = rSkillInf.GetCriticalRate();
if( 0 > iSkillPointRefix )
{
iSkillPointRefix = 0;
}
INT iRateCrit = 0;
if (Obj::OBJ_TYPE_HUMAN==rAttacker.GetObjType())
{
Obj_Human& rHuman = (Obj_Human&)rAttacker;
_ITEM_EFFECT* pIE=NULL;
pIE = rHuman.ItemEffect(IATTRIBUTE_RATE_CRIT);
Assert( pIE );
if( pIE->IsActive() )
{
iRateCrit = pIE->m_Attr.m_Value;
}
}
//暴击率=(5+攻击方总暴击-受击方总韧性)/100+攻击方装备对暴击率的影响+攻击方技能对暴击率的影响
INT iFanlCriticalRate = Float2Int((( 5 + nCriticalRate - iToughness )/100.0 + iRateCrit/100.0 +iSkillPointRefix/100.f) * 100.0);
iFanlCriticalRate = Attr_VerifyCritical(iFanlCriticalRate);
if( nRand < iFanlCriticalRate )
return TRUE;//会心一击
return FALSE;//普通一击
__LEAVE_FUNCTION
return FALSE;
}
示例10: Execute
uint CGExchangeOkIIIHandler::Execute( CGExchangeOkIII* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
Assert( pGamePlayer ) ;
Obj_Human* pHuman = pGamePlayer->GetHuman() ;
Assert( pHuman ) ;
Scene* pScene = pHuman->getScene() ;
if( pScene==NULL )
{
Assert(FALSE) ;
return PACKET_EXE_ERROR ;
}
//检查线程执行资源是否正确
Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;
EXCHANGE_CERTIFY_EACH_OTHER(pHuman)
ObjID_t DestID = pHuman->m_ExchangBox.m_ObjID;
Obj_Character *pTarget = (Obj_Character*)(pScene->GetObjManager()->GetObj( DestID ));
if(pTarget->GetObjType() != Obj::OBJ_TYPE_HUMAN)
{
g_pLog->FastSaveLog( LOG_FILE_1, "CGExchangeOkIIIHandler: %s ask not a human.", pHuman->GetName() ) ;
return PACKET_EXE_CONTINUE;
}
Obj_Human* pDestHuman = (Obj_Human*)pTarget;
if( pDestHuman == NULL )
{
Assert(FALSE);
return PACKET_EXE_CONTINUE;
}
// 不同阵营,不让查看
if( pHuman->IsEnemy( pDestHuman ) )
{
g_pLog->FastSaveLog( LOG_FILE_1, "CGExchangeOkIIIHandler: %s cann't ask %s's detailattr ", pHuman->GetName(), pDestHuman->GetName() ) ;
return PACKET_EXE_CONTINUE;
}
if(pHuman->m_ExchangBox.m_Status == ServerExchangeBox::EXCHANGE_WAIT_FOR_CONFIRM)
{
//设置可以交换
pHuman->m_ExchangBox.m_Status = ServerExchangeBox::EXCHANGE_CONFIRM_READY;
if(pDestHuman->m_ExchangBox.m_Status == ServerExchangeBox::EXCHANGE_CONFIRM_READY)
{//可以交换了
//1.变量初始化
ItemContainer* pMyExchangeContainer = &(pHuman->m_ExchangBox.m_Container);
ItemContainer* pOtExchangeContainer = &(pDestHuman->m_ExchangBox.m_Container);
ItemContainer* pMyExchangePetContainer = &(pHuman->m_ExchangBox.m_PetContainer);
ItemContainer* pOtExchangePetContainer = &(pDestHuman->m_ExchangBox.m_PetContainer);
_EXCHANGE_ITEM_LIST ItemListMeToOt;
_EXCHANGE_ITEM_LIST ItemListOtToMe;
ItemListMeToOt.Init();
ItemListOtToMe.Init();
//2.验证循环
g_pLog->FastSaveLog( LOG_FILE_1, "<交易> [%s] 与 [%s] 开始验证循环", pHuman->GetName(), pDestHuman->GetName()) ;
for(INT i = 0; i<EXCHANGE_BOX_SIZE; i++)
{
if(pMyExchangeContainer->GetItem(i)->IsEmpty() == FALSE)
{
ItemListMeToOt.AddItem( pMyExchangeContainer->GetItem(i) );
}
if(pOtExchangeContainer->GetItem(i)->IsEmpty() == FALSE)
{
ItemListOtToMe.AddItem( pOtExchangeContainer->GetItem(i) );
}
}
for(INT i = 0; i<EXCHANGE_PET_BOX_SIZE; i++)
{
if(pMyExchangePetContainer->GetItem(i)->IsEmpty() == FALSE)
{
ItemListMeToOt.AddItem( pMyExchangePetContainer->GetItem(i) );
}
if(pOtExchangePetContainer->GetItem(i)->IsEmpty() == FALSE)
{
ItemListOtToMe.AddItem( pOtExchangePetContainer->GetItem(i) );
}
}
if( FALSE == HumanItemLogic::CanReceiveExchangeItemList( pHuman, ItemListOtToMe) )
{//空间不够
GCExchangeError MsgSelf;
MsgSelf.SetID(EXCHANGE_MSG::ERR_NOT_ENOUGHT_ROOM_SELF);
pHuman->GetPlayer()->SendPacket(&MsgSelf);
GCExchangeError MsgOther;
MsgOther.SetID(EXCHANGE_MSG::ERR_NOT_ENOUGHT_ROOM_OTHER);
pDestHuman->GetPlayer()->SendPacket(&MsgOther);
pHuman->m_ExchangBox.CleanUp();
pDestHuman->m_ExchangBox.CleanUp();
g_pLog->FastSaveLog( LOG_FILE_1, " <交易> [%s] 空间不够", pHuman->GetName()) ;
return PACKET_EXE_CONTINUE;
//.........这里部分代码省略.........
示例11: Execute
uint CGCharAskEquipmentHandler::Execute( CGCharAskEquipment* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
Assert( pGamePlayer ) ;
Obj_Human* pHuman = pGamePlayer->GetHuman() ;
Assert( pHuman ) ;
Scene* pScene = pHuman->getScene() ;
if( pScene==NULL )
{
Assert(FALSE) ;
return PACKET_EXE_ERROR ;
}
//检查线程执行资源是否正确
Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;
ObjID_t ObjID = pPacket->getObjID();
if( ObjID == INVALID_ID )
{
Assert(FALSE) ;
return PACKET_EXE_ERROR ;
}
Obj* pObj = pScene->GetObjManager()->GetObj( ObjID ) ;
if( pObj==NULL )
{
g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskEquipmentHandler: not find obj=%d", ObjID ) ;
return PACKET_EXE_CONTINUE ;
}
if( !IsCharacterObj( pObj->GetObjType() ) )
{
g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskEquipmentHandler: not character obj=%d", ObjID ) ;
return PACKET_EXE_CONTINUE ;
}
Obj_Character* pCharacter = (Obj_Character*)pObj ;
GCCharEquipment Msg;
Msg.setObjID(pCharacter->GetID());
if ( pCharacter->GetObjType() == Obj::OBJ_TYPE_HUMAN )
{
Obj_Human* pDest = (Obj_Human*)pCharacter ;
if(pDest->GetEquipID(HEQUIP_WEAPON)> 0)
{
Msg.setWeaponID(pDest->GetEquipID(HEQUIP_WEAPON));
UINT uGemID = GetEquipmentMaxLevelGemID(pDest->GetEquipContain()->GetItem(HEQUIP_WEAPON));
Msg.setWeaponGemID(uGemID);
}
if(pDest->GetEquipID(HEQUIP_BOOT)>0)
{
Msg.setBootID(pDest->GetEquipID(HEQUIP_BOOT));
UINT uGemID = GetEquipmentMaxLevelGemID(pDest->GetEquipContain()->GetItem(HEQUIP_BOOT));
Msg.setBootGemID(uGemID);
}
if(pDest->GetEquipID(HEQUIP_CUFF)>0)
{
Msg.setCuffID(pDest->GetEquipID(HEQUIP_CUFF));
UINT uGemID = GetEquipmentMaxLevelGemID(pDest->GetEquipContain()->GetItem(HEQUIP_CUFF));
Msg.setCuffGemID(uGemID);
}
if(pDest->GetEquipID(HEQUIP_CAP)>0)
{
Msg.setCapID(pDest->GetEquipID(HEQUIP_CAP));
UINT uGemID = GetEquipmentMaxLevelGemID(pDest->GetEquipContain()->GetItem(HEQUIP_CAP));
Msg.setCapGemID(uGemID);
}
if(pDest->GetEquipID(HEQUIP_ARMOR)>0)
{
Msg.setArmourID(pDest->GetEquipID(HEQUIP_ARMOR));
UINT uGemID = GetEquipmentMaxLevelGemID(pDest->GetEquipContain()->GetItem(HEQUIP_ARMOR));
Msg.setArmourGemID(uGemID);
}
pGamePlayer->SendPacket( &Msg ) ;
}
g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskEquipmentHandler: ok obj=%d scene=%d",
ObjID, pScene->SceneID() ) ;
return PACKET_EXE_CONTINUE ;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
}
示例12: Init
BOOL Obj_Pet::Init( const _OBJ_INIT *pInit )
{
__ENTER_FUNCTION
BOOL bResult = Obj_Character::Init( pInit );
if ( !bResult )
return FALSE;
const _OBJ_PET_INIT *pPetInit = NULL;
pPetInit = (const _OBJ_PET_INIT*)pInit;
if ( pPetInit == NULL )
{
Assert( FALSE && "Error Obj_Pet::Init, pPetInit = NULL" );
return FALSE;
}
m_GUID = pPetInit->m_GUID;
m_CreatorID = pPetInit->m_CreatorID;
m_pCreator = NULL;
m_nIndex = pPetInit->m_nIndex;
m_ScriptID = pPetInit->m_ScriptID ;
if ( m_CreatorID != INVALID_ID )
{
Obj_Character *pCreator = (Obj_Character*)(getScene()->GetObjManager()->GetObj(m_CreatorID) );
if (pCreator != NULL && pCreator->GetObjType() == OBJ_TYPE_HUMAN)
m_pCreator = (Obj_Human*)pCreator;
}
if ( m_pCreator == NULL )
m_PetDB = pPetInit->m_PetDB;
m_RespawnTime = pPetInit->m_RespawnTime;
m_RespawnPos = pPetInit->m_Pos;
m_OwnerID = pPetInit->m_CreatorID;
//m_nCampType = INVALID_CAMP;
m_HappinessTimer.BeginTimer( g_Config.m_ConfigInfo.m_PetHappinessInterval, g_pTimeManager->CurrentTime() );
m_LifeTimer.BeginTimer( g_Config.m_ConfigInfo.m_PetLifeInterval, g_pTimeManager->CurrentTime() );
// 如果招呼者有效则将该宠物所有的技能缓存起来
if (m_pCreator)
{
Item* pPetItem = m_pCreator->GetPetItem(GetPetGUID());
Assert(pPetItem);
// 设置AI类型
SetAIType(pPetItem->GetAIType() );
for (INT i = 0; i < PET_MAX_SKILL_COUNT; ++i)
{
PushSkillToCache(pPetItem->GetSkill(i).m_nSkillID);
}
//if( m_pCreator->GetCampData() )
//{
// if( m_pCreator->GetCampData()->m_nCampID == CAMP_1 )
// m_nCampType = CAMP1_PET;
// else if( m_pCreator->GetCampData()->m_nCampID == CAMP_2 )
// m_nCampType = CAMP2_PET;
//}
}
else
{// 在pet初始化的时候就生成宠物的所有属性(只有没有主人的宠物第一次生成时才构造所有属性)
getScene()->GetPetManager()->MakeCapturePetAttrib(&m_PetDB);
SetDataID(m_PetDB.m_nDataID); // 可能产生了变异,模型可能会改变
}
// 使AI进入IDLE状态
GetAIObj()->ChangeState(ESTATE_IDLE);
InitBackupAttr();
//附加效果数据
Impact_InitList();
return TRUE;
__LEAVE_FUNCTION
return FALSE;
}
示例13: ActiveSkillNow
BOOL SkillCore_T::ActiveSkillNow(Obj_Character& rMe) const
{
__ENTER_FUNCTION
SkillInfo_T& rSkillInfo = rMe.GetSkillInfo();
TargetingAndDepletingParams_T& rParams = rMe.GetTargetingAndDepletingParams();
if(FALSE==rMe.IsAlive()||FALSE==rMe.IsActiveObj())
{
rParams.SetErrCode(OR_DIE);
return FALSE;
}
rSkillInfo.Init();
if(FALSE==InstanceSkill(rSkillInfo, rMe, rParams.GetActivatedSkill(), rParams.GetSkillLevel()))
{
rParams.SetErrCode(OR_INVALID_SKILL);
rParams.SetErrParam(rParams.GetActivatedSkill());
return FALSE;
}
//refix skill instance
rMe.RefixSkill(rSkillInfo);
//perform checking
INT nLogicID = rSkillInfo.GetLogicID();
SkillLogic_T const* pLogic = g_SkillLogicList.GetLogicById(nLogicID);
if(NULL==pLogic)
{
rParams.SetErrCode(OR_INVALID_SKILL);
rParams.SetErrParam(rParams.GetActivatedSkill());
return FALSE;
}
if(TRUE == pLogic->IsPassive())
{
AssertEx(FALSE,"[SkillCore_T::HeartBeat]: Found passive Skill!!!Data error!!");
rParams.SetErrCode(OR_ERROR);
return FALSE;
}
if(TRUE == pLogic->CancelSkillEffect(rMe))
{
rParams.SetErrCode(OR_OK);
return TRUE;
}
//Prefix end
if(FALSE==rMe.Skill_IsSkillCooldowned(rParams.GetActivatedSkill())&& FALSE==rParams.GetIgnoreConditionCheckFlag())
{
rParams.SetErrCode(OR_COOL_DOWNING);
return FALSE;
}
if(TRUE == rSkillInfo.GetMustUseWeaponFlag())
{
if(Obj::OBJ_TYPE_HUMAN==rMe.GetObjType())
{
Obj_Human* pHuman = (Obj_Human*)&rMe;
Item* pItem=HumanItemLogic::GetEquip(pHuman, HEQUIP_WEAPON);
if(NULL==pItem)
{
rParams.SetErrCode(OR_NEED_A_WEAPON);
return FALSE;
}
else if(TRUE==pItem->IsEmpty())
{
rParams.SetErrCode(OR_NEED_A_WEAPON);
return FALSE;
}
}
}
if(FALSE==rParams.GetIgnoreConditionCheckFlag())
{
if(FALSE == pLogic->IsConditionSatisfied(rMe))
{
return FALSE;
}
if(FALSE==pLogic->SpecificOperationOnSkillStart(rMe))
{
return FALSE;
}
}
switch (rSkillInfo.GetSkillType())
{
case SKILL_INSTANT_LAUNCHING:
pLogic->StartLaunching(rMe);
break;
case SKILL_NEED_CHARGING:
pLogic->StartCharging(rMe);
break;
case SKILL_NEED_CHANNELING:
pLogic->StartChanneling(rMe);
break;
default:
AssertEx(FALSE,"[SkillCore_T::ActiveSkillNow]: Try to active a un-active skill!");
break;
}
return TRUE;
__LEAVE_FUNCTION
return FALSE ;
}
示例14: GetResultImpact
BOOL CombatCore_T::GetResultImpact(Obj_Character& rAttacker, Obj_Character& rDefencer, OWN_IMPACT& rImp)
{
__ENTER_FUNCTION
INT nDamage = 0;
INT nMaxDamage = 0;
INT nSpecialEffectID = DAMAGE_SPECIAL_EFFECT_NEAR;
//Init
DI_DamagesByValue_T logic;
if(INVALID_ID==rImp.GetDataIndex())
{
g_ImpactCore.InitImpactFromData(IMP_DAMAGES_OF_ATTACKS, rImp, rAttacker);
}
else if(logic.ID!=Impact_GetLogicID(rImp) && DI_DamagesByRate_T::ID!=Impact_GetLogicID(rImp) )
{
g_ImpactCore.InitImpactFromData(IMP_DAMAGES_OF_ATTACKS, rImp, rAttacker);
}
m_nAdditionalAttackNear += logic.GetDamageNear(rImp);
m_nAdditionalAttackFar += logic.GetDamageFar(rImp);
m_nAdditionalAttackMagicNear+= logic.GetDamageMagicNear(rImp);
m_nAdditionalAttackMagicFar += logic.GetDamageMagicFar(rImp);
m_nAdditionalAttackGold += logic.GetDamageGold(rImp);
m_nAdditionalAttackWood += logic.GetDamageWood(rImp);
m_nAdditionalAttackWater += logic.GetDamageWater(rImp);
m_nAdditionalAttackFire += logic.GetDamageFire(rImp);
m_nAdditionalAttackSoil += logic.GetDamageSoil(rImp);
//Damage fluctuation
INT nFluctuation = g_Config.m_ConfigInfo.m_nDefaultDamageFluctuation;
MenPaiID_t nMenPai = 9;
MenPai_Module::MenPai_T const* pMenPai = NULL;
if(Obj::OBJ_TYPE_HUMAN==rAttacker.GetObjType())
{
Obj_Human& rHuman = (Obj_Human&)rAttacker;
nMenPai = rHuman.GetMenPai();
pMenPai = g_MenPaiLogicList.GetLogicById(nMenPai);
if(NULL!=pMenPai)
{
nFluctuation=pMenPai->GetAttackFluctuation();
}
}
Scene* pScene = rAttacker.getScene();
// calculate the fluctuation
INT nRand=50;
if(NULL!=pScene)
{
nRand -= pScene->GetRand100();
}
nFluctuation = Float2Int((2*nFluctuation*nRand)/100.0f);
//Calculate Damages
//Near
nDamage = NearDamage(rAttacker, rDefencer, m_nAdditionalAttackNear, m_nAdditionalDefenceNear);
// Refix damage with fluctuation
nDamage = nDamage + nDamage*nFluctuation/100;
logicDamages.SetDamageNear(rImp, nDamage);
nMaxDamage = nDamage;
nSpecialEffectID = DAMAGE_SPECIAL_EFFECT_NEAR;
//Far
nDamage = FarDamage(rAttacker, rDefencer, m_nAdditionalAttackFar, m_nAdditionalDefenceFar);
// Refix damage with fluctuation
nDamage = nDamage + nDamage*nFluctuation/100;
logicDamages.SetDamageFar(rImp, nDamage);
if(nMaxDamage<nDamage)
{
nMaxDamage = nDamage;
nSpecialEffectID = DAMAGE_SPECIAL_EFFECT_FAR;
}
//近程内功
nDamage = MagicalNearDamage(rAttacker, rDefencer, m_nAdditionalAttackMagicNear, m_nAdditionalDefenceMagicNear);
// Refix damage with fluctuation
nDamage = nDamage + nDamage*nFluctuation/100;
logicDamages.SetDamageMagicNear(rImp, nDamage);
if(nMaxDamage<nDamage)
{
nMaxDamage = nDamage;
nSpecialEffectID = DAMAGE_SPECIAL_EFFECT_MAGIC_NEAR;
}
//近程外功
nDamage = MagicalFarDamage(rAttacker, rDefencer, m_nAdditionalAttackMagicFar, m_nAdditionalDefenceMagicFar);
// Refix damage with fluctuation
nDamage = nDamage + nDamage*nFluctuation/100;
logicDamages.SetDamageMagicFar(rImp, nDamage);
if(nMaxDamage<nDamage)
{
nMaxDamage = nDamage;
nSpecialEffectID = DAMAGE_SPECIAL_EFFECT_MAGIC_FAR;
}
//Gold
nDamage = GoldDamage(rAttacker, rDefencer, m_nAdditionalAttackGold, m_nAdditionalDefenceGold);
// Refix damage with fluctuation
nDamage = nDamage + nDamage*nFluctuation/100;
logicDamages.SetDamageGold(rImp, nDamage);
if(nMaxDamage<nDamage)
{
nMaxDamage = nDamage;
//.........这里部分代码省略.........
示例15: Init
BOOL Obj_Pet::Init( const _OBJ_INIT *pInit )
{
__ENTER_FUNCTION
BOOL bResult = Obj_Character::Init( pInit );
if ( !bResult )
return FALSE;
const _OBJ_PET_INIT *pPetInit = NULL;
pPetInit = (const _OBJ_PET_INIT*)pInit;
if ( pPetInit == NULL )
{
Assert( FALSE && "Error Obj_Pet::Init, pPetInit = NULL" );
return FALSE;
}
m_GUID = pPetInit->m_GUID;
m_CreatorID = pPetInit->m_CreatorID;
m_pCreator = NULL;
m_nIndex = pPetInit->m_nIndex;
m_iLevel = pPetInit->m_PetDB.m_nLevel;
if ( m_CreatorID != INVALID_ID )
{
Obj_Character *pCreator = (Obj_Character*)(getScene()->GetObjManager()->GetObj(m_CreatorID) );
if (pCreator != NULL && pCreator->GetObjType() == OBJ_TYPE_HUMAN)
m_pCreator = (Obj_Human*)pCreator;
}
if ( m_pCreator == NULL )
{
m_PetDB = pPetInit->m_PetDB;
return FALSE;
}
m_PetDB.m_nDataID = pPetInit->m_PetDB.m_nDataID;
m_RespawnTime = pPetInit->m_RespawnTime;
m_RespawnPos = pPetInit->m_Pos;
m_OwnerID = pPetInit->m_CreatorID;
m_HappinessTimer.BeginTimer( g_Config.m_ConfigInfo.m_PetHappinessInterval, g_pTimeManager->CurrentTime() );
SetDataID( m_pCreator->GetMonsterPetDataID() );
MONSTER_EXT_ATTR *pPetAttr = g_MonsterAttrExTbl.GetExtAttr( GetDataID() );
if(pPetAttr)
{
m_iLevel = pPetAttr->m_Level;
}
else
{
m_iLevel = 0;
}
PetManager* pPetManager = getScene()->GetPetManager();
if(pPetManager)
{
m_oInit = pPetManager->GetInitData();
}
//初始化技能相关内容
InitLife();
SetHP( GetMaxHP() );
// 使AI进入IDLE状态
GetAIObj()->ChangeState(ESTATE_IDLE);
InitBackupAttr();
//附加效果数据
Impact_InitList();
return TRUE;
__LEAVE_FUNCTION
return FALSE;
}