当前位置: 首页>>代码示例>>C++>>正文


C++ CvPromotionEntry类代码示例

本文整理汇总了C++中CvPromotionEntry的典型用法代码示例。如果您正苦于以下问题:C++ CvPromotionEntry类的具体用法?C++ CvPromotionEntry怎么用?C++ CvPromotionEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CvPromotionEntry类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: IsPromotionValidForUnitCombatType

/// Is this a valid Promotion for the UnitCombatType?
bool IsPromotionValidForUnitCombatType(PromotionTypes ePromotion, UnitTypes eUnit)
{
	CvUnitEntry* unitInfo = GC.getUnitInfo(eUnit);
	CvPromotionEntry* promotionInfo = GC.getPromotionInfo(ePromotion);

	if(unitInfo == NULL || promotionInfo == NULL)
		return false;

	// No combat class (civilians)
	if(unitInfo->GetUnitCombatType() == NO_UNITCOMBAT)
	{
		return false;
	}

	// Combat class not valid for this Promotion
#if defined(MOD_GLOBAL_PROMOTION_CLASSES)
	if(!(promotionInfo->GetUnitCombatClass(unitInfo->GetUnitPromotionType())))
#else
	if(!(promotionInfo->GetUnitCombatClass(unitInfo->GetUnitCombatType())))
#endif
	{
		return false;
	}

	return true;
}
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:27,代码来源:CvGameCoreUtils.cpp

示例2: IsPromotionValidForCivilianUnitType

/// Is this a valid Promotion for this civilian?
bool IsPromotionValidForCivilianUnitType(PromotionTypes ePromotion, UnitTypes eUnit)
{
	CvPromotionEntry* promotionInfo = GC.getPromotionInfo(ePromotion);

	if(promotionInfo == NULL)
		return false;

	if(!(promotionInfo->GetCivilianUnitType((int)eUnit)))
	{
		return false;
	}

	return true;
}
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:15,代码来源:CvGameCoreUtils.cpp

示例3: GetCargoSpace

/// Total cargo space from all free promotions
int CvUnitEntry::GetCargoSpace() const
{
	int rtnValue = 0;

	for(int iLoop = 0; iLoop < GC.getNumPromotionInfos(); iLoop++)
	{
		const PromotionTypes ePromotion = static_cast<PromotionTypes>(iLoop);
		CvPromotionEntry* pkPromotionInfo = GC.getPromotionInfo(ePromotion);
		if(pkPromotionInfo)
		{
			if(GetFreePromotions(iLoop))
			{
				const int iVal = pkPromotionInfo->GetCargoChange();
				rtnValue += iVal;
			}
		}
	}

	return rtnValue;
}
开发者ID:Decker87,项目名称:civ5DllMod,代码行数:21,代码来源:CvUnitClasses.cpp

示例4: IsPromotionValidForUnitCombatType

/// Is this a valid Promotion for the UnitCombatType?
bool IsPromotionValidForUnitCombatType(PromotionTypes ePromotion, UnitTypes eUnit)
{
	CvUnitEntry* unitInfo = GC.getUnitInfo(eUnit);
	CvPromotionEntry* promotionInfo = GC.getPromotionInfo(ePromotion);

	if(unitInfo == NULL || promotionInfo == NULL)
		return false;

	// No combat class (civilians)
	if(unitInfo->GetUnitCombatType() == NO_UNITCOMBAT)
	{
		return false;
	}

	// Combat class not valid for this Promotion
	if(!(promotionInfo->GetUnitCombatClass(unitInfo->GetUnitCombatType())))
	{
		return false;
	}

	return true;
}
开发者ID:Be1eriand,项目名称:Battle-Royale,代码行数:23,代码来源:CvGameCoreUtils.cpp

示例5: int

/// 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;
			}

//.........这里部分代码省略.........
开发者ID:Decker87,项目名称:civ5DllMod,代码行数:101,代码来源:CvUnitClasses.cpp

示例6: isPromotionValid

