package de.frajul.endlessroll.entities.tools;

/**
 * Created by Julian on 09.06.2017.
 */

public class ToolUpgrade {

    private ToolUpgradeType type;
    private float first, step;
    private int price;

    private int maxLevel;
    private int currentLevel = 1;

    public ToolUpgrade(ToolUpgradeType type, float first, float last, float step, int price) {
        this.type = type;
        this.first = first;
        this.step = step;
        this.price = price;
        maxLevel = (int) Math.abs((first - last) / step) + 1;
    }

    public ToolUpgradeType getType() {
        return type;
    }

    public float getValueAtLevel(int level) {
        return first + step * (level - 1);
    }

    public float getValueAtCurrentLevel() {
        return getValueAtLevel(currentLevel);
    }

    public float getValueAtNextLevel() {
        return getValueAtLevel(currentLevel + 1);
    }

    public int getMaxLevel() {
        return maxLevel;
    }

    public int getPrice() {
        return price;
    }

    public int getCurrentLevel() {
        return currentLevel;
    }

    public void setCurrentLevel(int currentLevel) {
        this.currentLevel = currentLevel;
    }
}
