コード例 #1
0
    def onFirstContact(self, iTeamX, iHasMetTeamY):
        if data.bNoPlagues:
            return

        if iTeamX == iInuit: return

        if iHasMetTeamY >= iNumPlayers: return

        if gc.getGame().getGameTurn() > getTurnForYear(
                tBirth[iAztecs]) + 2 and gc.getGame().getGameTurn(
                ) < getTurnForYear(1800):
            iOldWorldCiv = -1
            iNewWorldCiv = -1
            if iTeamX in lCivBioNewWorld and iHasMetTeamY in lCivBioOldWorld:
                iNewWorldCiv = iTeamX
                iOldWorldCiv = iHasMetTeamY
            if iOldWorldCiv != -1 and iNewWorldCiv != -1:
                if iNewWorldCiv == iMississippi:
                    if data.players[iInuit].iPlagueCountdown == 0:  #vulnerable
                        #print ("vulnerable", iNewWorldCiv)
                        if not teamInuit.isHasTech(iBiology):
                            city = utils.getRandomCity(iInuit)
                            if city:
                                iHealth = self.calculateHealth(iInuit)
                                if iHealth < 10:  #no spread for iHealth >= 70 years
                                    iHealth /= 10
                                    if gc.getGame().getSorenRandNum(
                                            100, 'roll') > 30 + 5 * iHealth:
                                        data.players[
                                            iInuit].iPlagueCountdown = iDuration - iHealth
                                        data.players[
                                            iInuit].bFirstContactPlague = True
                                        #print ("spreading (through first contact) plague to", iInuit)
                                        self.infectCity(city)
                                        self.announceForeignPlagueSpread(city)

                pNewWorldCiv = gc.getPlayer(iNewWorldCiv)
                if data.players[
                        iNewWorldCiv].iPlagueCountdown == 0:  #vulnerable
                    #print ("vulnerable", iNewWorldCiv)
                    if not gc.getTeam(
                            pNewWorldCiv.getTeam()).isHasTech(iBiology):
                        city = utils.getRandomCity(iNewWorldCiv)
                        if city:
                            iHealth = self.calculateHealth(iNewWorldCiv)
                            if iHealth < 10:  #no spread for iHealth >= 70 years
                                iHealth /= 10
                                if gc.getGame().getSorenRandNum(
                                        100, 'roll') > 30 + 5 * iHealth:
                                    data.players[
                                        iNewWorldCiv].iPlagueCountdown = iDuration - iHealth
                                    data.players[
                                        iNewWorldCiv].bFirstContactPlague = True
                                    #print ("spreading (through first contact) plague to", iNewWorldCiv)
                                    self.infectCity(city)
                                    self.announceForeignPlagueSpread(city)
コード例 #2
0
 def startPlague(self, iPlagueCounter):
     iWorstCiv = -1
     iWorstHealth = 200
     for iPlayer in range(iNumMajorPlayers):
         pPlayer = gc.getPlayer(iPlayer)
         if pPlayer.isAlive():
             if self.isVulnerable(iPlayer):
                 iHealth = self.calculateHealth(iPlayer) / 2
                 if pPlayer.calculateTotalCityHealthiness() > 0:
                     iHealth += gc.getGame().getSorenRandNum(
                         40, 'random modifier')
                     #print ("starting plague", "civ:", iPlayer, "iHealth:", iHealth)
                     if iPlagueCounter == 2:  #medieval black death
                         if iPlayer in lCivGroups[0]:
                             iHealth -= 5
                 if iHealth < iWorstHealth:
                     iWorstHealth = iHealth
                     iWorstCiv = iPlayer
     if iWorstCiv != -1:
         print("worstCiv", iWorstCiv)
         pWorstCiv = gc.getPlayer(iWorstCiv)
         city = utils.getRandomCity(iWorstCiv)
         if city:
             self.spreadPlague(iWorstCiv)
             self.infectCity(city)
             self.announceForeignPlagueSpread(city)
