Bazaar developer reference

CvTacticalAI::PlotSurgicalCityStrikeMoves()

Defined in
CvTacticalAI.cpp, line 3756
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_PlotSurgicalCityStrikeMoves

Hooks

static bool BeforeCvTacticalAI_PlotSurgicalCityStrikeMoves(CvTacticalAI* self);static void AfterCvTacticalAI_PlotSurgicalCityStrikeMoves(CvTacticalAI* self);static void ReplaceCvTacticalAI_PlotSurgicalCityStrikeMoves(void (*original)(CvTacticalAI*), CvTacticalAI* self);CivRegisterBefore<CivHooks::CvTacticalAI_PlotSurgicalCityStrikeMoves>(host, &BeforeCvTacticalAI_PlotSurgicalCityStrikeMoves);CivRegisterAfter<CivHooks::CvTacticalAI_PlotSurgicalCityStrikeMoves>(host, &AfterCvTacticalAI_PlotSurgicalCityStrikeMoves);CivRegisterReplace<CivHooks::CvTacticalAI_PlotSurgicalCityStrikeMoves>(host, &ReplaceCvTacticalAI_PlotSurgicalCityStrikeMoves);

Code

3755/// We should be strong enough to take out the city before the enemy can whittle us down with ranged attacks3756void CvTacticalAI::PlotSurgicalCityStrikeMoves()3757{3758	CvTacticalTarget target;3759	bool bAttackUnderway;37603761	CvTacticalDominanceZone* pZone = m_pMap->GetZone(m_iCurrentZoneIndex);3762	if(pZone->GetClosestCity() != NULL)3763	{3764		target.SetTargetType(AI_TACTICAL_TARGET_CITY);3765		target.SetTargetPlayer(pZone->GetClosestCity()->getOwner());3766		target.SetTargetX(pZone->GetClosestCity()->plot()->getX());3767		target.SetTargetY(pZone->GetClosestCity()->plot()->getY());3768		target.SetDominanceZone(pZone->GetDominanceZoneID());3769		bAttackUnderway = PlotCaptureCityMoves();37703771		// Any unit targets adjacent to city?3772		for(unsigned int iI = 0; iI < m_ZoneTargets.size(); iI++)3773		{3774			if(m_ZoneTargets[iI].GetTargetType() == AI_TACTICAL_TARGET_HIGH_PRIORITY_UNIT ||3775			        m_ZoneTargets[iI].GetTargetType() == AI_TACTICAL_TARGET_MEDIUM_PRIORITY_UNIT ||3776			        m_ZoneTargets[iI].GetTargetType() == AI_TACTICAL_TARGET_LOW_PRIORITY_UNIT)3777			{3778				if(plotDistance(m_ZoneTargets[iI].GetTargetX(), m_ZoneTargets[iI].GetTargetY(), target.GetTargetX(), target.GetTargetY()) == 1)3779				{3780					if(m_ZoneTargets[iI].IsTargetStillAlive(m_pPlayer->GetID()))3781					{3782						ExecutePriorityAttacksOnUnitTarget(m_ZoneTargets[iI]);3783					}3784				}3785			}3786		}37873788		if(target.IsTargetStillAlive(m_pPlayer->GetID()))3789		{3790			PlotDamageCityMoves();3791		}37923793		// Take any other really good attacks we've set up3794		PlotDestroyUnitMoves(AI_TACTICAL_TARGET_HIGH_PRIORITY_UNIT, true);3795		PlotDestroyUnitMoves(AI_TACTICAL_TARGET_MEDIUM_PRIORITY_UNIT, true);3796		PlotDestroyUnitMoves(AI_TACTICAL_TARGET_LOW_PRIORITY_UNIT, true);37973798		PlotCloseOnTarget(false /*bCheckDominance*/);3799	}3800}

Calls

Called by