本文整理汇总了Python中vsrandom.random函数的典型用法代码示例。如果您正苦于以下问题:Python random函数的具体用法?Python random怎么用?Python random使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了random函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: MakeBar
def MakeBar(concourse, concoursetext, bartext, BaseTexture, createCampaignFixers=True, defaultbtr=None, forcedefbtr=False, bartenderprefix="", bartenderloc=(.89725,.0813), patrons=[],fixerlocations=[(-0.80025, -1.0088, 0.776, 1.2416),(-0.0725, -0.4058125, 0.1758125, 0.5385)]):
if vsrandom.random()<.6:
forcedefbtr=True # remove me if you want random bartenders at random bars
import bartender
bartender.speaktimes=0
room0 = Base.Room ('Bar')
x=0
y=0
Base.Texture (room0, 'background', BaseTexture+'.spr', x, y)
for p in patrons:
if vsrandom.random()<.85:
Base.Texture(room0,str(p[0]),'bases/generic/'+str(p[0])+'.spr',float(p[1]),float(p[2]))
if defaultbtr:
if not forcedefbtr:
defaultbtr=bartenders[vsrandom.randrange(len(bartenders))]
Base.Texture(room0,'btr','bases/generic/'+bartenderprefix+'bartender'+str(defaultbtr)+'.spr', float(bartenderloc[0]),float(bartenderloc[1]))
if VS.networked():
Base.Python (room0, 'newscomp', -1, .7, .3, .3, 'Public Terminal', '#\nimport custom\ncustom.run("computer",[],None)',True)
else:
Base.Comp (room0, 'newscomp', -1, .7, .3, .3, 'Public Terminal', 'News')
Base.Link (room0, 'my_link_id', -0.998047, -0.997396, 1.99414, 0.119792, concoursetext ,concourse)
Base.Python (room0, 'talk', bartenderloc[0]-.16, bartenderloc[1]-.15,.3,.3,'Talk to the Bartender',bartext,0)
import fixers
func=fixers.CreateFixers
if not createCampaignFixers:
func=fixers.CreateMissionFixers
func(room0,[(fixerlocations[0][0],fixerlocations[0][1],fixerlocations[0][2],fixerlocations[0][3],"_1"),(fixerlocations[1][0],fixerlocations[1][1],fixerlocations[1][2],fixerlocations[1][3],"_2")])#add more locations?
return room0;
开发者ID:Ikesters,项目名称:vega-strike,代码行数:28,代码来源:bar.py
示例2: generateCleansweepMission
def generateCleansweepMission(path,numplanets,enemy,
pricescale = float(VS.vsConfig("dynamic_universe","missions.cleansweep.pricescale","16000")),
jumpscale = float(VS.vsConfig("dynamic_universe","missions.cleansweep.jumpscale","1.2")),
sweepmod = float(VS.vsConfig("dynamic_universe","missions.cleansweep.pricemod.sweep","4")),
capshipmod = float(VS.vsConfig("dynamic_universe","missions.cleansweep.pricemod.capship","4")),
forceattackmod = float(VS.vsConfig("dynamic_universe","missions.cleansweep.pricemod.forceattack","0.25"))
):
fighterprob=vsrandom.random()*.75+.25;
capshipprob=0.0
if (vsrandom.random()<.2):
capshipprob=vsrandom.random()*.25;
forceattack=vsrandom.randrange(0,2)
cleansweep=vsrandom.randrange(0,2)
minships=maxships=vsrandom.randrange(1,4)
creds = ( pricescale * (
1+
cleansweep*sweepmod+
capshipprob*capshipmod+
forceattack*forceattackmod
) * minships * fighterprob
+ jumpscale * syscreds * len(path) )
creds*=getPriceModifier(False)
addstr=""
isFixer=vsrandom.random()
if isFixer<fixerpct:
creds*=2
addstr+="#F#bases/fixers/confed.spr#Talk to the Confed Officer#Thank you. Your help makes space a safer place.#\n"
elif isFixer<guildpct:
creds*=1.5
if (cleansweep):
addstr+="#G#Bounty#\n"
else:
addstr+="#G#Patrol#\n"
missiontype="patrol_enemies"
additional=""
additionalinstructions=""
patrolorclean="Patrol"
dist=1000
if (cleansweep):
dist=1500
additional=",1"
patrolorclean="Clean_Sweep"
missiontype="cleansweep"
additionalinstructions+=" Eliminate all such forces encountered to receive payment."
if (capshipprob):
additionalinstructions+=" Capital ships are possibly in the area."
writemissionsavegame (addstr+"import %s\ntemp=%s.%s(0, %d, %d, %d, %s,'',%d,%d,%f,%f,'%s',%d%s)\ntemp=0\n"%(missiontype,missiontype,missiontype,numplanets, dist, creds, str(path),minships,maxships,fighterprob,capshipprob,enemy,forceattack,additional))
writedescription("Authorities would like a detailed scan of the %s system. We require %d nav locations be visited on the scanning route. The pay for this mission is %d. Encounters with %s forces likely.%s"%(processSystem(path[-1]),numplanets,creds,enemy,additionalinstructions))
ispoint="s"
if numplanets==1:
ispoint=""
if len(path)==1:
mistype = 'IN-SYSTEM ATTACK'
else:
mistype = 'ATTACK'
writemissionname("%s/%s_%d_Point%s_in_%s"%(patrolorclean,patrolorclean,numplanets,ispoint, processSystem(path[-1])),path,isFixerString(addstr))
writemissionvars( { 'MISSION_TYPE' : mistype } )
开发者ID:jowave,项目名称:Vegastrike-taose,代码行数:58,代码来源:dynamic_mission.py
示例3: generateBountyMission
def generateBountyMission(
path,
fg,
fac,
baseprice=float(VS.vsConfig("dynamic_universe", "missions.bounty.baseprice", "20000")),
runawayprice=float(VS.vsConfig("dynamic_universe", "missions.bounty.runaway", "5000")),
diffprice=float(VS.vsConfig("dynamic_universe", "missions.bounty.diffprice", "500")),
jumpscale=float(VS.vsConfig("dynamic_universe", "missions.bounty.jumpscale", "1")),
capscale=float(VS.vsConfig("dynamic_universe", "missions.bounty.capscale", "4")),
):
typ = fg_util.RandomShipIn(fg, fac)
cap = faction_ships.isCapital(typ)
makemissionharder = vsrandom.randrange(0, 2)
diff = vsrandom.randrange(0, adjustQuantityDifficulty(7)) + howMuchHarder(makemissionharder)
runaway = vsrandom.random() >= 0.75
creds = baseprice + runawayprice * runaway + diffprice * diff + jumpscale * syscreds * len(path)
if cap:
creds *= capscale
finalprice = creds * getPriceModifier(False)
addstr = ""
isFixer = vsrandom.random()
if isFixer < fixerpct:
finalprice *= 2
addstr += "#F#bases/fixers/hunter.spr#Talk with the Bounty Hunter#We will pay you on mission completion. And as far as anyone knows - we never met."
if runaway:
addstr += "#Also-- we have information that the target may be informed about your attack and may be ready to run. Be quick!"
addstr += "#\n"
elif isFixer < guildpct:
creds *= 1.5
addstr += "#G#Bounty#\n"
writemissionsavegame(
addstr
+ "import bounty\ntemp=bounty.bounty(0, 0, %g, %d, %d, '%s', %s, '', '%s','%s')\ntemp=0\n"
% (finalprice, runaway, diff, fac, str(path), fg, typ)
)
diffstr = ""
if diff > 0:
diffstr = " The ship in question is thought to have %d starships for protection." % diff
if len(path) == 1:
mistype = "IN-SYSTEM BOUNTY"
else:
mistype = "BOUNTY"
writedescription(
"A %s starship in the %s flightgroup has been harassing operations in the %s system. Reward for the termination of said ship is %d credits.%s"
% (formatShip(typ), fg, processSystem(path[-1]), finalprice, diffstr)
)
if cap:
writemissionname(
"Bounty/on_%s_Capital_Vessel_in_%s" % (fac, processSystem(path[-1])), path, isFixerString(addstr)
)
else:
writemissionname(
"Bounty/Bounty_on_%s_starship_in_%s" % (fac, processSystem(path[-1])), path, isFixerString(addstr)
)
writemissionvars({"MISSION_TYPE": mistype})
开发者ID:vegastrike,项目名称:Assets-Production,代码行数:56,代码来源:dynamic_mission.py
示例4: DeletePatrolPoint
def DeletePatrolPoint(self,num,nam):
import vsrandom
if (vsrandom.random()<self.encounterprob):
import faction_ships
fac=self.faction
if (type(fac) is list or type(fac) is tuple):
fac = fac[vsrandom.randrange(0,len(fac))]
dynfg=""
import fg_util
import VS
allfg=fg_util.AllFGsInSystem(fac,VS.getSystemFile())
if (len(allfg)):
dynfg = allfg[vsrandom.randrange(0,len(allfg))]
for i in range(vsrandom.randrange(self.minships,self.maxships+1)):
import launch
L=launch.Launch()
if self.fgname=="":
fgname="Patrol"
else:
fgname = self.fgname
L.fg = fgname
L.dynfg=dynfg
if (vsrandom.random()<self.capshipprob):
L.type=faction_ships.getRandomCapitol(fac)
else:
L.type=faction_ships.getRandomFighter(fac)
L.ai="default"
L.faction=fac
L.num=1
L.minradius=3000.0
L.maxradius=4000.0
if i == 0:
L.fgappend=""
else:
L.fgappend="_"+str(i)
try:
L.minradius*=faction_ships.launch_distance_factor
L.maxradius*=faction_ships.launch_distance_factor
except:
pass
if (self.patrolpoints[num]):
newun=L.launch(self.patrolpoints[num])
if (self.forceattack):
lead=newun.getFlightgroupLeader()
if (lead):
lead.SetTarget(self.you)
else:
newun.setFlightgroupLeader(newun)
newun.SetTarget(self.you)
newun.setFgDirective("A.")
self.Track(newun)
patrol.patrol.DeletePatrolPoint(self,num,nam)
开发者ID:ermo,项目名称:privateer_wcu,代码行数:52,代码来源:patrol_enemies.py
示例5: basicUnit
def basicUnit (un, diff):
i=0
for i in range(upgrades_weapons_default_weapon_count): #no unarmed ships, please
percent=un.upgrade(upgrades_weapons_default_weapon,i,0,0,1)
UpgradeEngine (un,diff)
UpgradeRadar (un,diff)
#UpgradeArmor (un,diff)
if ((vsrandom.random()<0.9) and (vsrandom.random()<(diff*5.0))):
UpgradeAfterburner(un,diff)
if ((vsrandom.random()<0.9) and (vsrandom.random()<(diff*5.0))):
percent=un.upgrade("jump_drive",i,i,0,1)
else:
percent=un.upgrade("jump_drive",i,i,0,1)
开发者ID:Ikesters,项目名称:vega-strike,代码行数:13,代码来源:ship_upgrades.py
示例6: generateBountyMission
def generateBountyMission(path, fg, fac):
typ = fg_util.RandomShipIn(fg, fac)
cap = faction_ships.isCapital(typ)
makemissionharder = vsrandom.randrange(0, 2)
diff = vsrandom.randrange(0, adjustQuantityDifficulty(7)) + howMuchHarder(makemissionharder)
runaway = vsrandom.random() >= 0.75
creds = 750 + 1000 * runaway + 450 * diff + syscreds * len(path)
if cap:
creds *= 4
finalprice = creds + syscreds * len(path)
finalprice *= getPriceModifier(False)
addstr = ""
isFixer = vsrandom.random()
if isFixer < fixerpct:
finalprice *= 2
addstr += "#F#bases/fixers/hunter.spr#Talk with the Bounty Hunter#We will pay you on mission completion. And as far as anyone knows-- we never met."
if runaway:
addstr += "#Also-- we have information that the target may be informed about your attack and may be ready to run. Be quick!"
addstr += "#\n"
elif isFixer < guildpct:
creds *= 1.5
addstr += "#G#Bounty#\n"
elif use_missioncomputer:
addstr += "#C#Bounty#\n"
writemissionsavegame(
addstr
+ mission_script_template
% dict(module="bounty", constructor="bounty", args=(0, 0, finalprice, runaway, diff, fac, path, "", fg, typ))
)
diffstr = ""
if diff > 0:
diffstr = " The ship in question is thought to have %d starships for protection." % diff
randCompany = GetRandomCompanyName()
bountyb = GetRandomBountyBrief()
composedBrief = bountyb.replace("$CL", randCompany)
composedBrief = composedBrief.replace("$MT", formatShip(typ))
composedBrief = composedBrief.replace("$DS", processSystem(path[-1]))
composedBrief = composedBrief.replace("$PY", str(int(finalprice)))
if len(path) == 1:
mistype = "IN-SYSTEM BOUNTY"
else:
mistype = "BOUNTY"
writedescription(composedBrief)
if cap:
writemissionname(
"Bounty/on_%s_Capital_Vessel_in_%s" % (fac, processSystem(path[-1])), path, isFixerString(addstr)
)
else:
writemissionname("Bounty/on_%s_starship_in_%s" % (fac, processSystem(path[-1])), path, isFixerString(addstr))
writemissionvars({"MISSION_TYPE": mistype})
开发者ID:bsmr-games,项目名称:Privateer-Gemini-Gold,代码行数:51,代码来源:dynamic_mission.py
示例7: basicUnit
def basicUnit(un, diff):
"""This sets up a blank unit with the basic upgrades needed for any sort of figthing"""
i = 0
while (i < 2): # two lasers
percent = un.upgrade("laser", i, i, 0, 1)
i = i + 1
UpgradeEngine(un, diff)
UpgradeRadar(un)
if ((vsrandom.random() < 0.9) and (vsrandom.random() < (diff * 5.0))):
UpgradeAfterburner(un, diff)
if ((vsrandom.random() < 0.9) and (vsrandom.random() < (diff * 5.0))):
percent = un.upgrade("jump_drive", i, i, 0, 1)
else:
percent = un.upgrade("jump_drive", i, i, 0, 1)
开发者ID:ermo,项目名称:privateer_wcu,代码行数:14,代码来源:ship_upgrades.py
示例8: upgradeUnit
def upgradeUnit(un, diff):
"""Handle the actual upgrading process on a unit based on difficulty"""
creds = 0.0
curmount = 0
mycargo = VS.Cargo("", "", 0, 0, 0, 0)
str = ""
debug.debug("Calling basicUnit(%s, %.2f)" % (un.getName(), float(diff)))
basicUnit(un, diff)
debug.debug("'- basicUnit returned")
mycargo = GetRandomHull() # ok now we get some hull upgrades
creds = upgradeHelper(un, mycargo, 0, creds, 1, 0)
mycargo = GetRandomArmor() # and some random armor
creds = upgradeHelper(un, mycargo, 0, creds, 1, 0)
inc = 0
rndnum = vsrandom.random() * 2
if (rndnum < diff):
# there is a small chance that you will get a repair system.
mycargo = GetRandomRepairSys()
creds = upgradeHelper(un, mycargo, 0, creds, 1, 0)
turretz = un.getSubUnits()
turretcount = 0
while (not turretz.isDone()):
turretcount += 1
turretz.advance()
#turretcount -= 1
debug.debug("Iterating through turrets...")
for i in range(turretcount):
for j in range(4):
mycargo = GetRandomTurret() # turrets as 3rd...
creds = upgradeHelper(un, mycargo, i, creds, 0, 0)
debug.debug("'- Done iterating through turrets.")
turretcount = diff*50
if (turretcount > 24):
turretcount = 24
elif (turretcount < 3):
turretcount = 3
debug.debug("Iterating through difficulty-based turretcount...")
for i in range(int(turretcount)):
for j in range(10):
if (vsrandom.random() < 0.66):
# weapons go on as first two items of loop
mycargo = GetRandomWeapon(diff)
else:
mycargo = GetRandomAmmo()
cont = mycargo.GetContent()
if (cont.find('tractor') == -1 and cont.find('repulsor') == -1 and cont.find("steltek_gun") == -1):
creds = upgradeHelper(un, mycargo, curmount, creds, 0, 1) # we pass this in to the credits...and we only loop through all mounts if we're adding a weapon
break
curmount += 1 # increase starting mounts hardpoint
debug.debug("'- Done interating through difficulty-based turretcount.")
开发者ID:ermo,项目名称:privateer_wcu,代码行数:50,代码来源:ship_upgrades.py
示例9: PlayMusik
def PlayMusik(forcechange=1, hostile_dist=0):
un = VS.getPlayer()
if (not un):
mpl (PEACELIST,PEACELIST,forcechange)
debug.info("PlayMusik: Peace (not un)")
else:
perfect = 1
#debug.debug("before 'uni = VS.getUnitList()'")
uni = VS.getUnitList()
#debug.debug("after 'uni = VS.getUnitList()'")
unlist = []
asteroid = 0
while (not uni.isDone()):
#debug.debug("before 'target = next(uni)'")
target = next(uni)
#debug.debug("after 'target = next(uni)'")
if not target.isNull():
#debug.debug("inside 'if not target.isNull():'")
ftmp = 2 * target.getRelation(un)
nam = target.getName().lower()
if un.getSignificantDistance(target) <= 2 * target.rSize() and ('afield' == nam[:6] or 'asteroid'== nam[:8]):
asteroid = 1
hdis = HOSTILE_AUTODIST
if (hostile_dist != 0):
hdis = hostile_dist
if (target.GetTarget() == un or (ftmp < 0 and un.getDistance(target) < hdis)):
unlist.append(target.getFactionName())
perfect = 0
if (perfect):
if asteroid and asteroidmisic != -1 and vsrandom.random() < .7:
mpl(asteroidmisic, PEACELIST, forcechange)
return
sys = VS.getSystemFile()
fact = VS.GetGalaxyFaction(sys)
if vsrandom.random() < .5:
fact = None
mpl(LookupTable(peacelist, fact), PEACELIST, forcechange)
debug.info("PlayMusik: Peace")
else:
ftmp = (un.FShieldData() + 2 * un.GetHullPercent() + un.RShieldData() - 2.8) * 2
fact = None
if len(unlist) and vsrandom.random() < .5:
fact = unlist[vsrandom.randrange(0, len(unlist))]
debug.info("faction: %s" % (fact))
if (ftmp < -.5):
mpl(LookupTable(paniclist, fact), BATTLELIST, forcechange)
debug.info("PlayMusik: Panic")
else:
mpl(LookupTable(battlelist, fact), BATTLELIST, forcechange)
debug.info("PlayMusik: Battle")
开发者ID:ermo,项目名称:privateer_wcu,代码行数:50,代码来源:dj_lib.py
示例10: PlayMusik
def PlayMusik(forcechange=1,hostile_dist=0):
global __enabled
un = VS.getPlayer()
if not un or not __enabled:
#mpl (PEACELIST,PEACELIST,forcechange)
#print "Ppeace"
pass
elif un.DockedOrDocking() not in [1,2]:
perfect=1
iter = VS.getUnitList()
target = iter.current()
unlist=[]
asteroid=0
while (iter.notDone()):
if (target):
ftmp = 2*target.getRelation(un)
nam=target.getName().lower()
if un.getSignificantDistance(target)<=2*target.rSize() and ('afield'==nam[:6] or 'asteroid'==nam[:8]):
asteroid=1
hdis = HOSTILE_AUTODIST
if (hostile_dist!=0):
hdis = hostile_dist
if (target.GetTarget()==un or (ftmp<0 and un.getDistance(target)<hdis)):
unlist.append(target.getFactionName())
perfect=0
iter.advance()
target=iter.current()
if (perfect):
if asteroid and asteroidmisic!=-1 and vsrandom.random()<.7:
mpl(asteroidmisic,PEACELIST,forcechange)
return
sys=VS.getSystemFile()
fact=VS.GetGalaxyFaction(sys)
if vsrandom.random()<.5:
fact=None
mpl(LookupTable(peacelist,fact),PEACELIST,forcechange)
print "peaCce"
else:
ftmp = (un.FShieldData()+2*un.GetHullPercent()+un.RShieldData()-2.8)*2
fact=None
if len(unlist) and vsrandom.random()<.5:
fact=unlist[vsrandom.randrange(0,len(unlist))]
print fact
if (ftmp<-.5):
mpl(LookupTable(paniclist,fact),BATTLELIST,forcechange)
print "paAnic"
else:
mpl(LookupTable(battlelist,fact),BATTLELIST,forcechange)
print "bSattle"
开发者ID:bsmr-games,项目名称:Privateer-Gemini-Gold,代码行数:49,代码来源:dj_lib.py
示例11: generateCargoMission
def generateCargoMission (path, numcargos,category, fac):
#if (isNotWorthy(fac)):
# return
if (vsrandom.random()<.25):
return
launchcap=0
if (not launchcap) and not isHabitable(path[-1]):
return
diff=vsrandom.randrange(0,adjustQuantityDifficulty(6))
creds=65*numcargos+145*diff+syscreds*len(path)+3250*(category[:10]=="Contraband")+5000*(category[:9]=="starships")
addstr=""
creds*=getPriceModifier(False)
isFixer=vsrandom.random()
if isFixer<fixerpct:
creds*=2
addstr+="#F#bases/fixers/merchant.spr#Talk to the Merchant#Thank you. I entrust you will make the delivery successfully.#\n"
elif isFixer<guildpct:
creds*=1.5
addstr+="#G#Cargo#\n"
elif use_missioncomputer:
addstr+="#C#Cargo#\n"
writemissionsavegame (addstr+mission_script_template % dict(
module='cargo_mission',
constructor='cargo_mission',
args=(fac,0,numcargos,diff,creds,launchcap,0,category,path,'')))
if (category==''):
category='generic'
randCompany = GetRandomCompanyName()
if (randCompany==''):
strStart = "We need to deliver some "
else:
strStart = randCompany+" seeks delivery of "
if len(path)==1:
mistype = 'IN-SYSTEM CARGO'
else:
mistype = 'CARGO'
brief = GetRandomCargoBrief()
if (brief<>''):
composedBrief = brief.replace('$CL',randCompany)
composedBrief = composedBrief.replace('$CG',formatCargoCategory(category))
composedBrief = composedBrief.replace(' $DB','')
composedBrief = composedBrief.replace('$DS',processSystem(path[-1]))
composedBrief = composedBrief.replace('$PY',str(int(creds)))
writedescription(composedBrief)
else:
writedescription(strStart+"%s cargo to the %s system. The mission is worth %d credits to us. You will deliver it to a base owned by the %s.%s"%(formatCargoCategory(category), processSystem(path[-1]),creds,fac,pathWarning(path,isFixer<guildpct)))
writemissionname("Cargo/Deliver_%s_to_%s"%(changecat(category),processSystem(path[-1])),path,isFixerString(addstr))
writemissionvars( { 'MISSION_TYPE' : mistype } )
开发者ID:bsmr-games,项目名称:Privateer-Gemini-Gold,代码行数:48,代码来源:dynamic_mission.py
示例12: launch_near
def launch_near(self,un):
if (VS.GetGameTime()<10):
print "hola!"
return
cursys=VS.getSystemFile()
# numsigs=universe.GetNumSignificantsForSystem(cursys)
for factionnum in range(faction_ships.getMaxFactions()-1):
faction=faction_ships.intToFaction(factionnum)
fglist=fg_util.FGsInSystem(faction,cursys)
if not len(fglist):
print 'no flight group for faction: '+faction+' in system '+cursys+'.'
continue
num=len(fglist)
print 'Probability numbers: ',num, fg_util.MaxNumFlightgroupsInSystem(cursys)#,numsigs
avg=float(num)/float(fg_util.MaxNumFlightgroupsInSystem(cursys))#/float(numsigs)
fortress_level=0
if cursys in faction_ships.fortress_systems:
foretress_level=faction_ships.fortress_systems[cursys]
avg*=(not (VS.GetRelation(VS.GetGalaxyFaction(cursys),faction)<0 and cursys in faction_ships.fortress_systems))*fortress_level+(1-fortress_level)
print 'Chance for %s ship: %g'%(faction, avg)
rndnum=vsrandom.random()
print 'Random number: %g; will generate ship: %d'%(rndnum,rndnum<avg)
if rndnum<avg:
#now we know that we will generate some ships!
flightgroup=fglist[vsrandom.randrange(len(fglist))]
typenumbers=fg_util.GetShipsInFG(flightgroup,faction)
print 'FG Name: "%s", ShipTypes: %s'%(flightgroup,str(typenumbers))
launch_recycle.launch_types_around(flightgroup,faction,typenumbers,'default',self.generation_distance*vsrandom.random()*0.9,un,self.generation_distance*vsrandom.random()*2,'')
开发者ID:bsmr-games,项目名称:Privateer-Gemini-Gold,代码行数:28,代码来源:random_encounters.py
示例13: loopbriefing
def loopbriefing(self):
size=len(self.JumpPoints())
time = VS.GetGameTime()
Briefing.setCamPosition((1.6*(time-self.begintime)*self.brief_stage,0.0,0.0))
if (((time-self.begintime)>=5.0) and self.added_warp):
self.jump_ani=Briefing.addShip("brief_warp",self.faction,(20.0*(self.brief_stage),self.rnd_y,79.5+self.rnd_y))
self.added_warp=0
if (((time-self.begintime)>=6.0)):
if (self.jump_ani!=0):
Briefing.removeShip(self.jump_ani)
self.jump_ani=0
if ((size==self.brief_stage) and ((time-self.begintime)>=6.0)):
self.brief_stage=size+1
self.added_warp=0
self.time=0.0
elif ((self.brief_stage>size) and ((time-self.begintime)>=11.0)):
return self.brief_you
elif (((time-self.begintime)>=6.0) and (self.brief_stage<size)):
self.added_warp=1
self.rnd_y=(vsrandom.random()*40.0-20.0)
Briefing.addShip("brief_jump",self.faction,(20.0*(self.brief_stage+1),self.rnd_y,79.6+self.rnd_y))
Briefing.enqueueOrder (self.brief_you,(20.0*(self.brief_stage+1) ,self.rnd_y,80.0+self.rnd_y) , 5.0)
self.begintime=time
myname=self.JumpPoints() [self.brief_stage]
VS.IOmessage (0,"cargo mission","briefing","You must go to the '%s' jump point" % (myname))
self.brief_stage+=1
return -1
开发者ID:ermo,项目名称:privateer_wcu,代码行数:27,代码来源:go_to_adjacent_systems.py
示例14: generateDefendMission
def generateDefendMission (path,defendfg,defendfac, attackfg,attackfac,
baseprice=1200.0
):
if (isNotWorthy(defendfac)):
return
#defendtyp = fg_util.RandomShipIn(defendfg,defendfac)
attacktyp = fg_util.RandomShipIn(attackfg,attackfac)
isbase=fg_util.BaseFGInSystemName(path[-1])==defendfg
creds=baseprice
minq = 1
maxq = adjustQuantityDifficulty(5)
makemissionharder=vsrandom.randrange(0,2)
quantity = vsrandom.randrange(minq,maxq)+howMuchHarder(makemissionharder)
reallydefend = "1"
if (vsrandom.randrange(0,4)==0):
reallydefend="0"
addstr=""
creds=creds*quantity+syscreds*len(path)
creds*=getPriceModifier(makemissionharder)
isFixer=vsrandom.random()
if isFixer<fixerpct:
creds*=2
addstr+="#F#bases/fixers/confed.spr#Talk to the Confed Officer#Thank you. Your defense will help confed in the long run. We appreciate the support of the bounty hunting community.#\n"
elif isFixer<guildpct:
creds*=1.5
addstr+="#G#Defend#\n"
writemissionsavegame(addstr+"import defend\ntemp=defend.defend('%s', %d, %d, 8000.0, 100000.0, %g, %s, %d, '%s', %s, '%s', '%s', '%s', '%s')\ntemp=0\n"%
(attackfac, 0, quantity, creds, reallydefend, isbase, defendfac, str(path), '',attackfg, attacktyp,defendfg))
iscapitol=""
if isbase:
iscapitol="capital "
writedescription("A %s assault wing named %s has jumped in and is moving for an attack on one of our %sassets in the %s system.\nYour task is to eradicate them before they eliminate our starship.\nIntelligence shows that they have %d starships of type %s. Your reward is %d credits."%(attackfac, attackfg, iscapitol, processSystem(path[-1]),quantity, formatShip(attacktyp),creds))
writemissionname("Defend/Defend_%s_from_%s"%(defendfac, attackfac),path,isFixerString(addstr))
开发者ID:ermo,项目名称:privateer_wcu,代码行数:33,代码来源:dynamic_mission.py
示例15: generateEscortLocal
def generateEscortLocal(path,fg,fac,
waveprice=3500.0
):
if (isNotWorthy(fac)):
return
typ = fg_util.RandomShipIn(fg,fac)
if typ in faction_ships.unescortable:
return
enfac = faction_ships.get_enemy_of(fac)
diff=vsrandom.randrange(1,4)
waves=vsrandom.randrange(0,5-diff)
incoming=vsrandom.randrange(0,2)
enfg =fg_util.AllFGsInSystem(enfac,path[-1])
creds=waveprice*diff*(1+waves);
if (len(enfg)):
enfg=enfg[vsrandom.randrange(0,len(enfg))]
else:
enfg=''
isFixer=vsrandom.random()
addstr=""
if isFixer<fixerpct:
creds*=2
addstr+="#F#bases/fixers/merchant.spr#Talk to the Merchant#Thank you. I trust that you will safely escort my colleague to the destination.#\n"
elif isFixer<guildpct:
creds*=1.5
addstr+="#G#Escort#\n"
additionalinfo="to the jump point"
if (incoming):
additionalinfo="from the jump point to a nearby base"
writemissionsavegame(addstr+"import escort_local\ntemp=escort_local.escort_local('%s',0,%d,%d,500,%d,%d,'%s',(),'','%s','','%s','%s')"%(enfac,diff,waves,creds,incoming,fac,enfg,fg,typ))
writedescription("Escort %s is required for the %s type %s starship from the %s flightgroup in this system. Attacks from the %s faction are likely. You will be paid %d credits if the starship survives in this starsystem until it reaches its destination."%(additionalinfo,formatShip(typ),fac,fg,enfac,int(creds)))
writemissionname("Escort/Escort_%s_%s"%(fac,fg),[path[-1]],isFixerString(addstr))
开发者ID:ermo,项目名称:privateer_wcu,代码行数:32,代码来源:dynamic_mission.py
示例16: Execute
def Execute(self):
generate_dyn_universe.KeepUniverseGenerated()
dynamic_battle.UpdateCombatTurn()
if (self.cur_player>=len(self.players)):
self.AddPlayer()
self.cur=self.players[self.cur_player]
if (self.cur.curquest<len(self.cur.quests)):
if (self.cur.quests[self.cur.curquest].Execute()):
self.cur.curquest+=1
else:
del self.cur.quests[self.cur.curquest]
else:
self.cur.curquest=0
un = self.decideMode ()
if (self.cur.curmode!=self.cur.lastmode):
#lastmode=curmode#processed this event don't process again if in critical zone
if ((self.spawning or (vsrandom.random()<(self.fighterprob*self.cur.UpdatePhaseAndAmplitude()))) and un):
debug.debug("curmodechange %d in progress" % (self.cur.curmode))
if (VS.vsConfig("physics","spawn_units_close","false")=="true" and not self.atLeastNInsignificantUnitsNear (un,self.min_num_ships)):
#determine whether to launch more ships next to significant thing based on ships in that range
debug.debug("launch near")
self.launch_near (VS.getPlayerX(self.cur_player))
self.spawning=1
else:
self.cur.lastmode=self.cur.curmode
self.spawning=0
debug.debug("curmodechange %d ended" % (self.cur.curmode))
else:
self.cur.lastmode=self.cur.curmode
self.spawning=0
debug.debug("curmodechange %d ended" % (self.cur.curmode))
self.cur_player+=1
if (self.cur_player>=VS.getNumPlayers()):
self.cur_player=0
VS.setMissionOwner(self.cur_player)
开发者ID:jowave,项目名称:Vegastrike-taose,代码行数:35,代码来源:random_encounters.py
示例17: generateEscortMission
def generateEscortMission (path,fg,fac,
baseprice = float(VS.vsConfig("dynamic_universe","missions.escort.waveprice","500")),
jumpscale = float(VS.vsConfig("dynamic_universe","missions.escort.jumpscale","0.5"))
):
###
if (isNotWorthy(fac)):
return
typ = fg_util.RandomShipIn(fg,fac)
if typ in faction_ships.unescortable:
typ = faction_ships.unescortable[typ]
diff=vsrandom.randrange(0,6)
creds=baseprice*diff+jumpscale*syscreds*len(path)
creds*=getPriceModifier(False)
addstr=""
isFixer=vsrandom.random()
if isFixer<fixerpct:
creds*=2
addstr+="#F#bases/fixers/merchant.spr#Talk to the Merchant#Thank you. I entrust that you will safely guide my collegue until you reach the destination.#\n"
elif isFixer<guildpct:
creds*=1.5
addstr+="#G#Escort#\n"
if len(path)==1:
mistype = 'IN-SYSTEM ESCORT'
else:
mistype = 'ESCORT'
writemissionsavegame (addstr+"import escort_mission\ntemp=escort_mission.initrandom('%s', %d, %g, 0, 0, %s, '','%s','%s')\ntemp=0\n"%(fac, diff, float(creds), str(path),fg,typ))
writedescription("The %s %s in the %s flightgroup requres an escort to %s. The reward for a successful escort is %d credits."%(fac,formatShip(typ),fg, processSystem(path[-1]),creds))
writemissionname("Escort/Escort_%s_%s_to_%s"%(fac,fg,processSystem(path[-1])),path,isFixerString(addstr))
writemissionvars( { 'MISSION_TYPE' : mistype } )
开发者ID:jowave,项目名称:Vegastrike-taose,代码行数:29,代码来源:dynamic_mission.py
示例18: generatePatrolMission
def generatePatrolMission (path, numplanets,
planetprice = float(VS.vsConfig("dynamic_universe","missions.patrol.planetprice","100")),
baseprice = float(VS.vsConfig("dynamic_universe","missions.patrol.baseprice","2400")),
jumpscale = float(VS.vsConfig("dynamic_universe","missions.patrol.jumpscale","1"))
):
dist=400
creds = numplanets*planetprice+baseprice+jumpscale*syscreds*len(path)
creds*=getPriceModifier(False)
addstr=""
isFixer=vsrandom.random()
if isFixer<fixerpct:
creds*=2
addstr+="#F#bases/fixers/confed.spr#Talk to the Confed Officer#Thank you. Your help makes space a safer place.#\n"
elif isFixer<guildpct:
creds*=1.5
addstr+="#G#Patrol#\n"
writemissionsavegame (addstr+"import patrol\ntemp=patrol.patrol(0, %d, %d, %d, %s)\ntemp=0\n"%(numplanets, dist, creds, str(path)))
writedescription("Insystem authorities would like a detailed scan of the %s system. We require %d nav locations be visited on the scanning route. The pay for this mission is %d."%(processSystem(path[-1]),numplanets,creds))
ispoint="s"
if numplanets==1:
ispoint=""
if len(path)==1:
mistype = 'IN-SYSTEM PATROL'
else:
mistype = 'PATROL'
writemissionname("Patrol/Patrol_%d_Point%s_in_%s"%(numplanets,ispoint, processSystem(path[-1])),path,isFixerString(addstr))
writemissionvars( { 'MISSION_TYPE' : mistype } )
开发者ID:jowave,项目名称:Vegastrike-taose,代码行数:27,代码来源:dynamic_mission.py
示例19: generateEscortMission
def generateEscortMission (path,fg,fac):
###
if (isNotWorthy(fac)):
return
typ = fg_util.RandomShipIn(fg,fac)
if typ in faction_ships.unescortable:
typ = faction_ships.unescortable[typ]
diff=vsrandom.randrange(0,6)
creds=250*diff+1.2*syscreds*len(path)
creds*=getPriceModifier(False)
addstr=""
isFixer=vsrandom.random()
if isFixer<fixerpct:
creds*=2
addstr+="#F#bases/fixers/merchant.spr#Talk to the Merchant#Thank you. I entrust that you will safely guide my collegue until you reach the destination.#\n"
elif isFixer<guildpct:
creds*=1.5
addstr+="#G#Escort#\n"
elif use_missioncomputer:
addstr+="#C#Escort#\n"
if len(path)==1:
mistype = 'IN-SYSTEM ESCORT'
else:
mistype = 'ESCORT'
writemissionsavegame (addstr+mission_script_template % dict(
module='escort_mission',
constructor='escort_mission',
args=(fac,diff,float(creds),0,0,path,'',fg,typ)))
writedescription("The %s %s in the %s flightgroup requres an escort to %s. The reward for a successful escort is %d credits."%(fac,formatShip(typ),fg, processSystem(path[-1]),creds))
writemissionname("Escort/Escort_%s_%s_to_%s"%(fac,fg,processSystem(path[-1])),path,isFixerString(addstr))
writemissionvars( { 'MISSION_TYPE' : mistype } )
开发者ID:bsmr-games,项目名称:Privateer-Gemini-Gold,代码行数:31,代码来源:dynamic_mission.py
示例20: generateWingmanMission
def generateWingmanMission(fg, faction):
numships=vsrandom.randrange(1,4)
creds=10000+15000*numships
writemissionsavegame ('#\n' + mission_script_template % dict(
module='wingman',
constructor='wingman',
args=(creds,faction,numships,0)))
s="A pilot"
EorA="a"
are="is"
if numships > 1:
s=str(numships)+" pilots"
EorA="e"
are="are"
isFixer=vsrandom.random()
if isFixer<fixerpct and fixer_has_wingman:
creds*=2
addstr+="#F#bases/fixers/merchant.spr#Talk to t
|
请发表评论