Ejemplo n.º 1
0
  def display_main_menu():
    tags_explanation_colour = Colours.fg.yellow

    clear()
    System.print_title("ARTIFAX")

    print(f"""
{Colours.heading("Your Health:")} {Colours.fg.green}{entities.new_player.current_health} / {entities.new_player.max_health}
{Colours.heading("Your Location:")} {entities.new_player.current_location.name_string}
{Colours.heading("Your Armour:")} {entities.new_player.armour.name_string}
{Colours.heading("Your Weapon:")} {entities.new_player.weapon.name_string}
{Colours.heading("Gold Coins:")} {Colours.fg.yellow}{entities.new_player.gold_coins}
{Colours.heading("Artifacts Collected:")} {Colours.fg.orange}{entities.new_player.check_artifacts_amount()} / {entities.new_player.total_artifacts}

{Colours.fg.orange + Colours.underline}
Things You Can Do:{Colours.reset}
{Colours.tag("ex")} {tags_explanation_colour}Explore The Wilderness
{Colours.tag("slep")} {tags_explanation_colour}Sleep To Regenerate Your Health
{Colours.tag("trv")} {tags_explanation_colour}Travel To A Different Location
{Colours.tag("bkp")} {tags_explanation_colour}Open Your Backpack
{Colours.tag("shp")} {tags_explanation_colour}Open The Shop
{Colours.tag("art")} {tags_explanation_colour}Open Artipedia

{Colours.tag("hlp")} {Colours.fg.cyan}Ask For Help
{Colours.tag("tip")} {Colours.fg.cyan}Get A Useful Tip

{Colours.input_colour + Colours.bold}
What Would You Like To Do?{Colours.reset}""")
Ejemplo n.º 2
0
    def attack(self):
        clear()
        rdm_int = random.randint(1, self.weapon.accuracy)

        #Enemy missed its attack
        if rdm_int == 1:
            rdm_int = random.randint(1, 2)
            if rdm_int == 1:
                print(
                    f"{Colours.fg.cyan}You dodged {self.name_string}{Colours.fg.cyan}'s attack."
                )
            else:
                print(
                    f"{self.name_string}{Colours.fg.cyan} missed it's attack.")

        #Enemy hit attack
        else:
            damage_range = self.weapon.damage
            raw_damage = random.randint(damage_range[0], damage_range[1])

            damage_dealt = new_player.take_damage(raw_damage)

            print(
                f"{self.name_string + Colours.fg.cyan} attacked you, and dealt{Colours.fg.orange} {damage_dealt} damage{Colours.fg.cyan}."
            )

        sleep_and_clear(1.5)
Ejemplo n.º 3
0
def initialize(first_init=False):
    if first_init:
        clear()

    logger.info(locale.detected_os % platform.system())
    logger.info(locale.installing)

    required_packages = [pkg.rstrip('\n').lower() for pkg in open('requirements.txt').readlines()]
    installed_packages = [pkg[0].lower() for pkg in get_pip_info()]
    for package in required_packages:
        if package in installed_packages:
            continue

        if run(f'pip3 install {package}') == 0:
            logger.info(locale.installed % package)
        else:
            logger.info(locale.not_installed % package)
    logger.info(locale.crt_workspace)
    [[os.makedirs(f'SC/{i}-{k}', exist_ok=True) for k in ['Compressed', 'Decompressed', 'Sprites']] for i in ['In', 'Out']]
    [[os.makedirs(f'CSV/{i}-{k}', exist_ok=True) for k in ['Compressed', 'Decompressed']] for i in ['In', 'Out']]
    logger.info(locale.verifying)

    config.initialized = True
    try:
        import requests
        del requests
        config.version = get_tags('vorono4ka', 'xcoder')[0]['name'][1:]
    except ImportError as exception:
        logger.exception(exception)
    config.dump()

    if first_init:
        input(locale.to_continue)
