本文整理汇总了C++中CvUnit::GetAirCombatDamage方法的典型用法代码示例。如果您正苦于以下问题:C++ CvUnit::GetAirCombatDamage方法的具体用法?C++ CvUnit::GetAirCombatDamage怎么用?C++ CvUnit::GetAirCombatDamage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvUnit
的用法示例。
在下文中一共展示了CvUnit::GetAirCombatDamage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDanger
// Get the maximum damage unit could receive at this plot in the next turn
int CvDangerPlotContents::GetDanger(PlayerTypes ePlayer)
{
if (!m_pPlot)
return 0;
// Damage from terrain - since we don't know the unit, just assume 20
int iPlotDamage = m_bFlatPlotDamage ? 20 : 0;
// Damage from units
CvPlot* pAttackerPlot = NULL;
for (DangerUnitVector::iterator it = m_apUnits.begin(); it < m_apUnits.end(); ++it)
{
CvUnit* pUnit = GET_PLAYER(it->first).getUnit(it->second);
if ( !pUnit || pUnit->isDelayedDeath() || pUnit->IsDead())
{
continue;
}
pAttackerPlot = NULL;
if (pUnit->IsCanAttackRanged())
{
if (pUnit->getDomainType() == DOMAIN_AIR)
{
iPlotDamage += pUnit->GetAirCombatDamage(NULL, NULL, false, 0, m_pPlot);
}
else
{
iPlotDamage += pUnit->GetRangeCombatDamage(NULL, NULL, false, 0, m_pPlot);
}
}
else
{
if (plotDistance(m_iX, m_iY, pUnit->getX(), pUnit->getY()) == 1)
{
pAttackerPlot = pUnit->plot();
}
//we don't know the defender strength, so assume it's equal to attacker strength!
iPlotDamage += pUnit->getCombatDamage(
pUnit->GetMaxAttackStrength(pAttackerPlot, m_pPlot, NULL),
pUnit->GetBaseCombatStrength()*100,
pUnit->getDamage(), false, false, false);
if (pUnit->isRangedSupportFire())
{
iPlotDamage += pUnit->GetRangeCombatDamage(NULL, NULL, false, 0, m_pPlot, pAttackerPlot);
}
}
}
// Damage from cities
for (DangerCityVector::iterator it = m_apCities.begin(); it < m_apCities.end(); ++it)
{
CvCity* pCity = GET_PLAYER(it->first).getCity(it->second);
if (pCity && pCity->getTeam() != GET_PLAYER(ePlayer).getTeam())
iPlotDamage += pCity->rangeCombatDamage(NULL, NULL, false, m_pPlot);
}
// Damage from features
iPlotDamage += GetDamageFromFeatures(ePlayer);
return iPlotDamage;
}