from eNums import *
from Helpers import *
from Rebellion import *
#Constants#
MainHeader = "Senate Feature"
MainMessage = "This feature is specifically for Rome and gives them missions which can result in\
rewards or penalties. There are various different missions and conditions"
SenateHeader = "Senate"
tAfricaCoords1 = (0, 0)
tAfricaCoords2 = (0, 0)
tBritonCoords1 = (0, 0)
tBritonCoords2 = (0, 0)
tGaulCoords1 = (0, 0)
tGaulCoords2 = (0, 0)
tIberiaCoords1 = (0, 0)
tIberiaCoords2 = (0, 0)
tGermaniaCoords1 = (0, 0)
tGermaniaCoords2 = (0, 0)
tGreeceCoords1 = (0, 0)
tGreeceCoords2 = (0, 0)
tEgyptCoords1 = (0, 0)
tEgyptCoords2 = (0, 0)
## main functions
def getRandReward():
random = getRandNum(100)
if random >= 0 and random <= 11:
Gold(1000, eRome)
elif random >= 12 and random <= 23:
Unit(ePraetorian, getCapital(eRome), 2)
elif random >= 24 and random <= 35:
GoldenAge(6)
elif random >= 36 and random <= 47:
pass #happy
elif random >= 48 and random <= 59:
pass #upgrade
elif random >= 60 and random <= 71:
pass #build
elif random >= 72 and random <= 83:
pass #civic
elif random >= 84 and random <= 95:
pass #tech
else:
pass #city gift
def getRandDate():
random = getRandNum(100)
if random >= 0 and random <= 9:
date = #add date type
elif random >= 10 and random <= 9:
date = #add date type
elif random >= 20 and random <= 29:
date = #add date type
elif random >= 30 and random <= 39:
date = #add date type
elif random >= 40 and random <= 49:
date = #add date type
elif random >= 50 and random <= 59:
date = #add date type
elif random >= 60 and random <= 69:
date = #add date type
elif random >= 70 and random <= 79:
date = #add date type
elif random >= 80 and random <= 89:
date = #add date type
else:
date = #add date type
return date
def getRandEndDate():
random = getRandNum(100)
if random >= 0 and random <= 9:
enddate = #add date type
elif random >= 10 and random <= 9:
enddate = #add date type
elif random >= 20 and random <= 29:
enddate = #add date type
elif random >= 30 and random <= 39:
enddate = #add date type
elif random >= 40 and random <= 49:
enddate = #add date type
elif random >= 50 and random <= 59:
enddate = #add date type
elif random >= 60 and random <= 69:
enddate = #add date type
elif random >= 70 and random <= 79:
enddate = #add date type
elif random >= 80 and random <= 89:
enddate = #add date type
else:
enddate = #add date type
return date
def getReward(Reward, iReward):
if Reward == 1:
Gold(iReward, eRome)
elif Reward == 2:
Unit(ePraetorian, getCapital(eRome), iReward)
elif Reward == 3:
GoldenAge(iReward)
elif Reward == 4:
pass #happy
elif Reward == 5:
pass #upgrade
elif Reward == 6:
pass #build
elif Reward == 7:
pass #civic
elif Reward == 8:
pass #tech
else:
pass #city gift
def getPenalty(Penalty, iPenalty):
if Penalty == 1:
GoldDeduct(iPenalty, eRome)
elif Penalty == 2:
RebelUnit(eSwordsman, "add rome radius", iPenalty)
elif Penalty == 3:
pass #unhappy
elif Penalty == 4:
pass #dest
elif Penalty == 5:
pass #anarchy
else:
CivilWar()
# rewards
def Gold(iChange, ePlayer):
giveGold(iChange, ePlayer)
def Unit(eUnitType, tCoords, iNum):
spawnUnits(eRome, eUnitType, tCoords, iNum)
def GoldenAge(iTurns):
giveGoldenAge(eRome, iTurns)
def Happy():
pass
def UpgradeBuild():
pass
def Build():
pass
def FreeCivic():
pass
def FreeTech():
pass
def CitySelect():
pass
# penalties
def GoldDeduct(iChange, ePlayer):
giveGold(-iChange, ePlayer)
def RebelUnit(eUnitType, tCoords, iNum):
spawnUnits(eItalianRebels, eUnitType, tCoords, iNum)
def Unhappy():
pass
def BuildingDest():
pass
def Anarchy():
pass
def CivilWar():
STD = False #add standard conditioning
if STD:
lCities =
CivilWar.initCivilWar(instance("Rome"), lCities)
else:
lCities =
CivilWar.initCivilWar(instance("Rome"), lCities)
## data storage
def increaseMissionCounter():
iMissionCounter = getGlobalData("iMissionCounter")
setGlobalData("iMissionCounter", iMissionCounter + 1)
## classes
class Mission: #simple take city, like byzantium prompt
def __init__(self, tCityCoords, Message1, Message2, ePlayer, Message3, MessageHold, iStartYear = None, iEndYear = None\
, Reward = None, Penalty = None, iReward = None, iPenalty = None)
self.tCityCoords = tCityCoords
self.iReward = iReward
self.iPenalty = iPenalty
self.Message1 = Message1
self.Message2 = Message2
self.Player = ePlayer
self.Message3 = Message3
self.MessageHold = MessageHold
self.Start = iStartYear
self.End = iEndYear
self.Reward = Reward
self.Penalty = Penalty
self.iReward = iReward
self.iPenalty = iPenalty
def Condition(self):
if not self.Start and self.End == None:
if isDate(self.Start):
if isPlotOwner(self.tCityCoords, self.ePlayer) == False and isPlotCity(self.tCityCoords) == True:
showPopup(SenateHeader, self.Message1)
else:
Hold().Condition() #add parameters here
elif isDate(self.End):
if isPlotOwner(self.tCityCoords, self.ePlayer) and isPlotCity(self.tCityCoords):
showPopup(SenateHeader, self.Message2)
if self.Reward == None:
getRandReward()
increaseMissionCounter()
else:
getReward(self.Reward, self.iReward)
increaseMissionCounter()
else:
showPopup(SenateHeader, self.Message3)
if self.Penalty == None:
pass #getRandPenalty()
else:
getPenalty(self.Penalty, self.iPenalty)
else:
if isDate(getRandDate):
if isPlotOwner(getRandCoords, self.ePlayer) == False and isPlotCity(getRandCoords) == True:
showPopup(SenateHeader, "The Senate requests you take the city of %s1!")
else:
Hold().Condition()
elif isDate(getRandEndDate):
if isPlotOwner(getRandCoords, self.eRome) and isPlotCity(getRandCoords):
showPopup(SenateHeader, "you have succeeded in your mission!")
getRandReward()
increaseMissionCounter()
else:
showPopup(SenateHeader, "you have failed the senate!")
pass #getRandPenalty()
class Wonder(Mission):
class AreaControl(Mission):
class CivicChange(Mission):
class Peace(Mission):
class War(Mission):
class ExpandMelee(Mission):
class ExpandNavy(Mission):
class Hold(Mission):
##pre-defined missions
#Byzantium Prompt
iByzantiumStartYear = 1050
iByzantiumEndYear = 1350
iByzantiumGold = 1000
iByzantiumPenalty = 0
byzantiumMessage1 = "The glorius Senate of Rome requests that you take the city of Byzantium. If you take it and hold it at the end of 30 turns (turn 195) you will be greatly rewarded"
byzantiumMessage2 = "The glorius Senate of Rome wishes that you make sure that you keep control of Byzantium by the end of 30 turns (turn 195). If you successful, you will be rewarded!"
tByzantium = (46, 23)
Byzantium = Mission(tByzantium, byzantiumMessage1, "insert success message here", eRome, "insert fail message here", byzantiumMessage2, iByzantiumStartYear, iByzantiumEndYear, 1, 1, iByzantiumGold, iByzantiumPenalty)
Byzantium.Condition()
#date
#wonder built
#peace
#war
#military deficiency
#naval deficiency
#not owning area + date (could be rand)
#city not owned + date
#misc senate relation
def gloriusAchieve():
iDates = 3800 or 3000 or 0 #to be edited
if isDate(iDates):
if isAreaOwner(eRome, tAfricaCoords1, tAfricaCoords2) == True:
print "acheive africa at: "#, getDate()
if isAreaOwner(eRome, tBritonCoords1, tBritonCoords2) == True:
print "acheive briton at: "#, getDate()
if isAreaOwner(eRome, tGaulCoords1, tGaulCoords2) == True:
print "acheive gaul at: "#, getDate()
if isAreaOwner(eRome, tIberiaCoords1, tIberiaCoords2) == True:
print "acheive spain at: "#, getDate()
if isAreaOwner(eRome, tGermaniaCoords1, tGermaniaCoords2) == True:
print "acheive germania at: "#, getDate()
if isAreaOwner(eRome, tGreeceCoords1, tGreeceCoords2) == True:
print "acheive greece at: "#, getDate()
if isAreaOwner(eRome, tEgyptCoords1, tEgyptCoords2) == True:
print "acheive egypt at: "#, getDate()
else:
print "no acheive at: "#, getDate()