本文整理汇总了C++中Obj_Character::GetAttackMagic方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj_Character::GetAttackMagic方法的具体用法?C++ Obj_Character::GetAttackMagic怎么用?C++ Obj_Character::GetAttackMagic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj_Character
的用法示例。
在下文中一共展示了Obj_Character::GetAttackMagic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2:
BOOL ExplosionTrap02_T::EffectOnChar(Obj_Special& rThis, Obj_Character& rTar) const
{
SpecialObjData_T const* pData = rThis.GetDataRecord();
if(NULL==pData)
{
AssertEx(FALSE,"[ExplosionTrap02_T::EffectOnChar]: Can't find Data record.");
return FALSE;
}
SpecialObjData_T::Descriptor_T const* pDescriptor0 = pData->GetDescriptorByIndex(0);
INT nDamagePhysics = 0;
if(NULL != pDescriptor0)
{
nDamagePhysics = pDescriptor0->GetValue();
}
SpecialObjData_T::Descriptor_T const* pDescriptor1 = pData->GetDescriptorByIndex(1);
INT nDamageMagic = 0;
if(NULL != pDescriptor1)
{
nDamageMagic = pDescriptor1->GetValue();
}
SpecialObjData_T::Descriptor_T const* pDescriptor2 = pData->GetDescriptorByIndex(2);
INT nDamageCold = 0;
if(NULL != pDescriptor2)
{
nDamageCold = pDescriptor2->GetValue();
}
SpecialObjData_T::Descriptor_T const* pDescriptor3 = pData->GetDescriptorByIndex(3);
INT nDamageFire = 0;
if(NULL != pDescriptor3)
{
nDamageFire = pDescriptor3->GetValue();
}
SpecialObjData_T::Descriptor_T const* pDescriptor4 = pData->GetDescriptorByIndex(4);
INT nDamageLight = 0;
if(NULL != pDescriptor4)
{
nDamageLight = pDescriptor4->GetValue();
}
SpecialObjData_T::Descriptor_T const* pDescriptor5 = pData->GetDescriptorByIndex(5);
INT nDamagePoison = 0;
if(NULL != pDescriptor5)
{
nDamageLight = pDescriptor5->GetValue();
}
INT nBodyEnchaneImpactID = pData->GetDescriptorByIndex(6)->GetValue();
INT nBodyEnchanceContinuance = pData->GetDescriptorByIndex(7)->GetValue();
INT nActiveOdds = pData->GetDescriptorByIndex(8)->GetValue();
INT nAttackRefixRate = pData->GetDescriptorByIndex(9)->GetValue();
INT nDefenceRefixRate = pData->GetDescriptorByIndex(10)->GetValue();
OWN_IMPACT impact1;
DI_Damages_T impLogic1;
impLogic1.InitStruct(impact1);
impact1.m_nCasterID = rThis.GetOwnerID();
impact1.m_nSkillID = Skill_Module::MELEE_ATTACK;
impLogic1.SetDamagePhy(impact1, nDamagePhysics);
impLogic1.SetDamageMagic(impact1, nDamageMagic);
impLogic1.SetDamageCold(impact1, nDamageCold);
impLogic1.SetDamageFire(impact1, nDamageFire);
impLogic1.SetDamageLight(impact1, nDamageLight);
impLogic1.SetDamagePoison(impact1, nDamagePoison);
Scene* pScene = rThis.getScene();
if(NULL!=pScene)
{
pScene->GetEventCore().RegisterBeSkillEvent(rTar.GetID(), rThis.GetOwnerID(), BEHAVIOR_TYPE_HOSTILITY, 500);
pScene->GetEventCore().RegisterImpactEvent(rTar.GetID(), rThis.GetOwnerID(), impact1, 500);
INT nRand = pScene->GetRand100();
if(nActiveOdds>nRand)
{
OWN_IMPACT impact2;
SOT_BodyEnhance_T impLogic2;
impLogic2.InitStruct(impact2);
impact2.m_nCasterID = rThis.GetOwnerID();
impact2.m_nSkillID = Skill_Module::MELEE_ATTACK;
impact2.m_nImpactID = nBodyEnchaneImpactID;
impLogic2.SetContinuance(impact2, nBodyEnchanceContinuance);
INT nAttackRefix=0;
INT nDefenceRefix=0;
//Calculate Physics attack refix
nAttackRefix = Float2Int((rTar.GetAttackPhysics() * nAttackRefixRate + 50) / 100);
impLogic2.SetAttackPhysicsRefix(impact2, nAttackRefix);
//Calculate Magic attack refix
nAttackRefix = Float2Int((rTar.GetAttackMagic() * nAttackRefixRate + 50) / 100);
impLogic2.SetAttackMagicRefix(impact2, nAttackRefix);
//Calculate Physics Defence refix
nDefenceRefix = Float2Int((rTar.GetDefencePhysics() * nDefenceRefixRate + 50) / 100);
impLogic2.SetDefencePhysicsRefix(impact2, nDefenceRefix);
//Calculate Magic Defence refix
nDefenceRefix = Float2Int((rTar.GetDefenceMagic() * nDefenceRefixRate + 50) / 100);
impLogic2.SetDefencePhysicsRefix(impact2, nDefenceRefix);
//don't refix Max_Health
impLogic2.SetMaxHealthRefix(impact2, 0);
pScene->GetEventCore().RegisterImpactEvent(rTar.GetID(), rThis.GetOwnerID(), impact2, 500);
}
}
return FALSE;
}