本文整理汇总了C++中CItemCtx::GetMods方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemCtx::GetMods方法的具体用法?C++ CItemCtx::GetMods怎么用?C++ CItemCtx::GetMods使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemCtx
的用法示例。
在下文中一共展示了CItemCtx::GetMods方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMaxHP
int CArmorClass::GetMaxHP (CItemCtx &ItemCtx)
// GetMaxHP
//
// Returns the max HP for this kind of armor
{
// Start with hit points defined by the class
int iHP = m_iHitPoints;
// Fire event to compute HP, if necessary
iHP = FireGetMaxHP(ItemCtx, iHP);
// Add mods
const CItemEnhancement &Mods = ItemCtx.GetMods();
if (Mods.IsNotEmpty())
iHP = iHP * Mods.GetHPAdj() / 100;
// Add complete bonus
CInstalledArmor *pSect = ItemCtx.GetArmor();
if (pSect && pSect->IsComplete())
iHP += m_iArmorCompleteBonus;
// Done
return iHP;
}
示例2: GetReference
CString CShieldClass::GetReference (CItemCtx &Ctx, int iVariant, DWORD dwFlags)
// GetReference
//
// Returns a string that describes the basic attributes
// of this shield
//
// Example:
//
// 20 hp (average regen); 100MW
{
int i;
CString sReference;
CString sRegeneration;
const CItemEnhancement &Mods = Ctx.GetMods();
// Compute the strength string
int iMin, iMax;
CalcMinMaxHP(Ctx, m_iMaxCharges, 0, 0, &iMin, &iMax);
// Compute the regeneration
if (m_iRegenHP > 0)
{
int iRate = (int)((10.0 * g_TicksPerSecond * m_iRegenHP / m_iRegenRate) + 0.5);
if (iRate == 0)
sRegeneration = CONSTLIT("<0.1 hp/sec");
else if ((iRate % 10) == 0)
sRegeneration = strPatternSubst(CONSTLIT("%d hp/sec"), iRate / 10);
else
sRegeneration = strPatternSubst(CONSTLIT("%d.%d hp/sec"), iRate / 10, iRate % 10);
}
else
sRegeneration = CONSTLIT("none");
sReference = strPatternSubst("%s — regen @ %s",
GetReferencePower(Ctx),
sRegeneration);
// Reflection
for (i = 0; i < damageCount; i++)
{
if (m_Reflective.InSet((DamageTypes)i)
|| (Mods.IsReflective() && Mods.GetDamageType() == i))
sReference.Append(strPatternSubst(CONSTLIT(" — %s-reflecting"), GetDamageShortName((DamageTypes)i)));
}
return sReference;
}
示例3: IsReflective
bool CArmorClass::IsReflective (CItemCtx &ItemCtx, const DamageDesc &Damage)
// IsReflective
//
// Returns TRUE if the armor reflects this damage
{
const CItemEnhancement &Mods = ItemCtx.GetMods();
int iReflectChance = 0;
// Base armor chance
if (m_Reflective.InSet(Damage.GetDamageType()))
iReflectChance = MAX_REFLECTION_CHANCE;
// Mods
int iModReflect;
if (Mods.IsNotEmpty() && Mods.IsReflective(Damage, &iModReflect))
iReflectChance = Max(iReflectChance, iModReflect);
// Done
if (iReflectChance)
{
CInstalledArmor *pSect = ItemCtx.GetArmor();
int iMaxHP = GetMaxHP(ItemCtx);
int iHP = (pSect ? pSect->GetHitPoints() : iMaxHP);
// Adjust based on how damaged the armor is
iReflectChance = (iMaxHP > 0 ? iHP * iReflectChance / iMaxHP : iReflectChance);
return (mathRandom(1, 100) <= iReflectChance);
}
else
return false;
}
示例4: GetReference
CString CArmorClass::GetReference (CItemCtx &Ctx, int iVariant)
// GetReference
//
// Returns a string that describes the basic attributes
// of this armor.
//
// Example:
//
// 30 hp; laser-resistant; impact-resistant
{
int i;
CString sReference;
// Get modifications
int iLevel = m_pItemType->GetLevel();
const CItemEnhancement &Mods = Ctx.GetMods();
// Radiation
if (m_fRadiationImmune || Mods.IsRadiationImmune())
{
if (iLevel < RADIATION_IMMUNE_LEVEL)
AppendReferenceString(&sReference, CONSTLIT("radiation-immune"));
}
else if (iLevel >= RADIATION_IMMUNE_LEVEL)
AppendReferenceString(&sReference, CONSTLIT("radiation-vulnerable"));
// If we're immune to blinding/EMP/device damage, then collapse
// it all under a single entry
bool bCheckedBlind = false;
bool bCheckedEMP = false;
bool bCheckedDevice = false;
if ((m_iBlindingDamageAdj == 0 || Mods.IsBlindingImmune())
&& (m_iEMPDamageAdj == 0 || Mods.IsEMPImmune())
&& (m_iDeviceDamageAdj < 100 || Mods.IsDeviceDamageImmune()))
{
if (iLevel < DEVICE_DAMAGE_IMMUNE_LEVEL)
AppendReferenceString(&sReference, CONSTLIT("ion effect-immune"));
bCheckedBlind = true;
bCheckedEMP = true;
bCheckedDevice = true;
}
// Collapse blind and EMP resistance
else if ((m_iBlindingDamageAdj == 0 || Mods.IsBlindingImmune())
&& (m_iEMPDamageAdj == 0 || Mods.IsEMPImmune()))
{
if (iLevel < EMP_IMMUNE_LEVEL)
AppendReferenceString(&sReference, CONSTLIT("blind-, EMP-immune"));
bCheckedBlind = true;
bCheckedEMP = true;
}
else if ((m_iBlindingDamageAdj < 100) && (iLevel < BLIND_IMMUNE_LEVEL)
&& (m_iEMPDamageAdj < 100))
{
AppendReferenceString(&sReference, CONSTLIT("blind-, EMP-resistant"));
bCheckedBlind = true;
bCheckedEMP = true;
}
// Otherwise, treat each separate
//
// Blindness
if (!bCheckedBlind)
{
if (m_iBlindingDamageAdj == 0 || Mods.IsBlindingImmune())
{
if (iLevel < BLIND_IMMUNE_LEVEL)
AppendReferenceString(&sReference, CONSTLIT("blind-immune"));
}
else if (m_iBlindingDamageAdj < 100)
{
if (iLevel < BLIND_IMMUNE_LEVEL)
AppendReferenceString(&sReference, CONSTLIT("blind-resistant"));
else
AppendReferenceString(&sReference, CONSTLIT("blind-vulnerable"));
}
else if (iLevel >= BLIND_IMMUNE_LEVEL)
AppendReferenceString(&sReference, CONSTLIT("blind-vulnerable"));
}
// EMP
if (!bCheckedEMP)
{
if (m_iEMPDamageAdj == 0 || Mods.IsEMPImmune())
{
if (iLevel < EMP_IMMUNE_LEVEL)
AppendReferenceString(&sReference, CONSTLIT("EMP-immune"));
}
//.........这里部分代码省略.........