本文整理汇总了C++中CvPromotionEntry::GetTerrainDefensePercent方法的典型用法代码示例。如果您正苦于以下问题:C++ CvPromotionEntry::GetTerrainDefensePercent方法的具体用法?C++ CvPromotionEntry::GetTerrainDefensePercent怎么用?C++ CvPromotionEntry::GetTerrainDefensePercent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvPromotionEntry
的用法示例。
在下文中一共展示了CvPromotionEntry::GetTerrainDefensePercent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoUpdatePower
//.........这里部分代码省略.........
if(kPromotion->IsBlitz())
{
iTemp = iPower;
iTemp /= 5;
iPower += iTemp;
}
// Set Up For Ranged Attack - reduce by 20%
if(kPromotion->IsMustSetUpToRangedAttack())
{
iTemp = iPower;
iTemp /= 5;
iPower -= iTemp;
}
// Only Defensive - reduce by 25%, but only if the Unit has no ranged capability
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;