package de.heatup.ui.statusPanel;

import de.heatup.ui.StatusPanelAdder;


public class Score {
	private static int score;
	private static int bonusTime=180;
	/**
	 * @return Score
	 */
	public static int getScore(){
		return score;
	}
	/**
	 * @return Score as String
	 */
	public static String getScoreS(){
		int score=getScore();
		Integer string= new Integer(score);
		return string.toString();
	}
	/**
	 * setzt die BonusZeit bis dahin es den Zeitbonus gibt
	 * @param bonusTime
	 */
	public static void setBonusTime(int bonusTime){
		Score.bonusTime=bonusTime;
	}
	
	/**
	 * erhöht den Score um:
	 * @param additional
	 */
	public static void raiseScore(int additional){
		score+=additional;
	}
	/**
	 * senkt den Score um:
	 * @param reduce
	 */
	public static void reduceScore(int reduce){
		score-=reduce;
		//when score less than 0
		if (score<0){
			score=0;
		}
	}
	/**
	 * berechnet den endgültigen Score und gibt diesen zurück
	 * @return endScore
	 */
	public static int endScore(){
		int manipulations=StatusPanelAdder.getManipulations();
		int manipulationsBonus=0;
		if (manipulations >0){
			manipulationsBonus=2400/manipulations;
		}
		int endScore=score + manipulationsBonus;
		if (Timer.getAllInSeconds()<bonusTime){
			endScore+=(((2*bonusTime)-Timer.getAllInSeconds()));
		}
		
		return endScore;
	}
	
	
	
}
