コード例 #1
0
 def setPlotColor(self, x, y, iCosts):
     pPlot = CyMap().plot(x, y)
     tPlot = (x, y)
     self.dPlotList[tPlot] = self.COL_NO
     # check impassable
     if iCosts == -1:
         if (pPlot.isWater() and (self.eDomain == DomainTypes.DOMAIN_SEA)) or ((not pPlot.isWater()) and (self.eDomain == DomainTypes.DOMAIN_LAND)):
             self.dPlotList[tPlot] = PleOpt.MH_Color_Impassable_Terrain()
     # check if plot is reachable
     elif iCosts <= self.iMovesLeft:
         # check if the plot is reavealed
         if pPlot.isRevealed(self.iActivePlayerTeam, False):
             # check if a unit at that plot
             if pPlot.isUnit() and pPlot.isVisible(self.iActivePlayerTeam, False):
                 self.dPlotList[tPlot] = self.checkUnit(pPlot)
             # check if the plot is foreign territory
             elif pPlot.isVisible(self.iActivePlayerTeam, False):
                 self.dPlotList[tPlot] = self.checkTerritory(pPlot)
             # nothing special with that plot
             else:
                 self.dPlotList[tPlot] = PleOpt.MH_Color_Passable_Terrain()
         else:
             if self.checkAdjacentRevealed(pPlot):
                 self.dPlotList[tPlot] = PleOpt.MH_Color_Passable_Terrain()
             else:
                 self.dPlotList[tPlot] = self.COL_NO
コード例 #2
0
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)