Ejemplo n.º 4
0
    def handle_money(cls):
        clear()
        if entities.new_player.gold_coins >= cls.total_price:
            if isinstance(cls.equipment_to_purchase,
                          entities.Weapon) or isinstance(
                              cls.equipment_to_purchase, entities.Armour):
                print(
                    f"{Colours.fg.pink}You bought {Colours.fg.orange + Colours.underline}{cls.equipment_to_purchase.name}{Colours.reset} {Colours.fg.pink}for {Colours.fg.yellow + Colours.underline}{cls.equipment_to_purchase.price} gold coins{Colours.reset + Colours.fg.pink}."
                )
                sleep(2)

            if isinstance(cls.equipment_to_purchase, entities.Weapon):
                entities.new_player.weapon = cls.equipment_to_purchase

            elif isinstance(cls.equipment_to_purchase, entities.Armour):
                entities.new_player.armour = cls.equipment_to_purchase

            elif isinstance(cls.equipment_to_purchase, Item):
                new_inventory.add_item(cls.key_of_equipment_to_purchase,
                                       cls.equipment_quantity)

            entities.new_player.gold_coins -= cls.total_price

        else:
            print(
                f"{Colours.fg.red + Colours.underline + Colours.bold}YOU DON'T HAVE ENOUGH GOLD COINS{Colours.reset}"
            )
            sleep(2)
Ejemplo n.º 5
0
    def drop_equipment(self, equipment_to_drop):
        valid_inputs = ('y', 'n')
        player_choice = ''

        while player_choice not in valid_inputs:
            clear()
            print(
                f"""{Colours.fg.orange}You found {equipment_to_drop.name_string}{Colours.fg.orange}.

      """)
            sleep(1)

            objects.display_current_equipment_stats(equipment_to_drop.category)

            print(
                f"{Colours.fg.green + Colours.underline}{equipment_to_drop.category.capitalize()} you found:{Colours.reset}"
                "")
            objects.display_equipment_stats(equipment_to_drop,
                                            display_price=False)

            print(
                f"""{Colours.fg.orange}Are you sure you want to equip {equipment_to_drop.name_string} {Colours.fg.orange}?
      
{Colours.tag('y')} {Colours.fg.blue}Yes
{Colours.tag('n')} {Colours.fg.blue}No  
      """)

            player_choice = input(f"{Colours.input_colour}> ")

        if player_choice == 'y':
            new_player.equip(equipment_to_drop)

        elif player_choice == 'n':
            pass
Ejemplo n.º 6
0
  def choose_enemy(enemy_chosen):
    if enemy_chosen == None:
      rdm_int = random.randint(1, 200)

      #filters
      enemies_filtered_by_location = list(filter(lambda x: entities.new_player.current_location in entities.all_enemies[x].spawn_location, entities.all_enemies))

      specific_enemy = list(filter(lambda x: rdm_int in entities.all_enemies[x].spawn_range, enemies_filtered_by_location))
  
      
      if len(specific_enemy) > 1:
        artifact_needed = list(filter(lambda x: x.location is entities.new_player.current_location, all_artifacts))[0]

        if artifact_needed in entities.new_player.artifacts_collected:
          specific_enemy.pop()
        else:
          specific_enemy.pop(0)

      enemy_chosen = specific_enemy[0]

    
    try:  
      entities.new_player.current_enemy = entities.all_enemies[enemy_chosen]
    except KeyError:
      entities.new_player.current_enemy = enemy_chosen


    clear()
    print(f"{Colours.fg.cyan}You encountered {entities.new_player.current_enemy.name_string}{Colours.fg.cyan}.")
    sleep_and_clear(1)
Ejemplo n.º 7
0
  def reset_account(cls):
    entities.new_player = entities.Player()
    objects.new_inventory = objects.PlayerInventory()

    cls.save_account()
    
    clear()
    print(f"{Colours.alert('Your account has now been resetted.')}")
    input(f"{Colours.input_colour}")
