Newer
Older
hanabi / src / card / Card.java
package card;
import game.Game;

import java.awt.Color;

/*
 * COLORS:
 * GREEN
 * RED
 * YELLOW
 * WHITE
 * BLUE
 * (COLORED)
 */
public class Card {
	protected int color;
	protected int value;
	protected int playerId;
	protected Game g;
		
	public Card(int color, int value, int playerId, Game g){
		this.color = color;
		this.value = value;
		this.playerId = playerId;
		this.g = g;
	}
	
	@Override
	public String toString(){
		return "Color: " + color + "; Value: " + value;
	}
	
	public Color getColor(){
		Color c = null;
		switch(color){
		case 0:
			c = Color.green;
			break;
		case 1:
			c = Color.red;
			break;
		case 2:
			c = Color.yellow;
			break;
		case 3:
			c = Color.white;
			break;
		case 4:
			c = Color.blue;
			break;
		}
		return c;
	}
	
	public static String intColorToText(int id){
		String color = "";
		switch(id){
		case 0:
			color = "green";
			break;
		case 1:
			color = "red";
			break;
		case 2:
			color = "yellow";
			break;
		case 3:
			color = "white";
			break;
		case 4:
			color = "blue";
			break;
		}
		return color;
	}
	
	public int getColorInt(){
		return color;
	}
	
	public int getValue(){
		return value;
	}
	
	public void setProps(Card c){
		this.value = c.getValue();
		this.color = c.getColorInt();
	}
}