package org.project.location;

import org.project.entity.enemies.Enemy;
import org.project.entity.players.Player;

import java.util.Scanner;

public class GameDisplay
{
    public static final Scanner scanner = new Scanner(System.in);

    public static final String RED = "\u001B[31m";
    public static final String GREEN = "\u001B[32m";
    public static final String YELLOW = "\u001B[33m";
    public static final String BLUE = "\u001B[34m";
    public static final String MAGENTA = "\u001B[35m";
    public static final String CYAN = "\u001B[36m";
    public static final String PINK = "\u001B[38;5;206m";

    public static final String RESET = "\u001B[0m";

    public void showPlayerTurn (Player player) { System.out.println("\n--- " + player.getName() + "'s Turn ---"); }

    public void showStatus(Player player, Enemy enemy, GameEngine gameEngine)
    {
        System.out.println(BLUE + "\n==========================================================" + RESET);
        System.out.println("[ Name: " + player.getName() + ", HP: " + player.getHp() + "/" + player.getMaxHP()
                            + ", MP: "+ player.getMp() + "/" + player.getMaxMP() + " XP: " + player.getXp()
                            +", Keys:" + gameEngine.keys + " ]");
        System.out.println("[ Enemy: " + enemy.getName() + ", HP: " + enemy.getHp() + ", MP: " + enemy.getMp() + "]");
        System.out.println(BLUE + "==========================================================" + RESET);
    }

    public String battleChoices()
    {
        System.out.println("Your turn :");
        System.out.println(PINK + "1. Attack (Free)                     " + RESET + YELLOW + "6. Restore Mana (10 XP) " + RESET);
        System.out.println(PINK + "2. Heavy Attack (-2 MP)              " + RESET + YELLOW +"7. Restore HP (50 XP)" + RESET);
        System.out.println(PINK + "3. Defend (-5 MP)" );
        System.out.println("4. Special Ability (Knight -7, Wizard -8, Assassin -9 MP)");
        System.out.println("5. Heal (-6 MP, +10 HP)" + RESET);
        return scanner.nextLine();
    }

    public String mainMenu()
    {
        System.out.println(BLUE + "==== Main Menu ====" + RESET);
        System.out.println("1. New Game");
        System.out.println("2. help");
        System.out.println("3. Exit");
        return scanner.nextLine();
    }

    public String chooseCharacter()
    {
        System.out.println(BLUE + "Choose your character:" + RESET);
        System.out.println("1. Knight (50 HP, 50 MP)");
        System.out.println("2. Assassin (40 HP, 60 MP)");
        System.out.println("3. Wizard (60 HP, 40 MP)");
        return scanner.nextLine();
    }

    public void help()
    {
        System.out.println("");
        System.out.println("================================================================================");
        System.out.println("                           WELCOME TO THE DARK REALM        ");
        System.out.println("================================================================================");
        System.out.println("");
        System.out.println("You have entered a land shrouded in darkness, where evil creatures roam freely.");
        System.out.println("Your mission is clear: defeat the forces of darkness and save the world from destruction.");
        System.out.println("");
        System.out.println(" HOW TO PLAY ");
        System.out.println("1. CHOOSE YOUR HERO:");
        System.out.println("   Before your journey begins, select one of the following classes:");
        System.out.println("   1.Knight 2.Wizard 3.Assassin");
        System.out.println("   Each class has unique abilities and strengths. Choose wisely!");
        System.out.println("");
        System.out.println("2. EXPLORE AND COMBAT:");
        System.out.println("   As you venture into the realm, you will encounter hostile monsters such as Goblins, Vampires, and Skeletons.");
        System.out.println("   Engage them in battle to gain experience points (XP) and level up your character.");
        System.out.println("   Higher levels mean stronger stats and better chances of survival.");
        System.out.println("");
        System.out.println("3. COLLECT KEYS:");
        System.out.println("   Defeating specific types of monsters drops special keys:");
        System.out.println("   - Killing Goblins drops the Goblin Key.");
        System.out.println("   - Slaying Vampires yields the Vampire Key.");
        System.out.println("   - Destroying Skeletons grants the Skeleton Key.");
        System.out.println("   You must collect all three keys to unlock the final challenge.");
        System.out.println("");
        System.out.println("4. THE FINAL BOSS: THE DRAGON:");
        System.out.println("   Once you possess all three keys, the path to the Dragon's Lair will open.");
        System.out.println("   The Dragon is the ultimate ruler of evil and possesses immense power.");
        System.out.println("   This is the final battle. If you defeat the Dragon, you will restore peace to the world and win the game.");
        System.out.println("   If you fail, darkness will prevail forever.");
        System.out.println("");
        System.out.println("GOOD LUCK, HERO! MAY YOUR BLADE BE SHARP AND YOUR MAGIC STRONG :) ");
        System.out.println("================================================================================");
        System.out.println("");
    }
}