Esempio n. 1
0
def generateEscortMission(path, fg, fac, baseprice=500.0, jumpscale=1.2):
    ###
    if (isNotWorthy(fac)):
        return
    typ = fg_util.RandomShipIn(fg, fac)
    if typ in faction_ships.unescortable:
        return
    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"
    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))
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=500*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#Danke. Ich vertraue dir, dass du meinen Geschaeftspartner sicher geleiten wirst, bis er sein Ziel erreicht.#\n"
    elif isFixer<guildpct:
        creds*=1.5
        addstr+="#G#Escort#\n"
    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))
    # From plueschinger to avoid sometimes squadrons and sometimes not
    # we mention the squadrons or konvois later in the following message
    if "Squadron" == fg[-8:]:
         fg = fg[:-9]
    # end of plueschingers addition
    writedescription("Die %s %s in dem %s Konvoi benoetigt eine Eskorte nach %s. Die Belohnung fuer eine erfolgreiche Eskorte betraegt %d Kredite."%(fac,formatShip(typ),fg, processSystem(path[-1]),creds))
    writemissionname("Eskorte/Eskortiere den_%s aus der_%s Schwadron in das_%s System"%(fac,fg,processSystem(path[-1])),path,isFixerString(addstr))     
def generateEscortLocal(path,fg,fac):
    if (isNotWorthy(fac)):
        return
    typ = fg_util.RandomShipIn(fg,fac)
    if typ in faction_ships.unescortable:
        typ = faction_ships.unescortable[typ]
    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=3500.0*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#Unterhalte Dich mit dem Kaufmann#Danke. Ich vertraue dir, dass du meinen Geschaeftspartner sicher geleiten wirst, bis er sein Ziel erreicht.#\n"
    elif isFixer<guildpct:
        creds*=1.5
        addstr+="#G#Escort#\n"
    additionalinfo="zu dem Sprungpunkt"
    if (incoming):
        additionalinfo="von dem Sprungpunkt zu einer nahen Basis"
    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))
    # From plueschinger to avoid sometimes squadrons and sometimes not
    # we mention the squadrons or konvois later in the following message
    if "Squadron" == fg[-8:]:
         fg = fg[:-9]
    # end of plueschingers addition
    writedescription("Eine Eskorte %s ist erforderlich fuer die %s Klasse %s der Raumschiffe aus der %s Schwadron in diesem System. Angriffe von der %s Gruppe sind moeglich. Sie werden bezahlt mit %d Krediten, falls das Raumschiff in diesem Sternensystem ueberlebt, bis es seinen Zielort erreicht."%(additionalinfo,formatShip(typ),fac,fg,enfac,int(creds)))
    writemissionname("Eskorte/Eskortiere den_%s in dem_%s Konvoi"%(fac,fg),[path[-1]],isFixerString(addstr))
def generateDefendMission(path,
                          defendfg,
                          defendfac,
                          attackfg,
                          attackfac,
                          baseprice=float(
                              VS.vsConfig("dynamic_universe",
                                          "missions.defend.baseprice",
                                          "5000")),
                          jumpscale=float(
                              VS.vsConfig("dynamic_universe",
                                          "missions.defend.jumpscale", "1"))):
    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 + jumpscale * 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 "
    if len(path) == 1:
        mistype = 'IN-SYSTEM DEFEND'
    else:
        mistype = 'DEFEND'
    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))
    writemissionvars({'MISSION_TYPE': mistype})
Esempio n. 5
0
def generateBountyMission(path,
                          fg,
                          fac,
                          baseprice=1200.0,
                          runawayprice=1000.0,
                          diffprice=450.0,
                          capscale=4.0):
    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() >= .75)
    creds = (baseprice + runawayprice * runaway + diffprice * diff +
             syscreds * len(path))
    if (cap):
        creds *= capscale
    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"
    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
    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/on_%s_starship_in_%s" % (fac, processSystem(path[-1])),
            path, isFixerString(addstr))
