Ejemplo n.º 1
0
    def onTechAcquired(self, argsList):
        iTech, iTeam, iPlayer, bAnnounce = argsList

        iHuman = utils.getHumanID()

        iEra = gc.getTechInfo(iTech).getEra()
        iGameTurn = gc.getGame().getGameTurn()

        if iGameTurn == utils.getScenarioStartTurn():
            return

        sta.onTechAcquired(iPlayer, iTech)
        AIParameters.onTechAcquired(iPlayer, iTech)

        if iGameTurn > getTurnForYear(tBirth[iPlayer]):
            vic.onTechAcquired(iPlayer, iTech)
            cnm.onTechAcquired(iPlayer)
            dc.onTechAcquired(iPlayer, iTech)

        if gc.getPlayer(iPlayer).isAlive() and iGameTurn > getTurnForYear(
                tBirth[iPlayer]) and iPlayer < iNumPlayers:
            self.rel.onTechAcquired(iTech, iPlayer)
            if iGameTurn > getTurnForYear(1700):
                self.aiw.forgetMemory(iTech, iPlayer)

        if iTech == iExploration:
            if iPlayer in [
                    iSpain, iFrance, iEngland, iGermany, iVikings,
                    iNetherlands, iPortugal
            ]:
                data.players[iPlayer].iExplorationTurn = iGameTurn

        elif iTech == iCompass:
            if iPlayer == iVikings:
                gc.getMap().plot(49, 62).setTerrainType(iCoast, True, True)

        elif iTech == iMicrobiology:
            self.pla.onTechAcquired(iTech, iPlayer)

        elif iTech == iRailroad:
            self.rnf.onRailroadDiscovered(iPlayer)

        if iTech in [iExploration, iFirearms]:
            teamPlayer = gc.getTeam(iPlayer)
            if teamPlayer.isHasTech(iExploration) and teamPlayer.isHasTech(
                    iFirearms):
                self.rnf.earlyTradingCompany(iPlayer)

        if iTech in [iEconomics, iReplaceableParts]:
            teamPlayer = gc.getTeam(iPlayer)
            if teamPlayer.isHasTech(iEconomics) and teamPlayer.isHasTech(
                    iReplaceableParts):
                self.rnf.lateTradingCompany(iPlayer)

        if utils.getHumanID() != iPlayer:
            if iPlayer == iJapan and iEra == iIndustrial:
                utils.moveCapital(iPlayer, (116, 47))  # Toukyou
            elif iPlayer == iItaly and iEra == iIndustrial:
                utils.moveCapital(iPlayer, (60, 44))  # Roma
            elif iPlayer == iVikings and iEra == iRenaissance:
                utils.moveCapital(iPlayer, (63, 59))  # Stockholm
            elif iPlayer == iHolyRome and iEra == iRenaissance:
                utils.moveCapital(iPlayer, (62, 49))  # Wien

        # Maya UP: +20 food when a tech is discovered before the medieval era
        if iPlayer == iMaya and not pMaya.isReborn() and iEra < iMedieval:
            if pMaya.getNumCities() > 0:
                iFood = 20 / pMaya.getNumCities()
                for city in utils.getCityList(iMaya):
                    city.changeFood(iFood)
                CyInterface().addMessage(
                    iPlayer, False, iDuration,
                    CyTranslator().getText(
                        "TXT_KEY_MAYA_UP_EFFECT",
                        (gc.getTechInfo(iTech).getText(), iFood)), "", 0, "",
                    ColorTypes(iWhite), -1, -1, True, True)

        # Spain's core extends when reaching the Renaissance and there are no Moors in Iberia
        # at the same time, the Moorish core relocates to Africa
        if iPlayer == iSpain and iEra == iRenaissance and not utils.isReborn(
                iSpain):
            bNoMoors = True
            if gc.getPlayer(iMoors).isAlive():
                for city in utils.getCityList(iMoors):
                    if city.plot().getRegionID() == rIberia:
                        bNoMoors = False
            if bNoMoors:
                utils.setReborn(iSpain, True)
                utils.setReborn(iMoors, True)

        # Italy's core extends when reaching the Industrial era
        if iPlayer == iItaly and iEra == iIndustrial:
            utils.setReborn(iItaly, True)

        # Japan's core extends when reaching the Industrial era
        if iPlayer == iJapan and iEra == iIndustrial:
            utils.setReborn(iJapan, True)

        # Germany's core shrinks when reaching the Digital era
        if iPlayer == iGermany and iEra == iDigital:
            utils.setReborn(iGermany, True)
	def onTechAcquired(self, argsList):
		iTech, iTeam, iPlayer, bAnnounce = argsList

		iHuman = utils.getHumanID()
		
		iEra = gc.getTechInfo(iTech).getEra()
		
		if utils.getScenario() == i600AD and gc.getGame().getGameTurn() == getTurnForYear(600): #late start condition
			return
			
		if utils.getScenario() == i1700AD and gc.getGame().getGameTurn() == getTurnForYear(1700):
			return
			
		sta.onTechAcquired(iPlayer, iTech)
		AIParameters.onTechAcquired(iPlayer, iTech)
		
		if gc.getGame().getGameTurn() > getTurnForYear(tBirth[iPlayer]):
			vic.onTechAcquired(iPlayer, iTech)
			cnm.onTechAcquired(argsList[2])

		if gc.getPlayer(iPlayer).isAlive() and gc.getGame().getGameTurn() > getTurnForYear(tBirth[iPlayer]) and iPlayer < iNumPlayers:
			self.rel.onTechAcquired(argsList[0], argsList[2])
			if (gc.getGame().getGameTurn() > getTurnForYear(1700)):
				self.aiw.forgetMemory(argsList[0], argsList[2])

		if iTech == iAstronomy:
			if iPlayer in [iSpain, iFrance, iEngland, iGermany, iVikings, iNetherlands, iPortugal]:
				data.players[iPlayer].iAstronomyTurn = gc.getGame().getGameTurn()
				
		elif iTech == iCompass:
			if iPlayer == iVikings:
				gc.getMap().plot(49, 62).setTerrainType(iCoast, True, True)
				
		elif iTech == iMedicine:
			self.pla.onTechAcquired(argsList[0], argsList[2])

		elif iTech == iRailroad:
			self.rnf.onRailroadDiscovered(argsList[2])
			
		if iTech in [iAstronomy, iGunpowder]:
			teamPlayer = gc.getTeam(iPlayer)
			if teamPlayer.isHasTech(iAstronomy) and teamPlayer.isHasTech(iGunpowder):
				self.rnf.earlyTradingCompany(iPlayer)
			
		if iTech in [iEconomics, iRifling]:
			teamPlayer = gc.getTeam(iPlayer)
			if teamPlayer.isHasTech(iEconomics) and teamPlayer.isHasTech(iRifling):
				self.rnf.lateTradingCompany(iPlayer)
	
		if utils.getHumanID() != iPlayer:
			if iPlayer == iJapan and iEra == iIndustrial:
				utils.moveCapital(iPlayer, (116, 47)) # Toukyou
			elif iPlayer == iItaly and iEra == iIndustrial:
				utils.moveCapital(iPlayer, (60, 44)) # Roma
			elif iPlayer == iVikings and iEra == iRenaissance:
				utils.moveCapital(iPlayer, (63, 59)) # Stockholm
			elif iPlayer == iHolyRome and iEra == iRenaissance:
				utils.moveCapital(iPlayer, (62, 49)) # Wien
				
		# Spain's core extends when reaching the Renaissance and there are no Moors in Iberia
		# at the same time, the Moorish core relocates to Africa
		if iPlayer == iSpain and iEra == iRenaissance and not utils.isReborn(iSpain):
			bNoMoors = True
			if gc.getPlayer(iMoors).isAlive():
				for city in utils.getCityList(iMoors):
					if city.plot().getRegionID() == rIberia:
						bNoMoors = False
			if bNoMoors:
				utils.setReborn(iSpain, True)
				utils.setReborn(iMoors, True)
				
		# Italy's core extends when reaching the Industrial era
		if iPlayer == iItaly and iEra == iIndustrial:
			utils.setReborn(iItaly, True)
			
		# Arabia's core moves to Iraq when Philosophy is discovered
		if iPlayer == iArabia and iTech == iPhilosophy:
			utils.setReborn(iArabia, True)
			
		# Japan's core extends when reaching the Industrial era
		if iPlayer == iJapan and iEra == iIndustrial:
			utils.setReborn(iJapan, True)
			
		# Germany's core shrinks when reaching the Modern era
		if iPlayer == iGermany and iEra == iModern:
			utils.setReborn(iGermany, True)
