## ExecutiveBriefing by Spocko
## Inspired by Dr Jiggle's Civ4Lerts mod
##
from CvPythonExtensions import *
import CvUtil
import PyHelpers
import Popup as PyPopup
import CvCameraControls
# globals
gc = CyGlobalContext()
class ExecutiveBriefing:
def onCityDoTurn(self, argsList):
pCity = argsList[0]
iPlayer = argsList[1]
iturn = gc.getGame().getGameTurn()
if ((not CyGame().isNetworkMultiPlayer()) and (pCity.getOwner() == CyGame().getActivePlayer()) and (not gc.getPlayer(iPlayer).isAnarchy())):
# City is about to grow and not because of it finishing producing a unit (settler or worker) using food
NoGrowthEmphasis = 5
if ((pCity.getFoodTurnsLeft() == 1) and not pCity.isFoodProduction() and (not pCity.AI_isEmphasize(NoGrowthEmphasis))):
CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'%s will grow to size %s next turn...' %((pCity.getName()), (pCity.getPopulation() + 1)),'',1,'Art/Interface/Buttons/Units/Settler.dds',ColorTypes(8),pCity.getX(),pCity.getY(),True,True)
# City is about to grow and, by doing so, create one too many unhealthy people
if (pCity.goodHealth() <= pCity.badHealth(False)):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'%s will become unhealthy next turn...' %(pCity.getName()),'',1,'Art/Interface/Buttons/General/unhealthy_person.dds',ColorTypes(10),pCity.getX(),pCity.getY(),True,True)
# City is about to grow and, by doing so, create one too many unhappy people
if (pCity.happyLevel() <= pCity.unhappyLevel(0)):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'%s will become unhappy next turn...' %(pCity.getName()),'SND_CITY_REVOLT',1,'Art/Interface/Buttons/General/resistance.dds',ColorTypes(7),pCity.getX(),pCity.getY(),True,True)
# Give a periodic status report on which cities are unhappy
if ((iturn % 4) == 0):
if (pCity.angryPopulation(0) > 0):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'The people of %s are angry!' %(pCity.getName()),'',1,'Art/Interface/Population Heads/angrycitizen.dds',ColorTypes(7),pCity.getX(),pCity.getY(),True,True)
# Give a periodic status report on which cities are unhealthy
if (((iturn + 1) % 4) == 0):
if (pCity.healthRate(False, 0) < 0):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'The people of %s are not in good health!' %(pCity.getName()),'',1,'Art/Interface/Buttons/General/unhealthy_person.dds',ColorTypes(10),pCity.getX(),pCity.getY(),True,True)
# Give a periodic status report on which cities have evenly split health/unhealthy (and the city is not about to grow - handled elsewhere)
if ((iturn % 5) == 0):
if ((pCity.getFoodTurnsLeft() != 1) and (pCity.goodHealth() == pCity.badHealth(0))):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'%s is half healthy, half unhealthy...' %(pCity.getName()),'',1,'Art/Interface/Buttons/General/unhealthy_person.dds',ColorTypes(13),pCity.getX(),pCity.getY(),True,True)
# Give a periodic status report on which cities have evenly split happy/unhappy (and the city is not about to grow - handled elsewhere)
if ((iturn +1 % 5) == 0):
if ((pCity.getFoodTurnsLeft() != 1) and (pCity.happyLevel() == pCity.unhappyLevel(0))):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'%s is poised between happiness and unhappiness...' %(pCity.getName()),'',1,'Art/Interface/Buttons/General/resistance.dds',ColorTypes(12),pCity.getX(),pCity.getY(),True,True)
# Give a periodic status report on which cities are either starving or close to it
if (((iturn - 1) % 3) == 0):
if (pCity.foodDifference(True) < 0):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'%s needs more food...' %(pCity.getName()),'',1,'Art/Interface/Symbols/Food/food05.dds',ColorTypes(7),pCity.getX(),pCity.getY(),True,True)
# Give a periodic report on cities that have a long wait before finishing their current production
if ((iturn % 20) == 0):
if (pCity.getGeneralProductionTurnsLeft() > 30):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'%s needs %d turns to build a %s...' %(pCity.getName(),pCity.getGeneralProductionTurnsLeft(),pCity.getProductionName()),'',1,'Art/Interface/Symbols/Production/production05.dds',ColorTypes(78),pCity.getX(),pCity.getY(),True,True)
# Give a periodic report on cities that are unproductive
if ((iturn % 16) == 0):
if ((pCity.getPopulation() > 3) and (pCity.getPopulation() > (pCity.getYieldRate(YieldTypes.YIELD_PRODUCTION)*1.5))):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'%s is woefully unproductive ( %s )...' %(pCity.getName(),pCity.getProductionName()),'',1,'Art/Interface/Symbols/Production/production05.dds',ColorTypes(11),pCity.getX(),pCity.getY(),True,True)
# Give a periodic report on small cities that would benefit from Hurrying production
if (((iturn + 1) % 7) == 0):
civGovernment = gc.getPlayer(iPlayer).getCivics(0)
civLabor = gc.getPlayer(iPlayer).getCivics(2)
if (((civGovernment == gc.getInfoTypeForString('CIVIC_UNIVERSAL_SUFFRAGE')) or (civLabor == gc.getInfoTypeForString('CIVIC_SLAVERY'))) and ((pCity.getPopulation() < 4) and (pCity.getGeneralProductionTurnsLeft() > 30))):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'%s could use some hurry-up production for its %s...' %(pCity.getName(),pCity.getProductionName()),'',1,'Art/Interface/Symbols/Production/production05.dds',ColorTypes(11),pCity.getX(),pCity.getY(),True,True)
# Give a periodic status report on which cities are set to emphasize NO GROWTH
if (((iturn - 2) % 7) == 0):
if (pCity.AI_isEmphasize(NoGrowthEmphasis)):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'The city governor of %s is emphasizing No Growth policies...' %(pCity.getName()),'',1,'Art/Interface/Buttons/Units/Settler.dds',ColorTypes(12),pCity.getX(),pCity.getY(),True,True)
# Give a periodic report on cities that are not connected to the civ trade network
if ((iturn % 9) == 0):
if (not pCity.isConnectedToCapital(0)):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'%s is not connected to the capital city...' %(pCity.getName()),'',1,'Art/Interface/Buttons/Governor/commerce.dds',ColorTypes(13),pCity.getX(),pCity.getY(),True,True)
# Give a periodic report on cities that have a long wait before growing
if ((iturn % 15) == 0):
if ((pCity.getFoodTurnsLeft() > 30) and not pCity.isFoodProduction() and (not pCity.AI_isEmphasize(NoGrowthEmphasis)) and (pCity.getPopulation() > 3) and (pCity.getPopulation() < 9)):
CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'%s needs %d turns to grow to size %d...' %(pCity.getName(),pCity.getFoodTurnsLeft(),(pCity.getPopulation() + 1)),'',1,'Art/Interface/Buttons/Units/Settler.dds',ColorTypes(7),pCity.getX(),pCity.getY(),True,True)
# # Give a periodic report on small cities that would benefit from Hurrying production
# if (((iturn + 1) % 7) == 0):
# civGovernment = gc.getPlayer(iPlayer).getCivics(0)
# civLabor = gc.getPlayer(iPlayer).getCivics(2)
# if (((civGovernment == gc.getInfoTypeForString('CIVIC_POLICE_STATE')) or ( civGovernment == gc.getInfoTypeForString('CIVIC_UNIVERSAL_SUFFRAGE')) or (civLabor == gc.getInfoTypeForString('CIVIC_SLAVERY'))) and ((pCity.getPopulation() < 4) and (pCity.getGeneralProductionTurnsLeft() > 30))):
# CyInterface().addMessage(CyGame().getActivePlayer(),True,10,'%s could use some hurry-up production for its %s...' %(pCity.getName(),pCity.getProductionName()),'',1,'Art/Interface/Symbols/Production/production05.dds',ColorTypes(11),pCity.getX(),pCity.getY(),True,True)