Valkrionn
The Hamster King
No, music cannot be added modularly. Sorry, that file just does not function in that way (Nor do the LSystem files).
Will have to overwrite it, unfortunately.
Will have to overwrite it, unfortunately.
Will have to overwrite it, unfortunately.
Short answer: It doesn't. The only function in CvGameUtils which is properly modular (until I get around to fixing it) is cannotTrain().
Just haven't updated it in all the functions.If you'd like to and then submit it to me, be my guest, it will be used.
![]()
def onUnitPillage(self, argsList):
aren't modular...![]()
onUnitPillage isn't modular? Strange, I could have sworn that I used it in a modular fashion in the Mekara module.![]()
## MODULAR PYTHON FOR THE MEKARA ORDER MODULE
## Eric 'Jheral' Lindroth
## Last Edited: 28-August-2010
## ericl87@hotmail.com
from CvPythonExtensions import *
from BasicFunctions import *
import PyHelpers
# globals
gc = CyGlobalContext()
PyInfo = PyHelpers.PyInfo
getInfoType = gc.getInfoTypeForString
def onUnitPillage(self, argsList):
pUnit, iImprovement, iRoute, iOwner = argsList
iPlotX = pUnit.getX()
iPlotY = pUnit.getY()
map = CyMap()
pPlot = map.plot(iPlotX, iPlotY)
pPlayer = gc.getPlayer(iOwner)
eCiv = pPlayer.getCivilizationType()
pVictim =gc.getPlayer( pPlot.getOwner())
eVictimCiv = pVictim.getCivilizationType()
iRace = (gc.getCivilizationInfo(pVictim.getCivilizationType())).getDefaultRace()
if pUnit.getUnitType() == getInfoType('UNIT_BOUNTY_HUNTER') or pUnit.getUnitType() == getInfoType('UNIT_SLAVE_HUNTER') or pUnit.getUnitType() == getInfoType('UNIT_RAIDER'):
sValidImprovements = ['IMPROVEMENT_PASTURE','IMPROVEMENT_FARM','IMPROVEMENT_HOMESTEAD','IMPROVEMENT_COTTAGE','IMPROVEMENT_HAMLET','IMPROVEMENT_VILLAGE','IMPROVEMENT_TOWN','IMPROVEMENT_ENCLAVE','IMPROVEMENT_PLANTATION' ,'IMPROVEMENT_DWARVEN_SETTLEMENT','IMPROVEMENT_DWARVEN_HALL','IMPROVEMENT_DWARVEN_FORTRESS','IMPROVEMENT_DWARVEN_MINE','IMPROVEMENT_BEDOUIN_CAMP','IMPROVEMENT_BEDOUIN_GATHERING','IMPROVEMENT_BEDOUIN_VILLAGE','IMPROVEMENT_BEDOUIN_SIT']
iRnd = CyGame().getSorenRandNum(100, "Capture Chance")
if (pUnit.getUnitType() == getInfoType('UNIT_BOUNTY_HUNTER') and iRnd < 30) or (pUnit.getUnitType() == getInfoType('UNIT_SLAVE_HUNTER') and iRnd < 40) or (pUnit.getUnitType() == getInfoType('UNIT_RAIDER') and iRnd < 60):
for i in xrange (0, len(sValidImprovements)) :
iImprovement2 = getInfoType (sValidImprovements[i])
if iImprovement == iImprovement2 :
CvUtil.pyPrint("While pillaging, Player %d's %s captured a slave" %(iOwner, PyInfo.UnitInfo(pUnit.getUnitType()).getDescription()))
iUnit = getInfoType("UNIT_SLAVE")
if getInfoType('CIVILIZATION_JOTNAR') != -1:
if gc.getCivilizationInfo(pVictim.getCivilizationType()) == getInfoType('CIVILIZATION_JOTNAR'):
iUnit = getInfoType("UNIT_JOT_SLAVE")
newUnit = pPlayer.initUnit(iUnit,iPlotX, iPlotY, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
if iRace != -1:
newUnit.setHasPromotion(iRace, True)
def onCityAcquired(self, argsList):
'City Acquired'
iPreviousOwner,iNewOwner,pCity,bConquest,bTrade = argsList
gc = CyGlobalContext()
cf = self.cf
game = CyGame()
iPlotX = pCity.getX()
iPlotY = pCity.getY()
getPlayer = gc.getPlayer
pPlayer = getPlayer(iNewOwner)
hasTrait = pPlayer.hasTrait
pPlot = pCity.plot()
setBuilding = pCity.setNumRealBuilding
changePop = pCity.changePopulation
iCiv = pPlayer.getCivilizationType()
iCityOwner = pCity.getOwner()
pCityOwner = getPlayer(iCityOwner)
Civ = self.Civilizations
Trait = self.Traits
Leader = self.Leaders
Civic = self.Civics
Rel = self.Religions
Building = self.Buildings
Unit = self.Units
iPop = pCity.getPopulation()
pPrevious = getPlayer(iPreviousOwner)
iNoAI = UnitAITypes.NO_UNITAI
iSouth = DirectionTypes.DIRECTION_SOUTH
iPrevCiv = pPrevious.getCivilizationType()
if iPrevCiv == gc.getInfoTypeForString('CIVILIZATION_MEKARA'):
iCount = pCity.getFreeSpecialistCount(gc.getInfoTypeForString('SPECIALIST_SLAVE'))
#iUnit = getInfoType("UNIT_SLAVE")
for i in xrange(iCount):
#newUnit = pPlayer.initUnit(iUnit,iPlotX, iPlotY, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
pCity.changeFreeSpecialistCount(gc.getInfoTypeForString('SPECIALIST_CITIZEN'), 1)
pCity.changeFreeSpecialistCount(gc.getInfoTypeForString('SPECIALIST_SLAVE'), -1)
def onUnitPromoted(self, argsList):
pUnit = argsList[1]
pPlayer = gc.getPlayer( pUnit.getOwner())
if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_MEKARA'):
if pUnit.getUnitType() == getInfoType('UNIT_SLAVE_HUNTER') or pUnit.getUnitType() == getInfoType('UNIT_COMBAT_OVERSEER') or pUnit.getUnitType() == getInfoType('UNIT_ASSASSIN'):
iRnd = CyGame().getSorenRandNum(100, "Vampirism Results")
if iRnd < 20:
pUnit.setHasPromotion( getInfoType('PROMOTION_VAMPIRE') , True )
if pUnit.getUnitType() == getInfoType('UNIT_SLUGA') or pUnit.getUnitType() == getInfoType('UNIT_BATTLE_SLUGA'):
newUnit = pPlayer.initUnit(pUnit.getUnitType(), caster.getX(), caster.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
pUnit.kill(True, 0)
def onUnitBuilt(self, argsList):
pUnit = argsList[1]
pPlayer = gc.getPlayer( pUnit.getOwner())
if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_MEKARA'):
if pUnit.getUnitType() == getInfoType('UNIT_SLAVE_HUNTER') or pUnit.getUnitType() == getInfoType('UNIT_COMBAT_OVERSEER') or pUnit.getUnitType() == getInfoType('UNIT_ASSASSIN'):
iRnd = CyGame().getSorenRandNum(100, "Vampirism Results")
if iRnd < 20:
pUnit.setHasPromotion( getInfoType('PROMOTION_VAMPIRE') , True )
if pUnit.getUnitType() == getInfoType('UNIT_SLUGA') or pUnit.getUnitType() == getInfoType('UNIT_BATTLE_SLUGA'):
newUnit = pPlayer.initUnit(pUnit.getUnitType(), caster.getX(), caster.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
pUnit.kill(True, 0)
## *******************
## Modular Python: ANW 29-may-2010
for module in command['onUnitBuilt']:
module.onUnitBuilt(self, argsList)
## Modular Python End
## *******************