当前位置: 首页>>代码示例>>Python>>正文


Python vsrandom.randrange函数代码示例

本文整理汇总了Python中vsrandom.randrange函数的典型用法代码示例。如果您正苦于以下问题:Python randrange函数的具体用法?Python randrange怎么用?Python randrange使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了randrange函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: generateRescueMission

def generateRescueMission(
    path,
    rescuelist,
    totmaxprice=int(VS.vsConfig("dynamic_universe", "missions.rescue.totmaxprice", "21000")),
    shipminprice=int(VS.vsConfig("dynamic_universe", "missions.rescue.pership.minprice", "4041")),
    shipmaxprice=int(VS.vsConfig("dynamic_universe", "missions.rescue.pership.maxprice", "8640")),
    jumpminprice=int(VS.vsConfig("dynamic_universe", "missions.rescue.perjump.minprice", "4041")),
    jumpmaxprice=int(VS.vsConfig("dynamic_universe", "missions.rescue.perjump.maxprice", "8640")),
):
    makemissionharder = vsrandom.randrange(0, 2)
    numships = vsrandom.randrange(1, adjustQuantityDifficulty(6)) + howMuchHarder(makemissionharder)
    creds = numships * vsrandom.randrange(shipminprice, shipmaxprice)
    creds += len(path) * vsrandom.randrange(jumpminprice, jumpmaxprice)
    creds = min(totmaxprice, creds)
    creds *= getPriceModifier(makemissionharder != 0)
    if len(path) == 1:
        mistype = "IN-SYSTEM RESCUE"
    else:
        mistype = "RESCUE"
    writemissionsavegame(
        "import rescue\nntemp=rescue.rescue(%d,0,'%s',%d,'%s','%s',%s)\nntemp=0"
        % (creds, rescuelist[0], numships, rescuelist[2], rescuelist[1], str(path))
    )
    writedescription(
        "SOS! This is an ejected %s pilot under attack by at least %d %s craft. I request immediate assistance to the %s system and will offer %d credits for a safe return to the local planet where I may recover."
        % (rescuelist[0], numships, rescuelist[2], processSystem(path[-1]), creds)
    )
    writemissionname("Rescue/Rescue_%s_from_%s_ships" % (rescuelist[0], rescuelist[2]), path, 0)
    writemissionvars({"MISSION_TYPE": mistype})
开发者ID:vegastrike,项目名称:Assets-Production,代码行数:29,代码来源:dynamic_mission.py

示例2: 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

示例3: launch_waves_around_area

def launch_waves_around_area(fgname, faction, type, ai, nr_ships, nr_waves, r1, r2, pos, logo="", useani=1, skipdj=0):
    pos = (
        (pos[0] + vsrandom.uniform(r1, r2) * vsrandom.randrange(-1, 2, 2)),
        (pos[1] + vsrandom.uniform(r1, r2) * vsrandom.randrange(-1, 2, 2)),
        (pos[2] + vsrandom.uniform(r1, r2) * vsrandom.randrange(-1, 2, 2)),
    )
    return launch(fgname, faction, type, ai, nr_ships, nr_waves, pos, logo, useani, skipdj)
开发者ID:vegastrike,项目名称:Assets-Production,代码行数:7,代码来源:launch.py

示例4: 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

示例5: GetDiffCargo

def GetDiffCargo(diff, base_category, all_category, use_all, dont_use_all=0):
    """ This function makes a string based on the difficulty.

        In this way it can be restricted to light or medium mounts
        when the difficulty is low, avoiding unaffordable weapons

    """
    cat = all_category
    ch = dont_use_all
    #this makes ch only 1
    if (diff <= 0.2):
        ch = 1
    elif (diff <= 0.4):
        ch = 2 - vsrandom.randrange(dont_use_all, 3)
    elif ((diff <= 0.7) or use_all):
        ch = 3 - vsrandom.randrange(dont_use_all, 4)
    # ch is 0 if it is any upgrades/Weapon
    # otherwise it could be light, medium or heavy or some random set
    # between Light and X (light, medium, heavy)
    if (ch == 1):
        cat = "%sLight" % (base_category)
    elif (ch == 2):
        cat = "%sMedium" % (base_category)
    elif (ch == 3):
        cat = "%sHeavy" % (base_category)
    debug.debug("Category: %s" % (cat))
    return cat
