Esempio n. 1
0
def prompt_player(actions):
    for index, action in enumerate(actions):
        ap_str = ''
        ap_costs = action.ap_costs
        if ap_costs > 0:
            ap_str = ' (' + str(ap_costs) + ' AP) '
        print('[' + str(index + 1) + '] ' + ap_str + str(action))
    return actions[get_int_input('> ', 1, len(actions)) - 1]
Esempio n. 2
0
def displayShop(soldier, ap):
    options = []
    print("Time: "+str(ap))
    options.append("Advance")
    print(len(options) + "Advance")
    if ap == 60:
        if textcom.meld >= 15:
            if not "Aim" in soldier.mods:
                options.append("AimBonus")
                print(len(options) + "(60 Time) (15m) Insta-Genemod: Depth"
                                     "Perception (+5 aim)")
            if not "AP" in soldier.mods:
                options.append("APBonus")
                print(len(options) + "(60 Time) (15m) Micro-Augment: Reflex"
                                     "Servomotors (+2 AP)")
            options.append("")
        if textcom.meld >= 20:
            if not "HP" in soldier.mods:
                options.append("HPBonus")
                print(len(options) + "(60 Time) (20m) Insta-Genemod:"
                                     "Muscle Regeneration (+5 HP)")
            if not "Nade" in soldier.mods:
                options.append("NadeBonus")
                print(len(options) + "(60 Time) (20m) Micro-Augment: Grenade"
                                     "Launcher (+2 Frag Grenades)")
    if ap >= 50:
        if not type(soldier.weapon) is LaserRifle() and elerium >= 20         \
           and textcom.fragments >= 40:
            options.append("LaserRifle")
            print(len(options) + "(40 Time) (20e) (40f) Get Laser Rifle")
            print("     (~4dmg), infinite ammo")
        if not type(soldier.weapon) is LaserCarbine() and elerium >= 10       \
           and textcom.fragments >= 30:
            options.append("LaserCarbine")
            print(len(options) + "(40 Time) (10e) (30f) Get Laser Carbine")
            print("     (~3dmg), infinite ammo, +10% aim")
    if ap >= 30:
        if textcom.meld >= 10 and textcom.fragments >= 10:
            options.append("Meds")
            print(len(options) + "(30 Time) (10m) (10f) Get Nano Serum")
        if textcom.alloy >= 4 and textcom.fragments >= 20:
            options.append("Frag")
            print(len(options) + "(30 Time) (20f) (4a) Get Frag Grenade")
    if ap >= 20:
        if textcom.meld >= 5:
            options.append("Heal")
            print(len(options) + "(20 Time) (5m) Recuperate (+1 HP)")
        options.append("Reload")
        print(len(options) + "(20 Time) Reload Weapon")
    options.append("Skip")
    print(len(options) + "("+str(ap)+" Time) Advance (Skip this Drop Zone)")
    selection = get_int_input('> ', 1, len(options) - 1)
    print('selected option ' + str(selection))
    return options[selection - 1]
Esempio n. 3
0
def main():
    textcom.globals_hack_init()

    print("Bradford: Welcome Commander. We've discovered an Alien Base, and "
          "it's your job to send someone out to deal with it.")
    print('Bradford: Choose a soldier from the 3 below to go on the mission.')

    barracks = []
    #generates soldiers
    for i in range(3):
        x = create_soldier(i)
        barracks.append(x)

    #displays a list of the soldiers
    for i in range(len(barracks)):
        print(str(i + 1) + ': ')
        barracks[i].print_summary()
        print()

    #forces you to pick only one soldier
    soldier = barracks[get_int_input('# ', 1, 3) - 1]

    if soldier.lastname == "Bradford":
        soldier.say("What? There must have been a mistake on the sheet, "
                    "Commander! You can't send --")
    elif soldier.lastname == "Van Doorn":
        soldier.say("I'm the Ops team?")
    else:
        soldier.say('Ready for duty, Commander!')

    scripted_levels = {
        1:  [create_alien(1, 1, 'Sectoid', nrank=0)],
        2:  [
                create_alien(1, 2, 'Sectoid', nrank=0),
                create_alien(1, 2, 'Sectoid', nrank=0)
            ],
        3:  [
                create_alien(1, 3, 'Sectoid', nrank=0),
                create_alien(1, 3, 'Sectoid', nrank=1)
            ],
        5:  ["Drop Zone"],
        10: ["Drop Zone"],
        15: ["Drop Zone"],
        20: ["Drop Zone"],
        30: [create_alien(1, 1, 'Muton', nrank=8, hp=50)]
    }

    game_map = create_map(NUMBER_OF_ROOMS, soldier, scripted_levels)
    # dump_map(game_map)

    # Yeah, I feel pretty bad about this, but currently I have no idea how to
    # make the current room index available for the death handler score
    # .calculation.  Maybe everything works out fine if components are
    # introduced.  I hope so.
    soldier.game_map = game_map

    #game loop, runs until your soldier is killed
    while soldier.alive == True:
        try:
            old_room = game_map.get_current_room()
            playerTurn(game_map)
            status(str(soldier) + ' is out of AP!')

            current_room = game_map.get_current_room()
            # Aliens are not allowed to act after the room was changed,
            # because they already scattered when the player entered the new
            # room.  Also, there is no need for an alien turn if there are
            # no more aliens in the room.
            if soldier.alive == True and old_room == current_room             \
               and len(current_room) > 0:
                print()
                print("--------------Alien Activity!--------------")
                print()
                time.sleep(1)
                alienTurn(game_map)
                print()
                print("--------------XCOM Turn--------------")
                print()
        except ( ValueError or IndexError ):
            pass
        if game_map.current_room == len(game_map.rooms):
            print("You have won the game!")
            break