CvUnit::IsCanDefend(const CvPlot *) const
- Defined in
- CvUnit.cpp, line 23733
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_IsCanDefend
Hooks
static bool BeforeCvUnit_IsCanDefend(const CvUnit* self, const CvPlot* pPlot, bool& result);static void AfterCvUnit_IsCanDefend(const CvUnit* self, const CvPlot* pPlot, bool& result);static bool ReplaceCvUnit_IsCanDefend(bool (*original)(const CvUnit*, const CvPlot*), const CvUnit* self, const CvPlot* pPlot);CivRegisterBefore<CivHooks::CvUnit_IsCanDefend>(host, &BeforeCvUnit_IsCanDefend);CivRegisterAfter<CivHooks::CvUnit_IsCanDefend>(host, &AfterCvUnit_IsCanDefend);CivRegisterReplace<CivHooks::CvUnit_IsCanDefend>(host, &ReplaceCvUnit_IsCanDefend);
Code
23732/// Unit able to fight back when attacked?23733bool CvUnit::IsCanDefend(const CvPlot* pPlot) const23734{23735 VALIDATE_OBJECT23736 if(pPlot == NULL)23737 {23738 pPlot = plot();23739 }2374023741 // This will catch noncombatants23742 if(GetBaseCombatStrength() == 0)23743 {23744 return false;23745 }2374623747 if(isDelayedDeath())23748 {23749 return false;23750 }2375123752 if(!pPlot->isValidDomainForAction(*this))23753 {23754 return false;23755 }2375623757 return true;23758}
Calls
Called by
- CvCity::rangeCombatDamage(const CvUnit *, CvCity *, bool) const
- PUF_canDefend(const CvUnit *, int, int)
- PUF_cannotDefend(const CvUnit *, int, int)
- CvHomelandAI::ExecuteMovesToSafestPlot()
- CvHomelandAI::FindHomelandTargets()
- CvHomelandAI::MoveCivilianToSafety(CvUnit *, bool, bool)
- CvHomelandAI::PlotMovesToSafety()
- CvPlayer::disbandUnit(bool)
- CvPlot::getBestDefender(PlayerTypes, PlayerTypes, const CvUnit *, bool, bool, bool, bool) const
- CvPlot::getNumDefenders(PlayerTypes) const
- CvPlot::getNumVisibleEnemyDefenders(const CvUnit *) const
- CvPlot::getNumVisiblePotentialEnemyDefenders(const CvUnit *) const
- CvPlot::getVisibleEnemyDefender(PlayerTypes)
- CvPlot::isVisibleEnemyDefender(const CvUnit *) const
- CvTacticalAI::ExecuteMovesToSafestPlot()
- CvTacticalAI::FindTacticalTargets()
- CvTacticalAI::PlotMovesToSafety(bool)
- CvUnit::GetRangeCombatDamage(const CvUnit *, CvCity *, bool, int) const
- CvUnit::canSentry(const CvPlot *) const
- CvUnit::canSiege(TeamTypes) const
- CvUnit::isBetterDefenderThan(const CvUnit *, const CvUnit *) const
- CvUnit::setXY(int, int, bool, bool, bool, bool, bool)
- CvUnitCombat::Attack(CvUnit &, CvPlot &, ATTACK_OPTION)
- CvUnitCombat::ResolveMeleeCombat(const CvCombatInfo &, uint)
- CvLuaUnit::lIsCanDefend(lua_State *)