CvUnit::GetBaseRangedCombatStrength() const
- Defined in
- CvUnit.cpp, line 12753
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_GetBaseRangedCombatStrength
Hooks
static bool BeforeCvUnit_GetBaseRangedCombatStrength(const CvUnit* self, int& result);static void AfterCvUnit_GetBaseRangedCombatStrength(const CvUnit* self, int& result);static int ReplaceCvUnit_GetBaseRangedCombatStrength(int (*original)(const CvUnit*), const CvUnit* self);CivRegisterBefore<CivHooks::CvUnit_GetBaseRangedCombatStrength>(host, &BeforeCvUnit_GetBaseRangedCombatStrength);CivRegisterAfter<CivHooks::CvUnit_GetBaseRangedCombatStrength>(host, &AfterCvUnit_GetBaseRangedCombatStrength);CivRegisterReplace<CivHooks::CvUnit_GetBaseRangedCombatStrength>(host, &ReplaceCvUnit_GetBaseRangedCombatStrength);
Code
12753int CvUnit::GetBaseRangedCombatStrength() const12754{12755 VALIDATE_OBJECT12756 12757#if defined(MOD_UNITS_HOVERING_COASTAL_ATTACKS)12758 // Hovering units over coast/ice become ranged units12759 if (MOD_UNITS_HOVERING_COASTAL_ATTACKS && m_pUnitInfo->GetRangedCombat() == 0 && IsHoveringUnit() && (plot()->isShallowWater() || plot()->getFeatureType() == FEATURE_ICE)) {12760 int iMultiplier = gCustomMods.getOption("UNITS_HOVERING_COASTAL_ATTACKS_MULTIPLIER", 1);12761 int iDivisor = gCustomMods.getOption("UNITS_HOVERING_COASTAL_ATTACKS_DIVISOR", 1);12762 // Must use m_iBaseCombat and not GetBaseCombatStrength(), as the latter will return 012763 return (iDivisor == 0) ? 0 : ((m_iBaseCombat * iMultiplier) / iDivisor);12764 }12765#endif1276612767#if defined(MOD_API_EXTENSIONS)12768 return m_iBaseRangedCombat;12769#else12770 return m_pUnitInfo->GetRangedCombat();12771#endif12772}
Calls
Called by
- CvPlayer::DoUnresearchedTechBonusFromKill(CvUnit *, UnitTypes, int, int, int &)
- CvPlayer::DoYieldBonusFromKill(YieldTypes, CvUnit *, CvUnit *, UnitTypes, int, int, bool, int &)
- CvUnit::GetMaxRangedCombatStrength(const CvUnit *, const CvCity *, bool, bool) const
- CvUnit::GetPower() const
- CvUnit::IsCanAttackRanged() const
- CvUnit::canAirAttack() const
- CvUnit::canAirSweep() const
- CvUnit::canRangeStrike() const
- CvUnit::isRanged() const
- CvUnitCombat::ApplyPostCombatTraitEffects(CvUnit *, CvUnit *)
- CvLuaUnit::lGetBaseRangedCombatStrength(lua_State *)