Ejemplo n.º 8
0
    def display_initial_message(category):
        clear()
        print(
            f"""{Colours.fg.red + Colours.bold}Which {category} would you like to buy?{Colours.reset}

{Colours.fg.orange}(Type the {Colours.fg.green}green letters {Colours.fg.orange}in square brackets according to the {category} you want to buy)
(Type '{Colours.fg.red}back{Colours.fg.orange}' to go back){Colours.fg.yellow}

{f"{Colours.fg.yellow + Colours.underline}You have {entities.new_player.gold_coins} gold coins{Colours.reset + Colours.fg.yellow}".center(110, "|")}
""")
Ejemplo n.º 9
0
    def ask_for_help():
        clear()
        print(
            f"{Colours.fg.orange}You are stuck inside the game of {Colours.fg.green + Colours.underline}Artifax{Colours.reset + Colours.fg.orange} and in order to escape, you need to beat the game's boss, {talgrog_the_giant.name_string}{Colours.fg.orange}. But first, you need to explore each location to beat their respective {Colours.fg.red + Colours.bold}Artifact Keepers{Colours.reset + Colours.fg.orange}, who will drop artifacts upon dying. After you have collected all the artifacts, you will automatically be teleported to the final location, {setting.grimsden.name_string}{Colours.fg.orange}."
            + '\n')

        print(
            f"{Colours.tag('ProTip')} {Colours.fg.lightblue}Type '{Colours.fg.green}tip{Colours.fg.lightblue}'' in the main menu for a useful game tip."
            + '\n')

        input(f"{Colours.input_colour}> ")
Ejemplo n.º 10
0
    def equip(self, equipment_to_equip):
        if equipment_to_equip.category == "weapon":
            self.weapon = equipment_to_equip

        elif equipment_to_equip.category == "armour":
            self.armour = equipment_to_equip

        clear()
        print(
            f"{Colours.fg.orange}You equipped {equipment_to_equip.name_string}{Colours.fg.orange}."
        )
        sleep_and_clear(1)
Ejemplo n.º 11
0
  def update_items_used(cls):
    for item_name in entities.new_player.items_used:
      turns_left = entities.new_player.items_used[item_name]

      if turns_left > 0:
        if turns_left == 1:
          clear()
          print(f"{System.get_object(item_name, objects.all_items).name_string}{Colours.fg.orange}'s effects ran out.")
          sleep_and_clear(1.5)

          cls.reset_item_effects(item_name)

        entities.new_player.items_used[item_name] -= 1
Ejemplo n.º 12
0
    def display_items_dict(self, clear_the_screen):
        if clear_the_screen:
            clear()
        else:
            sleep(1)

        for key in self.items_dict:
            if self.items_dict[key] == [None, 0]:
                print(f"{Colours.tag(key)} {Colours.none_string}")
                print('\n')
            else:
                display_equipment_stats(key,
                                        display_price=False,
                                        item_quantity=self.items_dict[key][1])
Ejemplo n.º 13
0
    def stun(self):
        raw_damage = int(
            System.calculate_percentage(total=new_player.max_health,
                                        percentage=5))

        new_player.take_damage(raw_damage, armour_absorption=False)

        clear()
        print(
            f"{self.name_string}{Colours.fg.orange} stunned you for {Colours.fg.red}{raw_damage}{Colours.fg.orange} damage."
        )
        print(
            f"{self.name_string}{Colours.fg.lightblue} gained an extra turn.")
        sleep_and_clear(2)

        self.attack()
Ejemplo n.º 14
0
  def display_user_interface(cls):
    clear()
    print(f"""
{entities.new_player.current_enemy.name_string + Colours.fg.red}'s Health:{Colours.fg.green} {entities.new_player.current_enemy.current_health}{Colours.fg.red} / {Colours.fg.green}{entities.new_player.current_enemy.max_health}

{Colours.fg.lightgreen + Colours.underline}Your Health:{Colours.reset}{Colours.fg.green} {entities.new_player.current_health}{Colours.fg.red} / {Colours.fg.green}{entities.new_player.max_health}

{Colours.fg.orange}
What Would You Like To Do?
{Colours.tag('a') + Colours.description_colour} Attack {entities.new_player.current_enemy.name_string}
{Colours.tag('u') + Colours.description_colour} Use Item
{Colours.tag('e') + Colours.description_colour} Escape From Combat{Colours.fg.orange}


""")
    cls.display_items_used()
Ejemplo n.º 15
0
    def get_tip():
        tips = (
            "Buy and use different types of items to gain an edge in combat.",
            "Sleep to regenerate upto 100% of your health. But be aware of nightmares!",
            "When in doubt, escape from combat.",
            "Type 'bkp' in the main menu to access your inventory, weapon, and armour.",
            "Try out all the different commands in the main menu.",
            "Weapons with higher crit chance increase the chance of landing a double damage hit on your enemy.",
            "Read this amazing article on how to be the best at this game: https://bit.ly/3bim457"
        )

        rdm_tip = random.choice(tips)

        clear()
        print(f"{Colours.fg.yellow}{rdm_tip}" + '\n')
        input(f"{Colours.input_colour}> ")
