package xyz.luxnk.mxmmod.relics;

import basemod.abstracts.CustomRelic;
import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
import com.megacrit.cardcrawl.actions.common.RelicAboveCreatureAction;
import com.megacrit.cardcrawl.core.Settings;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.helpers.ImageMaster;
import com.megacrit.cardcrawl.powers.ArtifactPower;
import com.megacrit.cardcrawl.powers.DexterityPower;
import com.megacrit.cardcrawl.relics.AbstractRelic;

public class Hamakagami extends CustomRelic {

    public static final String ID = "Hamakagami";
    private static final String IMG = "img/relics/hamakagami.png";
    private static final String IMG_OTL = "img/relics/hamakagami.png";

    private static final int CON_AMT = 1;

    public Hamakagami() {
        super(
                ID,
                ImageMaster.loadImage(IMG),
                ImageMaster.loadImage(IMG_OTL),
                RelicTier.STARTER,
                LandingSound.FLAT
        );
        this.counter = 1;
    }

    @Override
    public void setCounter(int counter) {
        this.counter = counter;
        if (counter == 0) {
            this.img = ImageMaster.loadImage("img/relics/hamakagami_used.png");
            this.usedUp();
            this.description = this.DESCRIPTIONS[2];
        }
    }

    public void use() {
        this.flash();
        this.setCounter(0);
    }

    @Override
    public String getUpdatedDescription() {
        return this.DESCRIPTIONS[0] + CON_AMT + this.DESCRIPTIONS[1];
    }

    @Override
    public void atBattleStart() {
        if (!this.usedUp) {
            this.flash();
            AbstractDungeon.actionManager.addToTop(new ApplyPowerAction(AbstractDungeon.player, AbstractDungeon.player, new ArtifactPower(AbstractDungeon.player, CON_AMT), 1));
            AbstractDungeon.actionManager.addToTop(new RelicAboveCreatureAction(AbstractDungeon.player, this));
        }
    }

    @Override
    public AbstractRelic makeCopy() {
        return new Hamakagami();
    }
}
