for i in range(CyMap().numPlots()):
pPlot = CyMap().plotByIndex(i)
if pPlot.getTeam() >= 0 and pPlot.getBonusType(-1) < 0:
impType = pPlot.getImprovementType()
[i]if impType is gc.getInfoTypeForString("[b]IMPROVEMENT_FARM[/b]"):
iBonus = gc.getInfoTypeForString("[b]BONUS_CORN[/b]")
if gc.getTeam(pPlot.getTeam()).isHasTech(gc.getBonusInfo(iBonus).getTechReveal()):
if CyGame().getSorenRandNum([b]1000[/b], "Placing Bonus") == 0:
pPlot.setBonusType(iBonus)
pCity = CyMap().findCity(pPlot.getX(), pPlot.getY(), pPlot.getOwner(), pPlot.getTeam(), False, False, -1, -1, CyCity())
CyInterface().addMessage(pPlot.getOwner(), False, gc.getDefineINT("EVENT_MESSAGE_TIME"), '[u]Corn has been discovered near %s[/u]' %(pCity.getName()), "AS2D_DISCOVERBONUS", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getBonusInfo(iBonus).getButton(), gc.getInfoTypeForString("COLOR_WHITE"), pPlot.getX(), pPlot.getY(), True, True)[/i]