hrochland
Prince
Hey. Hello all Pythonist's. I need your help, please. If I have a civilization with state religion TAO, building_TAO and this civilization was being attacked, building_tao give two units.
If civilization changed religion for next war declare building_TAO give not units.
If left religion_TAO and will next declaration of war, give building two units again.
It can work this code?
thanks and sorry for my English
If civilization changed religion for next war declare building_TAO give not units.
If left religion_TAO and will next declaration of war, give building two units again.
It can work this code?
PHP:
def onChangeWar(self, argsList):
'War Status Changes'
bIsWar = argsList[0]
iTeam = argsList[1]
iRivalTeam = argsList[2]
## TAO start ##
if bIsWar:
pTeam2 = gc.getTeam(iRivalTeam)
if pTeam2.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_TAO")) == 1:
for iPlayerX in xrange(gc.getMAX_CIV_PLAYERS()):
pPlayerX = gc.getPlayer(iPlayerX)
if pPlayerX.getTeam() == iTeam:
if pPlayer.getReligion(gc.getInfoTypeForString('RELIGION_TAOISM')) == 1:
pPlayer = gc.getPlayer(pCity.plot().getOwner())
u_bubu = gc.getInfoTypeForString( 'UNIT_AMAZONSWORD' )
iX = pCity.getX()
iY = pCity.getY()
### unit+promotion ###
pNewUnit = pPlayer.initUnit( u_bubu, iX, iY, UnitAITypes.UNITAI_SPY, DirectionTypes.NO_DIRECTION )
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_COMBAT1' ), true)
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_COMBAT2' ), true)
pNewUnit.setName("aaa")
pNewUnit = pPlayer.initUnit( u_bubu, iX, iY, UnitAITypes.UNITAI_SPY, DirectionTypes.NO_DIRECTION )
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_COMBAT1' ), true)
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_COMBAT2' ), true)
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_COMBAT3' ), true)
pNewUnit.setName("bbb")
### message ###
CyInterface().addMessage(CyGame().getActivePlayer(),false,15,CyTranslator().getText("TXT_KEY_TAO",()),'',0,'Art/Interface/Buttons/Units/Bubu.dds',ColorTypes(44), -1, -1, True,True)
## TAO end ##
thanks and sorry for my English