コード例 #3
0
	def startPlague(self, iPlagueCounter):
		iWorstCiv = -1
		iWorstHealth = 200
		for iPlayer in range(iNumMajorPlayers):
			pPlayer = gc.getPlayer(iPlayer)
			if pPlayer.isAlive():
				if self.isVulnerable(iPlayer):
					iHealth = self.calculateHealth(iPlayer) / 2
					if pPlayer.calculateTotalCityHealthiness() > 0:
						iHealth += gc.getGame().getSorenRandNum(40, 'random modifier')
						#print ("starting plague", "civ:", iPlayer, "iHealth:", iHealth)
						if iPlagueCounter == 2: #medieval black death
							if iPlayer in lCivGroups[0]:
								iHealth -= 5 
					if iHealth < iWorstHealth:
						iWorstHealth = iHealth
						iWorstCiv = iPlayer
		if iWorstCiv != -1:
			print ("worstCiv", iWorstCiv)
			pWorstCiv = gc.getPlayer(iWorstCiv)
			city = utils.getRandomCity(iWorstCiv)
			if city:
				self.spreadPlague(iWorstCiv)
				self.infectCity(city)
				self.announceForeignPlagueSpread(city)
コード例 #4
0
	def onFirstContact(self, iTeamX, iHasMetTeamY):
		if data.bNoPlagues:
			return

		if gc.getGame().getGameTurn() > getTurnForYear(tBirth[iAztecs]) + 2 and gc.getGame().getGameTurn() < getTurnForYear(1800):
			iOldWorldCiv = -1
			iNewWorldCiv = -1
			if iTeamX in lCivBioNewWorld and iHasMetTeamY in lCivBioOldWorld:
				iNewWorldCiv = iTeamX
				iOldWorldCiv = iHasMetTeamY
			if iOldWorldCiv != -1 and iNewWorldCiv != -1:
				pNewWorldCiv = gc.getPlayer(iNewWorldCiv)
				if data.players[iNewWorldCiv].iPlagueCountdown == 0: #vulnerable
					#print ("vulnerable", iNewWorldCiv)
					if not gc.getTeam(pNewWorldCiv.getTeam()).isHasTech(iBiology):
						city = utils.getRandomCity(iNewWorldCiv)
						if city:
							iHealth = self.calculateHealth(iNewWorldCiv)
							if iHealth < 10: #no spread for iHealth >= 70 years
								iHealth /= 10
								if gc.getGame().getSorenRandNum(100, 'roll') > 30 + 5*iHealth:
									data.players[iNewWorldCiv].iPlagueCountdown = iDuration - iHealth
									data.players[iNewWorldCiv].bFirstContactPlague = True
									#print ("spreading (through first contact) plague to", iNewWorldCiv)
									self.infectCity(city)
									self.announceForeignPlagueSpread(city)