Ejemplo n.º 16
0
    def sleep_for_health(self):
        player_choice = ''
        valid_inputs = ("short", "long", "back")
        not_tired_string = f"{Colours.alert('You Try To Sleep, But Feel Well Rested. Get Tired By Defeating Enemies In The Wilderness.')}"

        while player_choice not in valid_inputs:
            clear()
            player_choice = input(
                f"""{Colours.fg.orange}Which rest would you like to take?

{Colours.tag("short")} {Colours.fg.yellow}Short Rest {Colours.fg.red + Colours.underline}(Heals 50% of your health){Colours.reset}
{Colours.tag("long")} {Colours.fg.yellow}Long Rest {Colours.fg.red + Colours.underline}(Heals 100% of your health{Colours.reset + Colours.fg.red} + {Colours.fg.red + Colours.underline}Chance to get attacked{Colours.reset + Colours.fg.red})

{Colours.tag('back')} {Colours.fg.yellow} Go Back

{Colours.fg.orange}
> """).lower().strip()

            clear()

            #Player is taking short rest
            if player_choice == "short":
                if self.is_tired[0] and self.is_tired[1]:
                    self.is_tired[0] = False
                    self.is_tired[1] = False

                    self.heal(50)

                else:
                    print(not_tired_string)
                    sleep_and_clear(3)

            #Player is taking long rest
            elif player_choice == "long":
                if False not in self.is_tired:
                    self.is_tired = [False, False, False]

                    self.heal(100)

                    rdm_int = random.randint(1, 5)
                    #Player got a nightmare
                    if rdm_int == 5:
                        exploration.Combat.start(goblin, is_players_turn=False)

                else:
                    print(not_tired_string)
                    sleep_and_clear(3)
Ejemplo n.º 17
0
    def escape_from_combat(self):
        print(self)
        self.has_escaped = self.armour.is_lighter_than(
            self.current_enemy.armour)

        clear()
        if self.has_escaped:
            print(
                f"{Colours.fg.cyan}You successfully escaped from {self.current_enemy.name_string}{Colours.fg.cyan}."
            )

        else:
            print(
                f"""{Colours.fg.cyan}You tried to escape from {self.current_enemy.name_string}{Colours.fg.cyan}, but failed.

{self.current_enemy.name_string} {Colours.fg.cyan} gets another turn.
""")
        sleep_and_clear(2)
Ejemplo n.º 18
0
    def drop_loot(self):
        clear()
        print(
            f"{Colours.fg.green}You defeated {new_player.current_enemy.name_string}{Colours.fg.green}!!!"
        )
        sleep_and_clear(2)

        if not self is artifact_keeper and not self is talgrog_the_giant:
            rdm_int = random.randint(1, 100)

            #Drop gold coins
            if rdm_int in range(1, 91):
                self.drop_gold_coins()

            #Drop weapon
            elif rdm_int in range(91, 96):
                if self.weapon.can_drop:
                    self.drop_equipment(self.weapon)
                else:
                    self.drop_gold_coins()

            #Drop armour
            elif rdm_int in range(96, 101):
                if self.armour.can_drop:
                    self.drop_equipment(self.armour)
                else:
                    self.drop_gold_coins()

        #Drop artifact
        elif self is artifact_keeper:
            filtered_artifacts = list(
                filter(
                    lambda artifact: artifact.location is new_player.
                    current_location, setting.all_artifacts))

            artifact_to_add = filtered_artifacts[0]
            new_player.artifacts_collected.append(artifact_to_add)
            new_player.artifacts_not_collected.remove(artifact_to_add)

            print(
                f"{Colours.fg.green}You received {artifact_to_add.name_string}{Colours.fg.green}."
            )

        sleep_and_clear(1)
