예제 #1
0
def random_event():
    x = random.randint(0, 50)
    if x in [0, 1]:
        print("\nThe grinding sound of metal gears unexpectedly catches your attention...")
        enemy = Entities.BasicEnemy(name='Drone', target=player)
        if random.randint(0, 1) < 1 == True:
            weapon = Items.Weapon(*Items.basic_primary_weapons[random.randint(0, len(Items.basic_primary_weapons) - 1)])
            enemy.equip_primary_weapon(weapon)
        active_enemies.append(enemy)
        time.sleep(2)
        print(f"You've wandered into a hidden {enemy.name}!")
        time.sleep(1)
        enemy.combat_turn()
        enemy_encounter(player, enemy)
    # elif x == 3:
    #     print()
    #     print("You happen upon some edible berries on the side of the road!")
    #     print("\tYour health is increased by 1!")
    #     time.sleep(2)
    #     player_health += 1
    # elif x == 4:
    #     print()
    #     print("An angry squirrel bites you on the ankle!")
    #     print("\tYour health is decreased by 1!")
    #     player_health -= 1
    #     time.sleep(2)
    else:
        return
예제 #2
0
def spawn_enemy(num): # NEEDS to be expanded to create multiple types
    for i in range(num):
        x = random.randint(3, height - 1)
        y = random.randint(3, width - 1)
        enemy = Entities.BasicEnemy(i=x, j=y)
        if random.randint(0, 1) < 1 == True:
            weapon = Items.Weapon(*Items.basic_primary_weapons[random.randint(0, len(Items.basic_primary_weapons) - 1)])
            enemy.equip_primary_weapon(weapon)
        print(f"A {enemy.name} enters the area.")
        active_enemies.append(enemy)
    print()
    time.sleep(1) # increase later