def generateEscortLocal(path,
                        fg,
                        fac,
                        waveprice=float(
                            VS.vsConfig("dynamic_universe",
                                        "missions.escort.local.waveprice",
                                        "5500"))):
    if (isNotWorthy(fac)):
        return
    typ = fg_util.RandomShipIn(fg, fac)
    if typ in faction_ships.unescortable:
        typ = faction_ships.unescortable[typ]
    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 entrust that you will safely guide my collegue until he reaches 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"
    if len(path) == 1:
        mistype = 'IN-SYSTEM ESCORT'
    else:
        mistype = 'ESCORT'
    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))
    writemissionvars({'MISSION_TYPE': mistype})
def generateDefendMission (path,defendfg,defendfac, attackfg,attackfac):
    if (isNotWorthy(defendfac)):
        return
    #defendtyp = fg_util.RandomShipIn(defendfg,defendfac)
    attacktyp = fg_util.RandomShipIn(attackfg,attackfac)                    
    isbase=fg_util.BaseFGInSystemName(path[-1])==defendfg
    creds=1000
    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#Unterhalte Dich mit dem konfoederiertem Offizier#Danke. Dein Engagement wird den Konfoederierten auf lange Sicht helfen. Wir schaetzen die Unterstuetzung durch die Gemeinschaft der Kopfgeldjaeger sehr.#\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="Kriegs-"
    if quantity == 1:
        starship = "Raumschiff"
    else:
        starship = "Raumschiffen"
    # change faction names like pirates to piraten
    if "es" == attackfac[-2:]:
        attackfac = attackfac[:-1] + "n"
    writedescription("Eine %s Angriffsschwadron mit dem Namen %s ist mit der Absicht hierher gesprungen, eines von unseren %sSchiffen in dem %s System anzugreifen.\n Deine Aufgabe ist es, sie zu vernichten bevor sie unser Raumschiff eliminieren.\n Unser Geheimdienst vermutet, dass die Schwadron aus %d %s der %s Klasse besteht. Deine Belohnung betraegt %d Kredite."%(attackfac, attackfg, iscapitol, processSystem(path[-1]),quantity,starship,formatShip(attacktyp),creds))
    writemissionname("Schutz/Beschuetze die_%s vor den_%s"%(defendfac, attackfac),path,isFixerString(addstr))
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()>=.75)
    creds=1000+2000*runaway+500*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#Unterhalte Dich mit dem Kopfgeldjaeger#Wir bezahlen dich bei erfolgreicher Beendung der Mission. Und noch ein weiser Ratschlag auf deinen Weg -- Wir haben uns niemals getroffen."
        if (runaway):
            addstr += '#Ausserdem-- wir haben Informationen, dass das Angriffsziel ueber Deinen Angriff informiert sein koennte und bereit ist zu verschwinden. Beeil Dich!'
        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==1):
        diffstr="Es wird vermutet, dass das feindliche Schiff einen Geleitschutz von einem Raumschiff hat."
    if (diff>1):
        diffstr="Es wird vermutet, dass das feindliche Schiff einen Geleitschutz von %d Raumschiffen hat."%diff
    writedescription("Ein %s Raumschiff aus der %s hat unsere Operationen im %s System gestoert. Die Belohnung fuer die Vernichtung des genannten Schiffes betraegt %d Kredite. %s"%(formatShip(typ),fg, processSystem(path[-1]), finalprice,diffstr))
    # change faction names like pirates to piraten
    if "es" == fac[-2:]:
        fac = fac[:-1] + "n"
    if (cap):
        writemissionname ("Kopfgeldjagd/Jagd auf ein_%s_Kriegsschiff im_%s_System"%(fac,processSystem(path[-1])),path,isFixerString(addstr))
    else:
        writemissionname ("Kopfgeldjagd/Jagd auf ein_%s_Raumschiff im_%s_System"%(fac,processSystem(path[-1])),path,isFixerString(addstr))