Ejemplo n.º 3
0
    def onTechAcquired(self, argsList):
        iTech, iTeam, iPlayer, bAnnounce = argsList

        iHuman = utils.getHumanID()

        iEra = gc.getTechInfo(iTech).getEra()

        if gc.getGame().getGameTurn() == utils.getScenarioStartTurn():
            return

        sta.onTechAcquired(iPlayer, iTech)
        AIParameters.onTechAcquired(iPlayer, iTech)

        if gc.getGame().getGameTurn() > getTurnForYear(tBirth[iPlayer]):
            vic.onTechAcquired(iPlayer, iTech)
            cnm.onTechAcquired(iPlayer)
            dc.onTechAcquired(iPlayer, iTech)

        if gc.getPlayer(iPlayer).isAlive() and gc.getGame().getGameTurn(
        ) > getTurnForYear(tBirth[iPlayer]) and iPlayer < iNumPlayers:
            self.rel.onTechAcquired(iTech, iPlayer)
            if (gc.getGame().getGameTurn() > getTurnForYear(1700)):
                self.aiw.forgetMemory(iTech, iPlayer)

        if iTech == iExploration:
            if iPlayer in [
                    iSpain, iFrance, iEngland, iGermany, iVikings,
                    iNetherlands, iPortugal
            ]:
                data.players[iPlayer].iExplorationTurn = gc.getGame(
                ).getGameTurn()

        elif iTech == iCompass:
            if iPlayer == iVikings:
                gc.getMap().plot(49, 62).setTerrainType(iCoast, True, True)

        elif iTech == iMicrobiology:
            self.pla.onTechAcquired(iTech, iPlayer)

        elif iTech == iRailroad:
            self.rnf.onRailroadDiscovered(iPlayer)

        if iTech in [iExploration, iFirearms]:
            teamPlayer = gc.getTeam(iPlayer)
            if teamPlayer.isHasTech(iExploration) and teamPlayer.isHasTech(
                    iFirearms):
                self.rnf.earlyTradingCompany(iPlayer)

        if iTech in [iEconomics, iReplaceableParts]:
            teamPlayer = gc.getTeam(iPlayer)
            if teamPlayer.isHasTech(iEconomics) and teamPlayer.isHasTech(
                    iReplaceableParts):
                self.rnf.lateTradingCompany(iPlayer)

        if utils.getHumanID() != iPlayer:
            if iPlayer == iJapan and iEra == iIndustrial:
                utils.moveCapital(iPlayer, (116, 47))  # Toukyou
            elif iPlayer == iItaly and iEra == iIndustrial:
                utils.moveCapital(iPlayer, (60, 44))  # Roma
            elif iPlayer == iVikings and iEra == iRenaissance:
                utils.moveCapital(iPlayer, (63, 59))  # Stockholm
            elif iPlayer == iHolyRome and iEra == iRenaissance:
                utils.moveCapital(iPlayer, (62, 49))  # Wien

        # Spain's core extends when reaching the Renaissance and there are no Moors in Iberia
        # at the same time, the Moorish core relocates to Africa
        if iPlayer == iSpain and iEra == iRenaissance and not utils.isReborn(
                iSpain):
            bNoMoors = True
            if gc.getPlayer(iMoors).isAlive():
                for city in utils.getCityList(iMoors):
                    if city.plot().getRegionID() == rIberia:
                        bNoMoors = False
            if bNoMoors:
                utils.setReborn(iSpain, True)
                utils.setReborn(iMoors, True)

        # Italy's core extends when reaching the Industrial era
        if iPlayer == iItaly and iEra == iIndustrial:
            utils.setReborn(iItaly, True)

        # Arabia's core moves to Iraq when Education is discovered
        if iPlayer == iArabia and iTech == iEducation:
            utils.setReborn(iArabia, True)

        # Japan's core extends when reaching the Industrial era
        if iPlayer == iJapan and iEra == iIndustrial:
            utils.setReborn(iJapan, True)

        # Germany's core shrinks when reaching the Digital era
        if iPlayer == iGermany and iEra == iDigital:
            utils.setReborn(iGermany, True)
