Пример #1
0
 def fnCheckLandBridge(self, pPlot, x, y):
     pTestPlot = CyMap().plot(pPlot.getX()+x, pPlot.getY()+y)
     if not (pPlot.isCity() or pTestPlot.isCity()):
         pTestPlot = CyMap().plot(pPlot.getX()+x, pPlot.getY())
         if (pTestPlot.isCoastalLand()):
             pTestPlot = CyMap().plot(pPlot.getX(), pPlot.getY()+y)
             if (pTestPlot.isCoastalLand()):
                 return True
     return False
def doFogOfWar(iPlayer,iGameTurn):
	pPlayer = gc.getPlayer(iPlayer)
	iTeam = pPlayer.getTeam()
	pTeam = gc.getTeam(iTeam)
	# Human oder KI alle x Runden, aber unterschiedliche Civs pro Runde fuer optimale Rundenzeiten
	if pPlayer.isHuman() or (iGameTurn % 20 == iPlayer % 20 and pTeam.isMapTrading()):
		bDontGoBlackAnymore = False
		bShowCoasts = False
		bShowPeaksAndRivers = False
		if pTeam.isHasTech(gc.getInfoTypeForString("TECH_KARTOGRAPHIE2")):  # Strassenkarten
			bDontGoBlackAnymore = True
		elif pTeam.isHasTech(gc.getInfoTypeForString("TECH_KARTEN")):  # Karte zeichnen
			bShowCoasts = True
			bShowPeaksAndRivers = True
		elif pTeam.isHasTech(gc.getInfoTypeForString("TECH_KARTOGRAPHIE")):  # Kartographie: Erste Karten
			bShowCoasts = True

		if bDontGoBlackAnymore:
			return
		iRange = CyMap().numPlots()
		for iI in xrange(iRange):
			pPlot = CyMap().plotByIndex(iI)
			if not pPlot.isVisible(iTeam, 0):
				bGoBlack = True
				# fully black or standard fog of war
				if pPlot.isCity():
					pCity = pPlot.getPlotCity()
					if pCity.isCapital():
						bGoBlack = False
					elif pCity.getNumWorldWonders() > 0:
						bGoBlack = False
				# Holy Mountain Quest
				if bGoBlack:
					if CvUtil.getScriptData(pPlot, ["H", "t"]) == "X":
						bGoBlack = False
				# Improvements (to normal fog of war)
				# if bGoBlack:
				#  if pPlot.getImprovementType() == improv1 or pPlot.getImprovementType() == improv2: bGoBlack = False
				# 50% Chance Verdunkelung
				if bGoBlack and CvUtil.myRandom(2, "bGoBlack") == 0:
					bGoBlack = False
				# Black fog
				if bGoBlack and pPlot.isRevealed(iTeam, 0):
					# River and coast (land only)
					#if pPlot.isRevealed (iTeam, 0) and not (pPlot.isRiverSide() or pPlot.isCoastalLand()): pPlot.setRevealed (iTeam,0,0,-1)
					# River and coast (land and water)
					#if pPlot.isRevealed (iTeam, 0) and not (pPlot.isRiverSide() or pPlot.isCoastalLand() or (pPlot.isAdjacentToLand() and pPlot.isWater())): pPlot.setRevealed (iTeam,0,0,-1)
					if bShowCoasts and (pPlot.isCoastalLand() or pPlot.isAdjacentToLand() and pPlot.isWater()):
						continue
					if bShowPeaksAndRivers and (pPlot.isRiverSide() or pPlot.isPeak()):
						continue
					pPlot.setRevealed(iTeam, 0, 0, -1)