package brickbreaker;

import javafx.scene.*;
import javafx.scene.image.*;

/**
 * @author Pavel Porvatov
 */

// Types of bonuses
public def TYPE_SLOW = 0;
public def TYPE_FAST = 1;
public def TYPE_CATCH = 2;
public def TYPE_GROW_BAT = 3;
public def TYPE_REDUCE_BAT = 4;
public def TYPE_GROW_BALL = 5;
public def TYPE_REDUCE_BALL = 6;
public def TYPE_STRIKE = 7;
public def TYPE_LIFE = 8;

// Total count of all bonuses
public def COUNT = 9;

// Names of all bonuses, used in legend
public def NAMES = [
    "SLOW",
    "FAST",
    "CATCH",
    "GROW BAT",
    "REDUCE BAT",
    "GROW BALL",
    "REDUCE BALL",
    "STRIKE",
    "LIFE",
];

public class Bonus extends CustomNode {
    // Type of the bonus
    public-init var type: Integer;

    // Width of the bonus (without shadow)
    public-read var width: Integer;

    // Height of the bonus (without shadow)
    public-read var height: Integer;

    override public function create(): Node {
        var image = Config.bonusesImages[type];

        width = image.width - Config.shadowWidth as Integer;
        height = image.height - Config.shadowHeight as Integer;
        
        ImageView {
            image: image
        }
    }
}