本文整理汇总了C++中CvPromotionEntry::GetDomainModifierPercent方法的典型用法代码示例。如果您正苦于以下问题:C++ CvPromotionEntry::GetDomainModifierPercent方法的具体用法?C++ CvPromotionEntry::GetDomainModifierPercent怎么用?C++ CvPromotionEntry::GetDomainModifierPercent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvPromotionEntry
的用法示例。
在下文中一共展示了CvPromotionEntry::GetDomainModifierPercent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoUpdatePower
//.........这里部分代码省略.........
if(kPromotion->IsOnlyDefensive() && GetRangedCombat() == 0)
{
iTemp = iPower;
iTemp /= 4;
iPower -= iTemp;
}
for(iLoop = 0; iLoop < GC.getNumTerrainInfos(); iLoop++)
{
// Terrain Attack - add one quarter of the bonus
if(kPromotion->GetTerrainAttackPercent(iLoop) > 0)
{
iTemp = (iPower * kPromotion->GetTerrainAttackPercent(iLoop) / 4);
iTemp /= 100;
iPower += iTemp;
}
// Terrain Defense - add one quarter of the bonus
if(kPromotion->GetTerrainDefensePercent(iLoop) > 0)
{
iTemp = (iPower * kPromotion->GetTerrainDefensePercent(iLoop) / 4);
iTemp /= 100;
iPower += iTemp;
}
}
for(iLoop = 0; iLoop < GC.getNumFeatureInfos(); iLoop++)
{
// Feature Attack - add one quarter of the bonus
if(kPromotion->GetFeatureAttackPercent(iLoop) > 0)
{
iTemp = (iPower * kPromotion->GetFeatureAttackPercent(iLoop) / 4);
iTemp /= 100;
iPower += iTemp;
}
// Feature Defense - add one quarter of the bonus
if(kPromotion->GetFeatureDefensePercent(iLoop) > 0)
{
iTemp = (iPower * kPromotion->GetFeatureDefensePercent(iLoop) / 4);
iTemp /= 100;
iPower += iTemp;
}
}
for(iLoop = 0; iLoop < GC.getNumUnitCombatClassInfos(); iLoop++)
{
// Unit Combat Class (e.g. Pikemen) - add one quarter of the bonus
if(kPromotion->GetUnitCombatModifierPercent(iLoop) > 0)
{
iTemp = (iPower * kPromotion->GetUnitCombatModifierPercent(iLoop) / 4);
iTemp /= 100;
iPower += iTemp;
}
}
for(iLoop = 0; iLoop < GC.getNumUnitClassInfos(); iLoop++)
{
// Unit Class (e.g. bonus ONLY against Galleys) - add one eighth of the bonus
// We're assuming here that the bonus against the other Unit is at least going to be somewhat useful - trust the XML! :o
if(kPromotion->GetUnitClassModifierPercent(iLoop) > 0)
{
iTemp = (iPower * kPromotion->GetUnitClassModifierPercent(iLoop) / 8);
iTemp /= 100;
iPower += iTemp;
}
// Unit Class Attack - one tenth of the bonus
if(kPromotion->GetUnitClassAttackModifier(iLoop) > 0)
{
iTemp = (iPower * kPromotion->GetUnitClassAttackModifier(iLoop) / 10);
iTemp /= 100;
iPower += iTemp;
}
// Unit Class Defense - one tenth of the bonus
if(kPromotion->GetUnitClassDefenseModifier(iLoop) > 0)
{
iTemp = (iPower * kPromotion->GetUnitClassDefenseModifier(iLoop) / 10);
iTemp /= 100;
iPower += iTemp;
}
}
for(iLoop = 0; iLoop < NUM_DOMAIN_TYPES; iLoop++)
{
// Domain - add one quarter of the bonus
if(kPromotion->GetDomainModifierPercent(iLoop) > 0)
{
iTemp = (iPower * kPromotion->GetDomainModifierPercent(iLoop) / 4);
iTemp /= 100;
iPower += iTemp;
}
}
}
}
// Debug output
//char temp[256];
//sprintf(temp, "%s: %i\n", GetDescription(), iPower);
//OutputDebugString(temp);
m_iCachedPower = iPower;
}