View unanswered posts | View active topics It is currently 29 Nov 2021, o 19:01

Reply to topic  [ 1 post ] 
 Merging with Platy Migration GP 
Author Message

Joined: 29 Oct 2021, o 04:36
Posts: 3
Post Merging with Platy Migration GP
Hello, i have some issues with merging Platy Migration GP
previously i succefully merged it with vanilla BTS and ROM:AND, but this mod i think has more interesting mechanics so I want to add some stuff which i like to play

The first issue is with not working button to migrate own GP.
But i can live without it so i changed this code

def onCityAcquired(self, argsList):
## Platy Builder ##
if CyGame().GetWorldBuilderMode() and not CvPlatyBuilderScreen.bPython: return
## Platy Builder ##
'City Acquired'
iPreviousOwner,iNewOwner,pCity,bConquest,bTrade = argsList
## Platy Migrating GP AI ##
pNewOwner = gc.getPlayer(iNewOwner)
if not pNewOwner.isHuman() or pNewOwner.isHuman(): <<-----right here
for iSpecialist in xrange(gc.getNumSpecialistInfos()):
iCount = pCity.getFreeSpecialistCount(iSpecialist)
if iCount > 0:
PlatyMigratingGP.MigratingGP().Migrate(pCity, iSpecialist, 0, iCount)
## Platy Migrating GP AI ##

so i can take all GP when capturing cities like AI, but i noticed that both player and AI only take first of Great Merchant, Artist, Priest etc without Great General.
For example only one of five G Artists. The rest - 4 of 5 - disapear.

The reason I suppose is somewhere here

from CvPythonExtensions import *
gc = CyGlobalContext()

class MigratingGP:
def Migrate(self, pCity, iSpecialist, iGold, iCount):
iUnit = self.getGPUnit(iSpecialist, pCity)
if iUnit == -1: return
pCity.changeFreeSpecialistCount(iSpecialist, -iCount)
pPlayer = gc.getPlayer(pCity.getOwner())
pPlayer.changeGold(-iGold * iCount )
pUnit = pPlayer.initUnit(iUnit, pCity.getX(), pCity.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)

def getGPUnit(self, iSpecialist, pCity):
if pCity.getFreeSpecialistCount(iSpecialist) < 1: return -1
if gc.getSpecialistInfo(iSpecialist).getType().find("GREAT") == -1: return -1
CivInfo = gc.getCivilizationInfo(pCity.getCivilizationType())
for i in xrange(gc.getNumUnitClassInfos()):
iUnit = CivInfo.getCivilizationUnits(i)
if iUnit == -1: continue
if gc.getUnitInfo(iUnit).getGreatPeoples(iSpecialist):
return iUnit
return -1

def getGold(self, iHandicap):
iGold = gc.getGameSpeedInfo(CyGame().getGameSpeedType()).getGreatPeoplePercent()
iGold *= gc.getHandicapInfo(iHandicap).getBarbarianInitialDefenders()
return iGold /3

4 Nov 2021, o 11:51
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.