Ejemplo n.º 19
0
    def use_item(self):
        player_choice = ''
        player_used_item = False

        while not player_choice in self.items_dict and player_choice != "back":
            clear()
            print(f"""{Colours.fg.orange}Which item would you like to use?
{Colours.fg.lightblue}(Type the inventory slot number of the item you want to use)
{Colours.fg.cyan}(Type '{Colours.fg.green}back{Colours.fg.cyan}' to go back)

""")
            self.display_items_dict(clear_the_screen=False)
            player_choice = input(f"{Colours.input_colour}> ").lower().strip()

        if player_choice != "back" and self.items_dict[player_choice] != [
                None, 0
        ]:
            #Set to True
            player_used_item = True

            #Get item object from inventory slot
            item_object = self.items_dict[player_choice][0]

            #Remove item
            self.remove_item(player_choice)

            #Applying item effects
            entities.new_player.apply_item_effects("Increase",
                                                   item_object.increases)

            entities.new_player.current_enemy.apply_item_effects(
                "Decrease", item_object.decreases)

            #Incrementing turns
            entities.new_player.items_used[
                item_object.name] = item_object.affected_turns

            clear()
            print(
                f"{Colours.fg.orange}You used {item_object.name_string}{Colours.fg.orange}."
            )
            sleep_and_clear(1.5)

        return player_used_item
Ejemplo n.º 20
0
    def open_artipedia(self):
        clear()
        print(
            f"{Colours.fg.orange + Colours.bold}Artifacts Collected:{Colours.reset}"
        )

        for artifact in self.artifacts_collected:
            artifact.display_artifact()

        print('\n')
        print(
            f"{Colours.fg.orange + Colours.bold}Artifacts Not Collected:{Colours.reset}"
        )

        for artifact in self.artifacts_not_collected:
            artifact.display_artifact()

        print('\n')
        input(f"{Colours.fg.orange}> ")
Ejemplo n.º 21
0
    def display_menu(cls):
        player_choice = ''

        while player_choice != "back":
            valid_inputs = ("weapon", "armour", "item")
            clear()
            System.print_title("SHOP")

            player_choice = input(
                f"""{Colours.fg.orange + Colours.bold}What would you like to buy?{Colours.reset}

{Colours.tag("weapon") + Colours.fg.red} Weapons
{Colours.tag("armour") + Colours.fg.blue} Armour
{Colours.tag("item") + Colours.fg.pink} Special Items
{Colours.tag("back") + Colours.fg.yellow} Go Back

{Colours.fg.orange}> """).lower().strip()

            if player_choice in valid_inputs:
                cls.handle_purchase(player_choice)
Ejemplo n.º 22
0
  def connect_account(cls):
    cls.get_accounts()
    
    valid_inputs = {'1' : cls.create_account,
                    '2' : cls.load_account
    }
    player_choice = ''
    
    while not cls.logged_in:
      clear()
      print(f"""{Colours.fg.orange + Colours.bold}
Which of the following would you like to do?{Colours.reset}
{Colours.fg.lightblue}(Type the number in the square brackets)

{Colours.tag('1')} {Colours.fg.orange}Sign up for a new, fresh account
{Colours.tag('2')} {Colours.fg.orange}Login into an existing account to load epic progress
""")
      player_choice = input(f"{Colours.input_colour}> ")
      
      if player_choice in valid_inputs:
        valid_inputs[player_choice]()
Ejemplo n.º 23
0
  def play(cls):
    while not entities.new_player.is_dead() and not entities.new_player.current_enemy is entities.talgrog_the_giant:
      if entities.new_player.main_menu_choice == None:
        #Display main menu
        cls.display_main_menu()
        entities.new_player.main_menu_choice = input(f"{Colours.input_colour}> ").lower().strip()

      GameState.save_account()

      #Try to execute player's choice
      try:
        cls.main_menu_choices[entities.new_player.main_menu_choice]()

      #Player entered invalid choice
      except KeyError:
        clear()
        print(f"{Colours.alert('INVALID COMMAND, TYPE THE LETTERS IN THE SQUARE BRACKETS.')}")
        sleep_and_clear(2)

      #Reset player choice
      entities.new_player.main_menu_choice = None

      GameState.save_account()
    

    if entities.new_player.current_enemy is entities.talgrog_the_giant and not entities.new_player.has_won:
      exploration.Combat.start_combat()

    #Player is dead
    if entities.new_player.is_dead():
      cls.display_death_message()
      GameState.reset_account()

    #Player has won
    else:
      cls.display_win_message()
      GameState.reset_account()


    GameState.save_account()
