import java.util.*;
import java.awt.*;
import java.awt.Image;
import javax.swing.ImageIcon;

/**
 *  InfoView Class
 *  <p>
 *  This Class works to show the user info about the different movments
 *  of the pieces taking in account the different tiers of them.
 */
public class InfoView extends PlayableElement{
  private static int id = 0;
  private int nivel = 0;
  private int active = 0;
  private PlayableElement pe = null;
  private Image img;
  private Image m;
  private Color color;
  private Color color2;
  private Vector2D pos;
  private String SelectedPiece = "";
  private String SelectedPiece2 = "";
  private String SelectedPiecenom = "";

 
  public InfoView(Vector2D position){
    super(id++);
    pos = position;
    ImageIcon i = new ImageIcon("src/info.png");
    if (i!=null){
      img = i.getImage();
    }
  }


  
  public void updateImage(Piece p){
    SelectedPiece2 = "-Ataque: "+p.atk;
    if (p.hp == p.hpmax){
    SelectedPiece = "-Vida: "+p.hp;
    color = Color.WHITE;
    }
    else if (p.hp < p.hpmax){
    SelectedPiece = "-Vida: "+p.hp;
    color = Color.RED;
    }
    else if (p.hp > p.hpmax){
    SelectedPiece = "-Vida: "+p.hp;
    color = Color.GREEN;
    }
    String s = p.getClass().getName();
    String s1 = "";
    if (s == "KingBlack") SelectedPiecenom = "Athus";
    if (s == "KingWhite") SelectedPiecenom = "Seigh";
    if (s == "QueenBlack") SelectedPiecenom = "Um`drath";
    if (s == "QueenWhite") SelectedPiecenom = "Lucina";
    if (s == "HorseBlack") SelectedPiecenom = "Tih y Bah";
    if (s == "HorseWhite") SelectedPiecenom = "Cristh";
    if (s == "BishopBlack") SelectedPiecenom = "Aluhen";
    if (s == "BishopWhite") SelectedPiecenom = "Curandero";
    if (s == "TowerBlack") SelectedPiecenom = "Protector";
    if (s == "TowerWhite") SelectedPiecenom = "Forjado";
    
    color2 = Color.WHITE;
    
    
  }

  public Vector2D getPosition(){
    return pos;
  }
  public void setPosition(Vector2D posi){
    pos = posi;
  }
  public int getCol(){
    return 0;
  }
  public int getRow(){
    return 0;
  }
  public boolean contains (int x, int y) {
      return false;
   }
  
  public void paintView(Graphics2D g) {   
    
      g.drawImage(img, pos.getX(), pos.getY(), null);
      g.setColor(color);
      g.setFont(new Font("Sylfaen", Font.PLAIN, 20));
      g.drawString(SelectedPiece,pos.getX()+58, pos.getY()+70+5);
      g.setColor(color2);
      g.drawString(SelectedPiece2,pos.getX()+58, pos.getY()+90+5);
      g.setFont(new Font("Sylfaen", Font.PLAIN, 30));
      g.drawString(SelectedPiecenom,pos.getX()+58, pos.getY()+70/2+5);
      //g2.setColor(Color.GREEN);
        /*g.drawImage(m, pos.getX()+100,pos.getY()+40,null);
        g.setFont(new Font("Sylfaen", Font.PLAIN, 16));
        g.drawString("Forced Recovery" ,pos.getX()+116, pos.getY()+24);*/
        
        
    
  

}

}