コード例 #5
0
ファイル: Religions.py プロジェクト: srpt/RFC-Classical-World
	def makePilgrim(self):
		"""Generate a pilgrim at a random city."""
		
		# make a list of eligible players, count each player several times depending on piety
		playerList = []
		for iPlayer in range(con.iNumPlayers):
			pPlayer = gc.getPlayer(iPlayer)
			iPiety = sd.getPiety(iPlayer)
			if pPlayer.isAlive() and iPiety > 20:
				for i in range(iPiety/10 - 1):
					playerList.append(iPlayer)
		
		if len(playerList) > 1:
		
			# determine the recipient
			iRandNum = gc.getGame().getSorenRandNum(len(playerList), 'Random Player')
			iPlayer = playerList[iRandNum]
			pPlayer = gc.getPlayer(iPlayer)
			
			pCity = utils.getRandomCity(iPlayer)
			tCoords = utils.getPilgrimageSite(iPlayer)
			
			# make the pilgrim
			if pCity != -1:
				if pCity.getX() != tCoords[0] and pCity.getY() != tCoords[1]:
					pPlayer.initUnit(con.iPilgrim, pCity.getX(), pCity.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
					szText = localText.getText("TXT_KEY_MINOR_EVENT_PILGRIM_ARRIVED", (pCity.getName(), gc.getMap().plot(tCoords[0],tCoords[1]).getPlotCity().getName()))
					CyInterface().addMessage(iPlayer, False, con.iDuration, szText, "AS2D_RELIGION_CONVERT", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getUnitInfo(con.iPilgrim).getButton(), ColorTypes(con.iGreen), pCity.getX(), pCity.getY(), True, True)
コード例 #6
0
ファイル: Plague.py プロジェクト: srpt/RFC-Classical-World
    def startPlague(self, iPlagueCounter):

        iWorstCiv = -1
        iWorstHealth = 200
        for i in range(iNumPlayers):
            pPlayer = gc.getPlayer(i)
            if (pPlayer.isAlive()):
                if (self.isVulnerable(i) == True):
                    iHealth = -30
                    iHealth2 = iHealth / 2
                    if (pPlayer.calculateTotalCityHealthiness() > 0):
                        iHealth = int((1.0 * pPlayer.calculateTotalCityHealthiness()) / (pPlayer.calculateTotalCityHealthiness() + \
                         pPlayer.calculateTotalCityUnhealthiness()) * 100) - 60
                        iHealth2 = iHealth / 2 - 5
                        iHealth2 += gc.getGame().getSorenRandNum(
                            40, 'random modifier')
                    if i in con.lBlackDeathStarters:
                        iHealth2 -= 20 + gc.getGame().getSorenRandNum(
                            20, 'random modifier')
                    elif i in con.lBlackDeathSurvivors:
                        iHealth2 += 20 + gc.getGame().getSorenRandNum(
                            20, 'random modifier')
                    if (iHealth2 < iWorstHealth):
                        iWorstHealth = iHealth2
                        iWorstCiv = i
        if (iWorstCiv != -1):
            pWorstCiv = gc.getPlayer(iWorstCiv)
            city = utils.getRandomCity(iWorstCiv)
            if (city != -1):
                self.spreadPlague(iWorstCiv)
                self.infectCity(city)
                iHuman = utils.getHumanID()
                if (gc.getPlayer(iHuman).canContact(iWorstCiv)
                        and iHuman != iWorstCiv):
                    CyInterface().addMessage(
                        iHuman, True, con.iDuration,
                        CyTranslator().getText("TXT_KEY_PLAGUE_SPREAD_CITY",
                                               ()) + " " + city.getName() +
                        " (" + gc.getPlayer(
                            city.getOwner()).getCivilizationAdjective(0) +
                        ")!", "AS2D_PLAGUE", 0, "", ColorTypes(con.iLime), -1,
                        -1, True, True)
コード例 #7
0
    def onFirstContact(self, iTeamX, iHasMetTeamY):
        if data.bNoPlagues:
            return

        if gc.getGame().getGameTurn() > getTurnForYear(
                tBirth[iAztecs]) + 2 and gc.getGame().getGameTurn(
                ) < getTurnForYear(1800):
            iOldWorldCiv = -1
            iNewWorldCiv = -1
            if iTeamX in lCivBioNewWorld and iHasMetTeamY in lCivBioOldWorld:
                iNewWorldCiv = iTeamX
                iOldWorldCiv = iHasMetTeamY
            if iOldWorldCiv != -1 and iNewWorldCiv != -1:
                pNewWorldCiv = gc.getPlayer(iNewWorldCiv)
                if data.players[
                        iNewWorldCiv].iPlagueCountdown == 0:  #vulnerable
                    #print ("vulnerable", iNewWorldCiv)
                    if not gc.getTeam(
                            pNewWorldCiv.getTeam()).isHasTech(iBiology):
                        city = utils.getRandomCity(iNewWorldCiv)
                        if city:
                            iHealth = self.calculateHealth(iNewWorldCiv)
                            if iHealth < 10:  #no spread for iHealth >= 70 years
                                iHealth /= 10
                                if gc.getGame().getSorenRandNum(
                                        100, 'roll') > 30 + 5 * iHealth:
                                    data.players[
                                        iNewWorldCiv].iPlagueCountdown = iDuration - iHealth
                                    data.players[
                                        iNewWorldCiv].bFirstContactPlague = True
                                    #print ("spreading (through first contact) plague to", iNewWorldCiv)
                                    self.infectCity(city)
                                    if (gc.getDefineINT(
                                            "PYTHON_LOG_ON_MAIN_PLAGUE") == 1):
                                        utils.logwithid(
                                            iHasMetTeamY,
                                            ' is infecting new world civ city')
                                    self.announceForeignPlagueSpread(city)