本文整理汇总了C++中CItemType::GetArmorClass方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemType::GetArmorClass方法的具体用法?C++ CItemType::GetArmorClass怎么用?C++ CItemType::GetArmorClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemType
的用法示例。
在下文中一共展示了CItemType::GetArmorClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CArmorClass *CItemCtx::GetArmorClass(void)
// GetArmorClass
//
// Returns the armor class
{
// Get it from the installed device
if (m_pArmor)
return m_pArmor->GetClass();
// Otherwise, get it from the item
if (m_pItem)
{
CItemType *pType = m_pItem->GetType();
if (pType)
return pType->GetArmorClass();
}
// Couldn't get it
return NULL;
}
示例2: GenerateArmorTable
void GenerateArmorTable (CUniverse &Universe, CXMLElement *pCmdLine)
{
int i;
printf("ARMOR TABLE\n\n");
printf("Level\tArmor\tCost\tWeight\tHP\tLasr\tImpc\tPart\tBlst\tIon\tThrm\tPosi\tPlsm\tAnti\tNano\tGrav\tSing\tDacd\tDstl\tDlgt\tDfir\n");
for (i = 0; i < Universe.GetItemTypeCount(); i++)
{
CItemType *pItem = Universe.GetItemType(i);
CArmorClass *pArmor = pItem->GetArmorClass();
if (pArmor == NULL)
continue;
CItem Item(pItem, 1);
CString sName = pItem->GetName(NULL);
int iHP = pArmor->GetMaxHP(CItemCtx(&Item));
printf("%d\t%s\t%d\t%d\t%d\t",
pItem->GetLevel(),
sName.GetASCIIZPointer(),
Item.GetValue(true),
Item.GetMassKg(),
iHP);
// For each damage type, compute the adjusted hit points of the armor
int iDamage;
for (iDamage = damageLaser; iDamage < damageCount; iDamage++)
{
printf("%d", pArmor->GetDamageAdj(CItemCtx(Item), (DamageTypes)iDamage));
if (iDamage != damageCount - 1)
printf("\t");
}
printf("\n");
}
printf("ARMOR TABLE DAMAGE ADJUSTMENTS\n\n");
printf("Level\tArmor\tHP\tLasr\tImpc\tPart\tBlst\tIon\tThrm\tPosi\tPlsm\tAnti\tNano\tGrav\tSing\tDacd\tDstl\tDlgt\tDfir\n");
for (i = 0; i < Universe.GetItemTypeCount(); i++)
{
CItemType *pItem = Universe.GetItemType(i);
CArmorClass *pArmor = pItem->GetArmorClass();
if (pArmor == NULL)
continue;
CString sName = pItem->GetName(NULL);
CItem Item(pItem, 1);
int iHP = pArmor->GetMaxHP(CItemCtx(&Item));
printf("%d\t%s\t%d\t",
pItem->GetLevel(),
sName.GetASCIIZPointer(),
iHP);
// For each damage type, compute the adjusted hit points of the armor
int iDamage;
for (iDamage = damageLaser; iDamage < damageCount; iDamage++)
{
int iAdj = pArmor->GetDamageAdj(CItemCtx(Item), (DamageTypes)iDamage);
if (iAdj == 0)
printf("----");
else
printf("%d", iHP * 100 / iAdj);
if (iDamage != damageCount - 1)
printf("\t");
}
printf("\n");
}
}