本文整理汇总了C++中CGameItemPtr::getProtection方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameItemPtr::getProtection方法的具体用法?C++ CGameItemPtr::getProtection怎么用?C++ CGameItemPtr::getProtection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameItemPtr
的用法示例。
在下文中一共展示了CGameItemPtr::getProtection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getShield
//--------------------------------------------------------------
// CCombatDefenderPlayer::getShield
//--------------------------------------------------------------
bool CCombatDefenderPlayer::getShield(CCombatShield &shield) const
{
CCharacter *character = PlayerManager.getChar(_RowId);
if ( !character)
{
return false;
}
CGameItemPtr shieldPtr = character->getLeftHandItem();
if (shieldPtr == NULL || shieldPtr->getStaticForm() == NULL || shieldPtr->getStaticForm()->Family != ITEMFAMILY::SHIELD )
return false;
shield.Quality = shieldPtr->quality();
shield.Skill = shieldPtr->getStaticForm()->Skill;
if ( shield.Skill < SKILLS::NUM_SKILLS )
{
shield.SkillValue = character->getSkills()._Skills[ shield.Skill ].Current;
}
else
shield.SkillValue = 0;
shield.MaxBluntProtection = shieldPtr->getProtection(DMGTYPE::BLUNT).Max;
shield.MaxPiercingProtection = shieldPtr->getProtection(DMGTYPE::PIERCING).Max;
shield.MaxSlashingProtection = shieldPtr->getProtection(DMGTYPE::SLASHING).Max;
shield.BluntProtectionFactor = shieldPtr->getProtection(DMGTYPE::BLUNT).Factor;
shield.PiercingProtectionFactor = shieldPtr->getProtection(DMGTYPE::PIERCING).Factor;
shield.SlashingProtectionFactor = shieldPtr->getProtection(DMGTYPE::BLUNT).Factor;
shield.ShieldType = shieldPtr->getStaticForm()->Shield->ShieldType;
shield.ArmorType = shieldPtr->getStaticForm()->Shield->ArmorType;
return true;
} // CCombatDefenderPlayer::getShield //
示例2: getArmor
//--------------------------------------------------------------
// CCombatDefenderPlayer::getArmor
//--------------------------------------------------------------
bool CCombatDefenderPlayer::getArmor( SLOT_EQUIPMENT::TSlotEquipment slot, CCombatArmor &armor ) const
{
CCharacter *character = PlayerManager.getChar(_RowId);
if ( !character)
{
return false;
}
CGameItemPtr armorPtr = character->getItem(INVENTORIES::equipment, slot);
if (armorPtr == NULL || armorPtr->getStaticForm() == NULL || armorPtr->getStaticForm()->Family != ITEMFAMILY::ARMOR)
return false;
armor.Quality = armorPtr->quality();
armor.Skill = armorPtr->getStaticForm()->Skill;
if( armor.Skill < 0 ) { nlwarning("<CCombatDefenderPlayer::getArmor> armor.Skill negative !!!!"); armor.SkillValue = 0; }
else
if ( armor.Skill < SKILLS::NUM_SKILLS )
{
armor.SkillValue = character->getSkills()._Skills[ armor.Skill ].Current;
}
else
armor.SkillValue = 0;
armor.MaxBluntProtection = armorPtr->getProtection(DMGTYPE::BLUNT).Max;
armor.MaxPiercingProtection = armorPtr->getProtection(DMGTYPE::PIERCING).Max;
armor.MaxSlashingProtection = armorPtr->getProtection(DMGTYPE::SLASHING).Max;
armor.BluntProtectionFactor = armorPtr->getProtection(DMGTYPE::BLUNT).Factor;
armor.PiercingProtectionFactor = armorPtr->getProtection(DMGTYPE::PIERCING).Factor;
armor.SlashingProtectionFactor = armorPtr->getProtection(DMGTYPE::BLUNT).Factor;
armor.ArmorType = armorPtr->getStaticForm()->Armor->ArmorType;
return true;
} // CCombatDefenderPlayer::getArmor //