def onTechAcquired(self, argsList):
'Tech Acquired'
iTechType, iTeam, iPlayer, bAnnounce = argsList
# Note that iPlayer may be NULL (-1) and not a refer to a player object
# Limited Religions
game = CyGame()
pPlayer = gc.getPlayer(iPlayer)
FoundRel = False
#CyInterface().addImmediateMessage("onTechAcquired", "")
if iPlayer > -1:
# Is this a religious Tech?
if LimitedReligions.isReligiousTech(iTechType):
# Is the game option selected for Limited Religions?
if LimitedReligions.isOC_LIMITED_RELIGIONS():
# Skip dead players and Barbarions
if pPlayer.isAlive() and not pPlayer.isBarbarian():
# Must not already have a Holy City
if ( LimitedReligions.OwnsHolyCity(iPlayer) < 2 ):
# Loop through all religions
for iSlot in range(gc.getNumReligionInfos()):
# Does the player have the prerequisite tech for this religion slot?
if gc.getTeam(pPlayer.getTeam()).isHasTech(gc.getReligionInfo(iSlot).getTechPrereq()):
# Must be at least one religion slot available
if not game.isReligionSlotTaken(iSlot):
# The number of religious techs discovered must be greater than total religions founded.
if LimitedReligions.RelTechsGreaterThanReligions:
# PreConditions are met to found a religion.
# If the active player is Human
if iPlayer == gc.getGame().getActivePlayer() and pPlayer.isHuman:
# Choose religions option on?
if game.isOption(GameOptionTypes.GAMEOPTION_PICK_RELIGION):
# If Autoplay is running, Let the game pick the religion.
if( game.getAIAutoPlay() > 0 ):
FoundRel = True
break
else:
#Display the popup to pick a religion
#CyInterface().addImmediateMessage("Pick Religion", "")
LimitedReligions.doPickReligionPopup(iPlayer, iSlot)
break
else:
# Not Playing Choose Religions, So let the game pick the religion.
#CyInterface().addImmediateMessage("C", "")
FoundRel = True
break
else:
# Not Human, So let the game pick the religion.
#CyInterface().addImmediateMessage("Found a Religion", "")
FoundRel = True
break
if FoundRel:
# Get Civ's Favorite religion or random pick if favorite religion is not available.
#iNewReligion = LimitedReligions.AI_chooseReligion(iPlayer)
#if iNewReligion != -1:
# Found the religion.
#CyInterface().addImmediateMessage("Found Favorite Religion", "")
# pPlayer.foundReligion(iNewReligion, iSlot, True)
if game.isOption(GameOptionTypes.GAMEOPTION_PICK_RELIGION):
# Get Civ's Favorite religion or random pick if favorite religion is not available.
iNewReligion = LimitedReligions.AI_chooseReligion(iPlayer)
if iNewReligion != -1:
# Found the religion.
#CyInterface().addImmediateMessage("Found Favorite Religion", "")
pPlayer.foundReligion(iNewReligion, iSlot, True)
else:
for i in range(gc.getNumReligionInfos()):
if gc.getReligionInfo(i).getTechPrereq() == iTechType:
if not gc.getGame().isReligionFounded(i):
# Found the religion.
#CyInterface().addImmediateMessage("Found Prerequisit Religion", "")
pPlayer.foundReligion(i,i,True)
# End Limited Religions Mod
# Show tech splash when applicable
if (iPlayer > -1 and bAnnounce and not CyInterface().noTechSplash()):
if (gc.getGame().isFinalInitialized() and not gc.getGame().GetWorldBuilderMode()):
if ((not gc.getGame().isNetworkMultiPlayer()) and (iPlayer == gc.getGame().getActivePlayer())):
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
popupInfo.setData1(iTechType)
popupInfo.setText(u"showTechSplash")
popupInfo.addPopup(iPlayer)
if (not self.__LOG_TECH):
return
CvUtil.pyPrint('%s was finished by Team %d'
%(PyInfo.TechnologyInfo(iTechType).getDescription(), iTeam))