本文整理汇总了C++中CvPromotionEntry::GetAttackMod方法的典型用法代码示例。如果您正苦于以下问题:C++ CvPromotionEntry::GetAttackMod方法的具体用法?C++ CvPromotionEntry::GetAttackMod怎么用?C++ CvPromotionEntry::GetAttackMod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvPromotionEntry
的用法示例。
在下文中一共展示了CvPromotionEntry::GetAttackMod方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoUpdatePower
/// Update military Power
void CvUnitEntry::DoUpdatePower()
{
int iPower;
// ***************
// Main Factors - Strength & Moves
// ***************
// We want a Unit that has twice the strength to be roughly worth 3x as much with regards to Power
iPower = int(pow((double) GetCombat(), 1.5));
// Ranged Strength
int iRangedStrength = int(pow((double) GetRangedCombat(), 1.45));
// Naval ranged attacks are less useful
if(GetDomainType() == DOMAIN_SEA)
{
iRangedStrength /= 2;
}
if(iRangedStrength > 0)
{
iPower = iRangedStrength;
}
// We want Movement rate to be important, but not a dominating factor; a Unit with double the moves of a similarly-strengthed Unit should be ~1.5x as Powerful
iPower = int((float) iPower * pow((double) GetMoves(), 0.3));
// ***************
// Other modifiers
// ***************
// Suicide Units are obviously less useful
if(IsSuicide())
{
iPower /= 2;
}
// Nukes are cool
if(GetNukeDamageLevel() > 0)
{
iPower += 4000;
}
// ***************
// Promotion modifiers
// ***************
int iTemp;
int iLoop;
for(int iPromotionLoop = 0; iPromotionLoop < GC.getNumPromotionInfos(); iPromotionLoop++)
{
CvPromotionEntry* kPromotion = GC.getPromotionInfo((PromotionTypes)iPromotionLoop);
if(kPromotion == NULL)
continue;
if(GetFreePromotions(iPromotionLoop))
{
// City Attack - add half of the bonus
if(kPromotion->GetCityAttackPercent() > 0)
{
iTemp = (iPower * kPromotion->GetCityAttackPercent() / 2);
iTemp /= 100;
iPower += iTemp;
}
// Attack - add half of the bonus
if(kPromotion->GetAttackMod() > 0)
{
iTemp = (iPower * kPromotion->GetAttackMod() / 2);
iTemp /= 100;
iPower += iTemp;
}
// Defense - add half of the bonus
if(kPromotion->GetDefenseMod() > 0)
{
iTemp = (iPower * kPromotion->GetDefenseMod() / 2);
iTemp /= 100;
iPower += iTemp;
}
// Paradrop - add 25%
if(kPromotion->GetDropRange() > 0)
{
iTemp = iPower;
iTemp /= 4;
iPower += iTemp;
}
// Blitz - add 20%
if(kPromotion->IsBlitz())
{
iTemp = iPower;
iTemp /= 5;
iPower += iTemp;
}
//.........这里部分代码省略.........