Esempio n. 1
0
def hunt(env: GameEnvironment):
    if env.ammo < 40:
        print("Tough luck. You don't have enough ammo to hunt.")
        env.out_of_ammo = True
        return
    env.mileage -= 45
    score = _shoot(env)
    target = random() * 100
    if target < 13 * score:
        steady_print("You missed completely…and your dinner got away.\n")
    elif score <= 1.0:
        steady_print(
            "Right between the eyes…you got a big one!\nFull bellies tonight!\n"
        )
        env.ammo = int(env.ammo - 10 - (4 * random()))
        env.food = int(env.food + 26 + (3 * random()))
    else:
        steady_print("Nice shot…right on target…good eatin' tonight!\n")
        env.food = int(env.food + 24 - (2 * score))
        env.ammo = int(env.ammo - 10 - (3 * score))
Esempio n. 2
0
def bandits_attack(env: GameEnvironment):
    steady_print("Bandits attacking!\n")
    time.sleep(1)
    score = _shoot(env)
    env.ammo = env.ammo - 20 * score
    if env.ammo < 0:
        env.wallet = env.wallet / 3
        steady_print("You try to drive them off but you run out of bullets.\n"
                     "They grab as much cash as they can find.\n")
    if score > 1:
        steady_print("You get shot in the leg — \n")
        time.sleep(4)
        steady_print("and they grab one of your oxen.\n"
                     "Better have a doc look at your leg…and soon!\n")
        env.hurt = True
        env.oxen -= 10
        env.repairs -= 2
    else:
        steady_print("That was the quickest draw outside of Dodge City.\n"
                     "You got at least one and drove 'em off.\n")