package cz.jzitnik.game.sprites;

import cz.jzitnik.tui.Sprite;

import java.util.HashMap;

public class Breaking extends Sprite<Breaking.BreakingState> {
    public enum BreakingState {
        FIRST, SECOND, THIRD
    }

    public Breaking() {
        loadResources(new HashMap<>() {
            {
                put(BreakingState.FIRST, "breaking/1.ans");
                put(BreakingState.SECOND, "breaking/2.ans");
                put(BreakingState.THIRD, "breaking/3.ans");
            }
        }, BreakingState.class);
    }

    private String fix(String x) {
        return x.replaceAll("\033\\[38;5;1;48;5;16m", "\033[0m"); 
    }

    @Override
    public String getSprite() {
        return fix(getSprite(BreakingState.FIRST));
    }

    @Override
    public String getSprite(BreakingState key) {
        return fix(getResource(key));
    }
}
