def wild_animals(env: GameEnvironment): steady_print( "You're sound asleep and you hear a noise…get up to investigate.\n") time.sleep(3) steady_print("It's wild animals! They attack you!\n") score = _shoot(env) if env.ammo < 40: steady_print("You're almost out of ammo; can't reach more.\n" "The wolves come at you biting and clawing.\n") env.hurt = True you_lose_sick(env) if score <= 2: steady_print("Nice shooting, pardner…They didn't get much.\n") else: steady_print( "Kind of slow on the draw. The wolves got at your food and clothes.\n" ) env.ammo -= 20 * score env.clothes -= 2 * score env.food -= 4 * score
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")