开发者ID:ermo,项目名称:privateer_wcu,代码行数:27,代码来源:ship_upgrades.py

示例6: LookForTrouble

def LookForTrouble (faction):
    global lftiter
    key = fg_util.MakeFactionKey(faction)
    numfg=Director.getSaveStringLength(fg_util.ccp,key)
    if (lftiter>=numfg):
        lftiter=0
        if (0 and numfg):
            AddFighterTo(Director.getSaveString(fg_util.ccp,key,vsrandom.randrange(0,numfg)),faction,False)
        if faction in faction_ships.fighterProductionRate:
            AddFighterTo("Alpha",faction,True)
        return 0
    i = Director.getSaveString(fg_util.ccp,key,lftiter)
    lftiter+=1
    sys = fg_util.FGSystem (i,faction)
    citizen=VS.isCitizen(faction)
    if (sys!='nil'):
        if not citizen:
            enfac = faction_ships.get_enemy_of(faction)
            foundanyone=0
            l=fg_util.AllFGsInSystem(enfac,sys)
            j=vsrandom.randrange(0,len(l)+3)
            if (j<len(l)):
                foundanyone=1 #FIXME include some sort of measure "can I win"
                if (vsrandom.randrange(0,5)==0):
                    initiateAttack(i,faction,sys,l[j],enfac)
            elif (vsrandom.randrange(0,3)==0):
                randomMovement (i,faction)
        elif (vsrandom.randrange(0,3)==0):
            randomMovement (i,faction)
    return 1
开发者ID:jowave,项目名称:Vegastrike-taose,代码行数:30,代码来源:dynamic_battle.py

示例7: launch_new_wave

 def launch_new_wave(self):
     un = VS.getPlayer()
     if (vsrandom.randrange(0,4)==0):
         if (un):
             currentsystem = VS.getSystemFile()
             numadj=VS.GetNumAdjacentSystems(currentsystem)
             if (numadj):
                 cursys=VS.GetAdjacentSystem(currentsystem,vsrandom.randrange(0,numadj))
             else:
                 cursys = 'enigma_sector/heavens_gate'
             debug.info("TJ: jumping to "+cursys)
             un.JumpTo(cursys)
         else:
             debug.info("TJ: jumping to [ERROR: you are null]")
     side = vsrandom.randrange(0,2)
     faction="confed"
     ai = vsrandom.randrange(0,6)
     if (0 and ai==0):
         ai = "printhello.py"
     else:
         ai = "default"
     if (side==0):
         faction=faction_ships.get_enemy_of("confed")
     else:
         faction=faction_ships.get_friend_of("confed")
     launched = launch.launch_wave_around_unit ("Shadow",faction,faction_ships.getRandomFighter(faction),ai,vsrandom.randrange(1,10),100.0,2000.0,VS.getPlayer(),'')
     if (vsrandom.randrange(0,10)==0):
         launch.launch_wave_around_unit ("ShadowCap",faction,faction_ships.getRandomCapitol(faction),ai,1,2000.0,4000.0,VS.getPlayer(),'')
开发者ID:ermo,项目名称:privateer_wcu,代码行数:28,代码来源:total_war.py