Ejemplo n.º 4
0
        def onTechAcquired(self, argsList):
		iTech, iTeam, iPlayer, bAnnounce = argsList

                iHuman = utils.getHumanID()
		
		iEra = gc.getTechInfo(iTech).getEra()
                
                if (utils.getScenario() == con.i600AD and gc.getGame().getGameTurn() == getTurnForYear(600)): #late start condition
                        return
			
		if utils.getScenario() == con.i1700AD and gc.getGame().getGameTurn() == getTurnForYear(1700):
			return
			
		sta.onTechAcquired(iPlayer, iTech)
		
                if (gc.getGame().getGameTurn() > getTurnForYear(con.tBirth[iPlayer])):
                	vic.onTechAcquired(iPlayer, iTech)
                        cnm.onTechAcquired(argsList[2])

                if (gc.getPlayer(iPlayer).isAlive() and gc.getGame().getGameTurn() > getTurnForYear(con.tBirth[iPlayer]) and iPlayer < con.iNumPlayers):
                        self.rel.onTechAcquired(argsList[0], argsList[2])
                
                if (gc.getPlayer(iPlayer).isAlive() and gc.getGame().getGameTurn() > getTurnForYear(con.tBirth[iPlayer]) and iPlayer < con.iNumPlayers):
                        if (gc.getGame().getGameTurn() > getTurnForYear(1700)):
                                self.aiw.forgetMemory(argsList[0], argsList[2])

                if (argsList[0] == con.iAstronomy):
			if iPlayer in [con.iSpain, con.iFrance, con.iEngland, con.iGermany, con.iVikings, con.iNetherlands, con.iPortugal]:
				self.rnf.setAstronomyTurn(iPlayer, gc.getGame().getGameTurn())
				
                if (argsList[0] == con.iCompass):
                        if (iPlayer == con.iVikings):
                                gc.getMap().plot(49, 62).setTerrainType(con.iCoast, True, True)
				
                if (argsList[0] == con.iMedicine):
                        self.pla.onTechAcquired(argsList[0], argsList[2])

		if argsList[0] == con.iRailroad:
			self.rnf.onRailroadDiscovered(argsList[2])
			
		if iTech in [con.iAstronomy, con.iGunpowder]:
			teamPlayer = gc.getTeam(iPlayer)
			if teamPlayer.isHasTech(con.iAstronomy) and teamPlayer.isHasTech(con.iGunpowder):
				self.rnf.earlyTradingCompany(iPlayer)
			
		if iTech in [con.iEconomics, con.iRifling]:
			teamPlayer = gc.getTeam(iPlayer)
			if teamPlayer.isHasTech(con.iEconomics) and teamPlayer.isHasTech(con.iRifling):
				self.rnf.lateTradingCompany(iPlayer)
	
		if utils.getHumanID() != iPlayer:
			if iPlayer == con.iJapan and iEra == con.iIndustrial:
				utils.moveCapital(iPlayer, (116, 46)) # Toukyou
			elif iPlayer == con.iItaly and iEra == con.iIndustrial:
				utils.moveCapital(iPlayer, (60, 44)) # Roma
			elif iPlayer == con.iVikings and iEra == con.iRenaissance:
				utils.moveCapital(iPlayer, (63, 59)) # Stockholm
			elif iPlayer == con.iHolyRome and iEra == con.iRenaissance:
				utils.moveCapital(iPlayer, (62, 49)) # Wien
				
		# Spain's core extends when reaching the Renaissance and there are no Moors in Iberia
		# at the same time, the Moorish core relocates to Africa
		if iPlayer == con.iSpain and iEra == con.iRenaissance:
			bNoMoors = True
			if gc.getPlayer(con.iMoors).isAlive():
				for city in utils.getCityList(iMoors):
					if city.plot().getRegionID() == con.rIberia:
						bNoMoors = False
			if bNoMoors:
				gc.getPlayer(con.iSpain).setReborn(True)
				gc.getPlayer(con.iMoors).setReborn(True)
				
		# Italy's core extends when reaching the Industrial era
		if iPlayer == con.iItaly and iEra == con.iIndustrial:
			gc.getPlayer(con.iItaly).setReborn(True)
			
		# Arabia's core moves to Iraq when Philosophy is discovered
		if iPlayer == con.iArabia and iTech == con.iPhilosophy:
			gc.getPlayer(con.iArabia).setReborn(True)
			
		# Japan's core extends when reaching the Industrial era
		if iPlayer == con.iJapan and iEra == con.iIndustrial:
			gc.getPlayer(con.iJapan).setReborn(True)
			
		# Germany's core shrinks when reaching the Modern era
		if iPlayer == con.iGermany and iEra == con.iModern:
			gc.getPlayer(con.iGermany).setReborn(True)