if (pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_FOREST_ANCIENT') and pPlot.isOwned()):
iChance = gc.getDefineINT('TREANT_SPAWN_CHANCE')
if pPlot.isBeingWorked():
pCity = pPlot.getWorkingCity()
if pCity.isHasRealBuilding(gc.getInfoTypeForString('BUILDING_SHADOWED_VALE')):
iChance = iChance * 3
if CyGame().getSorenRandNum(100, "Bob") <= iChance:
p2Player = gc.getPlayer(pPlot.getOwner())
eTeam = gc.getTeam(pPlayer.getTeam())
i2Team = p2Player.getTeam()
if (eTeam.isAtWar(i2Team) and p2Player.getStateReligion() == gc.getInfoTypeForString('RELIGION_FELLOWSHIP_OF_LEAVES')):
for i in range(pPlot.getNumUnits()):
p2Unit = pPlot.getUnit(i)
p2Plot = cf.FFHFindClearPlot(p2Unit, -1)
if p2Plot != -1:
p2Unit.setXY(p2Plot.getX(),p2Plot.getY())
p2Unit.finishMoves()
if pPlot.getNumUnits() == 0:
newUnit = p2Player.initUnit(gc.getInfoTypeForString('UNIT_TREANT'), pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI)
newUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_SUMMONED2'), True)
CyInterface().addMessage(pUnit.getOwner(),True,25,'An enemy Treant has appeared in the Ancient Forest.','AS2D_FEATUREGROWTH',1,'Art/Interface/Buttons/Units/Treant.dds',ColorTypes(8),newUnit.getX(),newUnit.getY(),True,True)
CyInterface().addMessage(pPlot.getOwner(),True,25,'A Treant defender has appeared in the Ancient Forest.','AS2D_FEATUREGROWTH',1,'Art/Interface/Buttons/Units/Treant.dds',ColorTypes(8),newUnit.getX(),newUnit.getY(),True,True)