示例8: launch_new_wave

 def launch_new_wave(self):
     un = VS.getPlayer()
     if (vsrandom.randrange(0,4)==0):
         if (un):
             currentsystem = VS.getSystemFile()
             numadj=VS.GetNumAdjacentSystems(currentsystem)
             if (numadj):
                 cursys=VS.GetAdjacentSystem(currentsystem,vsrandom.randrange(0,numadj))
             else:
                 cursys = 'enigma_sector/heavens_gate'
             debug.info("TJ: jumping to "+cursys)
             un.JumpTo(cursys)
         else:
             debug.warn("TJ: jumping to [ERROR: you are null]")
         return
     else:
         siglist=universe.significantUnits()
         if len(siglist)==0:
             debug.info("TJ: siglist empty")
             return
         sig=siglist[vsrandom.randrange(0,len(siglist))]
         if (not sig):
             debug.info("TJ: sig null")
             return
         debug.info("TJ: autopiloting to "+sig.getName())
         un.AutoPilotTo(sig,True)
         un.SetTarget(sig)
开发者ID:ermo,项目名称:privateer_wcu,代码行数:27,代码来源:total_jump.py

示例9: AddSysDict

def AddSysDict (cursys):
    #pick random fighter from insysenemies with .3 probability OR pick one from the friendlies list.
#       debug.debug('Addsysdict')
    sysfaction=VS.GetGalaxyFaction(cursys)
    global fgnames, fglists
    i=0
    AddBasesToSystem(sysfaction, cursys)
    for i in range (1+vsrandom.randrange(fg_util.MinNumFlightgroupsInSystem(cursys)-1,fg_util.MaxNumFlightgroupsInSystem(cursys))): #number of fgs in a system.
        faction=sysfaction
        friendly=0
        if vsrandom.random()<.3 or sysfaction=='unknown' or sysfaction=='':
            faction=faction_ships.get_rabble_of(sysfaction)
        else:
            faction=faction_ships.get_friend_of(sysfaction)
            if (faction==sysfaction):
                friendly=1
            if (sysfaction in faction_ships.production_centers):
                if (cursys in faction_ships.production_centers[sysfaction]):
                    friendly=2
            #if (friendly):
            #    debug.debug(faction+" "+sysfaction+" "+cursys)
        factionnr=faction_ships.factionToInt(faction)
        global maxshipsinfg
        typenumbertuple=GenerateFgShips(vsrandom.randrange(maxshipsinfg)+1,factionnr,friendly)
        fgname=GetNewFGName(faction)
        fg_util.AddShipsToFG (fgname,faction,typenumbertuple,cursys)
    return i
开发者ID:ermo,项目名称:privateer_wcu,代码行数:27,代码来源:generate_dyn_universe.py

示例10: AddFighterTo

def AddFighterTo(fgname,fac,isNew=False):
    sys = VS.getSystemFile()
    #print 'add fighter'
    import generate_dyn_universe
    numsystems = generate_dyn_universe.systemcount[fac]
    if (VS.GetGalaxyFaction(sys)!=fac):
        try:
            homeworlds=faction_ships.production_centers
        except:
            homeworlds=faction_ships.homeworlds
        if fac in homeworlds:
            if type(homeworlds[fac])==type(""):
                sys=homeworlds[fac]
            else:
                sys=homeworlds[fac][vsrandom.randrange(0,len(homeworlds[fac]))]
    numfighters = int(generate_dyn_universe.XProductionRate(fac,faction_ships.fighterProductionRate)*numsystems)
    try:
        if fac in faction_ships.staticFighterProduction:
            numfighters+=faction_ships.staticFighterProduction[fac]
    except:
        pass
    if (numfighters<1):
        if (vsrandom.uniform(0,1)<numfighters):
            numfighters=1
    #print "Generating "+str(numfighters)+ " fighters for "+fac+" at "+sys
    if isNew:
        fgk=fg_util.AllFGsInSystem(fac,sys)        
        if len(fgk):
            fgname=fgk[vsrandom.randrange(0,len(fgk))]
            stat=6
            if fac in faction_ships.fightersPerFG:
                stat=faction_ships.fightersPerFG[fac]
            elif "default" in faction_ships.fightersPerFG:
                stat=faction_ships.fightersPerFG["default"]
            if fg_util.NumShipsInFG(fgname,fac)+numfighters<=numfighters+stat:
                isNew=False
        if isNew:
            fgname=generate_dyn_universe.GetNewFGName(fac)
    if numfighters>=1:
        fg_util.AddShipsToFG (fgname,fac,((faction_ships.getRandomFighter(fac),int(numfighters)),),sys)
    numcapships = generate_dyn_universe.XProductionRate(fac,faction_ships.capitalProductionRate)*numsystems
    if (numcapships<1):
        if (vsrandom.uniform(0,1)>numcapships):
            return
        numcapships=1
    sys = fg_util.FGSystem(fgname,fac)
    if (1 or VS.GetGalaxyFaction(sys)!=fac):
        try:
            homeworlds=faction_ships.production_centers
        except:
            homeworlds=faction_ships.homeworlds
        if fac in homeworlds:
            if type(homeworlds[fac])==type(""):
                sys=homeworlds[fac]
            else:
                sys=homeworlds[fac][vsrandom.randrange(0,len(homeworlds[fac]))]
    cap =faction_ships.getRandomCapitol(fac)
    #print "Generating "+str(numcapships)+ " capship "+cap+" for "+fac+" at "+sys
    fg_util.AddShipsToFG(fgname,fac,((cap,int(numcapships)),),sys)