Ejemplo n.º 24
0
  def create_account(cls):
    chosen_username, chosen_password, confirmed_password = None, None, None
    
    cls.get_accounts()
    clear()
      
    chosen_username = input(f"{Colours.fg.orange}Username: "******"{Colours.fg.red}Password: "******"{Colours.fg.red}Confirm Password: "******"{Colours.fg.red}An account with the username '{chosen_username}' and password '{chosen_password}' already exists. Please Login.")
      sleep_and_clear(2)
        
    elif chosen_password != confirmed_password:
      clear()
      print(f"{Colours.fg.red}Your password '{chosen_password}' doesn't match your confirmed password '{confirmed_password}'. Please try again.")
      sleep_and_clear(2)
   
   
    if not (chosen_username, chosen_password) in cls.accounts_dict and chosen_password == confirmed_password:
      cls.logged_in = True
      cls.account = (chosen_username, chosen_password)
      cls.save_account()
Ejemplo n.º 25
0
 def load_account(cls):
   username, password = None, None
   
   cls.get_accounts()
   clear()
     
   username = input(f"{Colours.fg.orange}Username: "******"{Colours.fg.red}Password: "******"{Colours.alert('Invalid username or password.')}")
     sleep_and_clear(2)
       
   else:
     cls.logged_in = True
     cls.account = (username, password)
     entities.new_player = cls.accounts_dict[cls.account]["Player"]
     objects.new_inventory = cls.accounts_dict[cls.account]["new_inventory"]
     entities.all_enemies = cls.accounts_dict[cls.account]["all_enemies"]
     setting.all_locations = cls.accounts_dict[cls.account]["all_locations"]
Ejemplo n.º 26
0
    def add_item(self, item_key, quantity=1):
        item_to_add = all_items[item_key]

        if self.item_exists(item_to_add):
            for key in self.items_dict:
                if self.items_dict[key][0] == item_to_add:
                    self.items_dict[key][1] += quantity

        else:
            if self.empty_slot_exists():
                self.items_dict[self.empty_slot_key] = [item_to_add, quantity]

            else:
                player_choice = ''
                clear()
                print(
                    f"{Colours.fg.orange + Colours.bold + Colours.underline}Your inventory is currently full.{Colours.reset}"
                )
                sleep(1.5)

                while player_choice not in self.items_dict:
                    clear()
                    print(
                        f"""{Colours.fg.red}Which item would you like to remove?   
{Colours.reset + Colours.fg.cyan}(Type a number from  1 to {self.total_slots}, according to the item number you want to replace){Colours.fg.yellow}

{Colours.fg.orange + Colours.underline}Item you want to buy:
""")
                    display_equipment_stats(item_key, item_quantity=quantity)
                    print('\n')

                    self.display_items_dict(clear_the_screen=False)

                    player_choice = input(f"{Colours.input_colour}> ")

                    if player_choice not in self.items_dict:
                        clear()
                        print(
                            f"{Colours.fg.red + Colours.underline}Please enter a number from 1 to {self.total_slots}.{Colours.reset}"
                        )
                        sleep(2)

                self.items_dict[player_choice] = [item_to_add, quantity]

        clear()
        print(
            f"{Colours.fg.orange}You received {Colours.bold + Colours.fg.red}{quantity} {Colours.fg.green}{item_to_add.name}{Colours.reset + Colours.fg.orange}."
        )
        sleep_and_clear(1.5)
