import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.util.*;
/**
 * Write a description of class Bottlecheck here.
 * 
 * @author Florian, Jonathan
 * @version (a version number or a date)
 */
public class Bottlecheck extends Element

{
    public static boolean bottleavailable = false;
    private List<Actor> objects = new ArrayList<Actor>();
    private int sizex = 30;
    private int sizey = 30;
    private long bottleavailablemillis = 0;
    private static double count = 1;
    private String[] flascheGefunden = {"Glückwunsch!", "Du hast die Flasche gefunden", "", "Benutze sie als Waffe gegen die Zombies", "Drücke LEER zum Schlagen"};
    private static boolean isSmaller = false;
    private GreenfootImage img;
    public Bottlecheck()
    {
        img = new GreenfootImage("Skins/Waffe/wodka_runter.png");
    
        setImage("Skins/leer.png");
        //setImage(img);    
    }

    /**
     * Act - do whatever the Bottlecheck wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        // Add your action code here.
      
        if (isTouching(Linch.class))
        {
            if(!bottleavailable){
                Background.msg(flascheGefunden);
                bottleavailablemillis = System.currentTimeMillis();
                Bottle.available = true;
            }
            bottleavailable = true;

        }
        if(bottleavailable){
            
            setLocation(320,240);
            if(count <=1200 && !isSmaller){
                count = count*1.1+1;
            }else if(count > 1200 && !isSmaller){
                isSmaller = true;
            }else if(count >= 1 && isSmaller){
                count= count/1.2;
            }else if(count < 1 && isSmaller){
                getWorld().removeObject(this);
            }
            GreenfootImage img2 = new GreenfootImage("Skins/Waffe/wodka_runter.png");
            img2.scale((int)(sizex+count), (int)(sizey+count));
            setImage(img2);
        }else{
            setImage(img);
        }
        
    }    
}