开发者ID:bsmr-games,项目名称:Privateer-Gemini-Gold,代码行数:59,代码来源:dynamic_battle.py

示例11: numPatrolPoints

def numPatrolPoints(sysname):
    try:
        import faction_ships
        mmax=faction_ships.numPatrolPoints[sysname]
        # print "system max "+sysname+" "+str(mmax)
        return vsrandom.randrange(4,mmax+1)
    except:
        return vsrandom.randrange(4,10)
开发者ID:bsmr-games,项目名称:Privateer-Gemini-Gold,代码行数:8,代码来源:dynamic_mission.py

示例12: 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

示例13: 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

示例14: MakeContraband

def MakeContraband(which):
    last_constructor[which] = cargo_mission.cargo_mission
    numsys=vsrandom.randrange(2,5)
    jumps=universe.getAdjacentSystems(VS.getSystemFile(),numsys)[1]
    diff=vsrandom.randrange(0,3)
    creds=numsys*2500+diff*800
    last_args[which] = ('pirates', 0, 6, diff,creds, 1, 1200, 'Contraband',jumps)
    last_briefing[0][which] = 'We need some...*cough*... cargo delivered to some of our pirates in a nearby system: '+ Jumplist(jumps)+ ' It\'d be preferable if ye kept the ole po\' off yo back durin the run. Will ya do it for '+str(creds)+' creds?'
    last_briefing[1][which] = 'Thanks pal; keep it on the d&l if you know my meanin.'
    return ("bases/fixers/pirate.spr","Talk with the Pirate")
开发者ID:ermo,项目名称:privateer_wcu,代码行数:10,代码来源:mission_lib.py

示例15: generateRescueMission

def generateRescueMission(path,rescuelist):
    makemissionharder=vsrandom.randrange(0,2)
    numships = vsrandom.randrange(1,adjustQuantityDifficulty(6))+howMuchHarder(makemissionharder)
    creds = (numships+len(path))*vsrandom.randrange(1041,1640)
    creds*=getPriceModifier(makemissionharder!=0)
    if (creds>20000):
        creds=21000
    writemissionsavegame("import rescue\nntemp=rescue.rescue(%d,0,'%s',%d,'%s','%s',%s)\nntemp=0"%(creds,rescuelist[0],numships,rescuelist[2],rescuelist[1],str(path)))
    writedescription("SOS! This is an ejected %s pilot under attack by at least %d %s craft. I request immediate assistance to the %s system and will offer %d credits for a safe return to the local planet where I may recover."%(rescuelist[0],numships,rescuelist[2],processSystem(path[-1]),creds))
    writemissionname("Rescue/Rescue_%s_from_%s_ships"%(rescuelist[0],rescuelist[2]),path,0)
开发者ID:ermo,项目名称:privateer_wcu,代码行数:10,代码来源:dynamic_mission.py


注:本文中的vsrandom.randrange函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。