Ejemplo n.º 27
0
    def attack(self):
        clear()
        rdm_int = random.randint(1, self.weapon.accuracy)

        #Player missed attack
        if rdm_int == 1:
            rdm_int = random.randint(1, 2)
            if rdm_int == 1:
                print(
                    f"{self.current_enemy.name_string}{Colours.fg.cyan} dodged your attack."
                )
            else:
                print(f"{Colours.fg.lightblue}You missed your attack.")
            sleep_and_clear(1.5)

        #Player hit attack
        else:
            multiplier = 1
            damage_range = self.weapon.damage
            raw_damage = random.randint(damage_range[0], damage_range[1])

            rdm_int = random.randint(1, self.weapon.crit_chance)

            #Player hit a critical hit (double damage)
            if rdm_int == 1:
                print(
                    f"{Colours.fg.orange + Colours.bold + Colours.underline}It's a critical hit!!!{Colours.reset}"
                )
                multiplier *= 2
                sleep_and_clear(1)

            damage_dealt = self.current_enemy.take_damage(
                raw_damage, multiplier)

            print(
                f"{Colours.fg.cyan}You attacked {self.current_enemy.name_string} {Colours.fg.cyan} and dealt {Colours.fg.orange}{damage_dealt} damage{Colours.fg.cyan}."
            )
            sleep_and_clear(1.5)
Ejemplo n.º 28
0
    def heal(self, percentage_to_heal):
        if isinstance(self, Player):
            entity = "You"
            possessive_pronoun = "your"
        else:
            entity = self.name_string
            possessive_pronoun = "its"

        value_to_heal = System.calculate_percentage(percentage_to_heal,
                                                    total=self.max_health)

        self.current_health += value_to_heal

        if self.current_health > self.max_health:
            self.current_health = self.max_health

        self.current_health = round(self.current_health)

        clear()
        print(
            f"{Colours.fg.cyan}{entity} {Colours.fg.cyan}regained {Colours.fg.red + Colours.underline}{percentage_to_heal}%{Colours.reset + Colours.fg.cyan} of {possessive_pronoun} {Colours.fg.green}health{Colours.fg.cyan}."
        )
        sleep_and_clear(2)
Ejemplo n.º 29
0
  def eval_enemy():
    start_combat = True
    
    if entities.new_player.has_all_artifacts():
      valid_inputs = ('1', '2')
      player_choice = ''
      
      while not player_choice in valid_inputs:
        clear()
        print(f"""{Colours.input_colour}
You are about to fight the Game's Boss {entities.talgrog_the_giant.name_string}{Colours.input_colour}. Are you sure you want to continue?

{Colours.tag('1')} {Colours.fg.lightblue}Yes, I am ready
{Colours.tag('2')} {Colours.fg.lightblue}No, I still need to do something 

""")
        player_choice = input(f"{Colours.input_colour}> ")
      
      if player_choice == "2":
        start_combat = False
        
    if start_combat:
       exploration.Combat.start_combat()
Ejemplo n.º 30
0
    def display_confirmation_message(cls):
        cls.equipment_quantity = 1
        cls.total_price = cls.equipment_to_purchase.price
        player_choice = ''

        if isinstance(cls.equipment_to_purchase, Item):
            while type(player_choice) != int:
                clear()
                player_choice = input(
                    f"""{Colours.fg.yellow}How many {Colours.fg.orange + 
Colours.underline}{cls.equipment_to_purchase.name}s{Colours.reset + Colours.fg.yellow} would you like to buy?

{Colours.fg.cyan}(Type a {Colours.fg.green}number{Colours.fg.cyan})
{Colours.fg.orange}
> """)
                try:
                    player_choice = int(player_choice)
                except ValueError:
                    clear()
                    print(f"{Colours.alert('PLEASE ENTER A NUMBER!!!')}")
                    sleep(2)

            cls.equipment_quantity = player_choice
            cls.total_price = cls.equipment_to_purchase.price * cls.equipment_quantity

        clear()
        print(
            f"""{Colours.fg.yellow}Are you sure you want to buy {Colours.fg.red + 
Colours.underline}{cls.equipment_quantity}{Colours.reset} {cls.equipment_to_purchase.name_string}{Colours.fg.yellow} for {Colours.fg.red + Colours.underline}{cls.total_price} gold coins{Colours.reset + Colours.fg.yellow}?

{Colours.fg.yellow}(Type {Colours.fg.green}y{Colours.fg.yellow} to {Colours.fg.green}confirm your purchase{Colours.fg.yellow})
{Colours.fg.yellow}(Type '{Colours.fg.red}back{Colours.fg.yellow}' to go back)

{Colours.fg.green + Colours.underline}{cls.equipment_to_purchase.category.capitalize()} you want to buy:{Colours.reset}"""
        )

        display_equipment_stats(cls.key_of_equipment_to_purchase,
                                display_price=False)