bool isPromotionValid(PromotionTypes ePromotion, UnitTypes eUnit, bool bLeader, bool bTestingPrereq)
{
	CvUnitEntry* unitInfo = GC.getUnitInfo(eUnit);
	CvPromotionEntry* promotionInfo = GC.getPromotionInfo(ePromotion);

	if(unitInfo == NULL || promotionInfo == NULL)
		return false;

	// Can this Promotion not be chosen through normal leveling?
	if(!bTestingPrereq && promotionInfo->IsCannotBeChosen())
	{
		return false;
	}

	// If a Unit gets a Promotion for free then hand it out, no questions asked
	if(unitInfo->GetFreePromotions(ePromotion))
	{
		return true;
	}

	// If this isn't a combat Unit, no Promotion
	if(unitInfo->GetUnitCombatType() == NO_UNITCOMBAT)
	{
		return false;
	}

	// Is this a valid Promotion for the UnitCombatType?
	if(!::IsPromotionValidForUnitCombatType(ePromotion, eUnit))
	{
		return false;
	}

	if(!bLeader && promotionInfo->IsLeader())
	{
		return false;
	}

	// If the Unit only has one move then Blitz is not useful
	if(unitInfo->GetMoves() == 1)
	{
		if(promotionInfo->IsBlitz())
		{
			return false;
		}
	}

	// Promotion Prereqs
	if(NO_PROMOTION != promotionInfo->GetPrereqPromotion())
	{
		if(!isPromotionValid((PromotionTypes)promotionInfo->GetPrereqPromotion(), eUnit, bLeader, true))
		{
			return false;
		}
	}

	PromotionTypes ePrereq1 = (PromotionTypes)promotionInfo->GetPrereqOrPromotion1();
	PromotionTypes ePrereq2 = (PromotionTypes)promotionInfo->GetPrereqOrPromotion2();
	PromotionTypes ePrereq3 = (PromotionTypes)promotionInfo->GetPrereqOrPromotion3();
	PromotionTypes ePrereq4 = (PromotionTypes)promotionInfo->GetPrereqOrPromotion4();
	PromotionTypes ePrereq5 = (PromotionTypes)promotionInfo->GetPrereqOrPromotion5();
	PromotionTypes ePrereq6 = (PromotionTypes)promotionInfo->GetPrereqOrPromotion6();
	PromotionTypes ePrereq7 = (PromotionTypes)promotionInfo->GetPrereqOrPromotion7();
	PromotionTypes ePrereq8 = (PromotionTypes)promotionInfo->GetPrereqOrPromotion8();
	PromotionTypes ePrereq9 = (PromotionTypes)promotionInfo->GetPrereqOrPromotion9();
	if(ePrereq1 != NO_PROMOTION ||
		ePrereq2 != NO_PROMOTION ||
		ePrereq3 != NO_PROMOTION ||
		ePrereq4 != NO_PROMOTION ||
		ePrereq5 != NO_PROMOTION ||
		ePrereq6 != NO_PROMOTION ||
		ePrereq7 != NO_PROMOTION ||
		ePrereq8 != NO_PROMOTION ||
		ePrereq9 != NO_PROMOTION)
	{
		bool bValid = false;
		if(!bValid)
		{
			if(NO_PROMOTION != ePrereq1 && isPromotionValid(ePrereq1, eUnit, bLeader, true))
			{
				bValid = true;
			}
		}

		if(!bValid)
		{
			if(NO_PROMOTION != ePrereq2 && isPromotionValid(ePrereq2, eUnit, bLeader, true))
			{
				bValid = true;
			}
		}

		if(!bValid)
		{
			if(NO_PROMOTION != ePrereq3 && isPromotionValid(ePrereq3, eUnit, bLeader, true))
			{
				bValid = true;
			}
		}

		if(!bValid)
//.........这里部分代码省略.........
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:101,代码来源:CvGameCoreUtils.cpp

示例7: kPerfTest


//.........这里部分代码省略.........
			piIndexList[iTotalActionInfoCount] = i;
			piPriorityList[iTotalActionInfoCount] = commandInfo->getOrderPriority();
			piActionInfoTypeList[iTotalActionInfoCount] = ACTIONSUBTYPE_COMMAND;
			iTotalActionInfoCount++;
		}
	}

	for(i=0; i<NUM_INTERFACEMODE_TYPES; i++)
	{
		CvInterfaceModeInfo* interfaceInfo = GC.getInterfaceModeInfo((InterfaceModeTypes)i);
		if(interfaceInfo)
		{
			piIndexList[iTotalActionInfoCount] = i;
			piPriorityList[iTotalActionInfoCount] = interfaceInfo->getOrderPriority();
			piActionInfoTypeList[iTotalActionInfoCount] = ACTIONSUBTYPE_INTERFACEMODE;
			iTotalActionInfoCount++;
		}
	}

	for(i=0; i<GC.getNumBuildInfos(); i++)
	{
		CvBuildInfo* buildInfo = GC.getBuildInfo((BuildTypes)i);
		if(buildInfo)
		{
			piIndexList[iTotalActionInfoCount] = i;
			piPriorityList[iTotalActionInfoCount] = buildInfo->getOrderPriority();
			piActionInfoTypeList[iTotalActionInfoCount] = ACTIONSUBTYPE_BUILD;
			iTotalActionInfoCount++;
		}
	}

	for(i=0; i<GC.getNumPromotionInfos(); i++)
	{
		CvPromotionEntry* promotionEntry = GC.getPromotionInfo((PromotionTypes)i);
		if(promotionEntry)
		{
			piIndexList[iTotalActionInfoCount] = i;
			piPriorityList[iTotalActionInfoCount] = promotionEntry->getOrderPriority();
			piActionInfoTypeList[iTotalActionInfoCount] = ACTIONSUBTYPE_PROMOTION;
			iTotalActionInfoCount++;
		}
	}

	for(i=0; i<GC.getNumSpecialistInfos(); i++)
	{
		CvSpecialistInfo* specialistInfo = GC.getSpecialistInfo((SpecialistTypes)i);
		if(specialistInfo)
		{
			piIndexList[iTotalActionInfoCount] = i;
			piPriorityList[iTotalActionInfoCount] = specialistInfo->getOrderPriority();
			piActionInfoTypeList[iTotalActionInfoCount] = ACTIONSUBTYPE_SPECIALIST;
			iTotalActionInfoCount++;
		}
	}

	for(i=0; i<NUM_CONTROL_TYPES; i++)
	{
		CvControlInfo* controlInfo = GC.getControlInfo((ControlTypes)i);
		if(controlInfo)
		{
			piIndexList[iTotalActionInfoCount] = i;
			piPriorityList[iTotalActionInfoCount] = controlInfo->getOrderPriority();
			piActionInfoTypeList[iTotalActionInfoCount] = ACTIONSUBTYPE_CONTROL;
			iTotalActionInfoCount++;
		}
	}
开发者ID:doktorstick,项目名称:civsdk,代码行数:67,代码来源:CvDllDatabaseUtility.cpp


注:本文中的CvPromotionEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。