package de.miaurizius.jgame2d.entity.npc;

import de.miaurizius.jgame2d.core.GamePanel;
import de.miaurizius.jgame2d.core.enums.Direction;
import de.miaurizius.jgame2d.core.enums.EntityType;
import de.miaurizius.jgame2d.core.enums.GameState;
import de.miaurizius.jgame2d.entity.Entity;
import de.miaurizius.jgame2d.entity.item.*;

public class MerchantNPC extends Entity {

    public MerchantNPC(GamePanel panel) {
        super(panel);
        type = EntityType.NPC;
        name = "merchant-npc";

        direction = Direction.DOWN;
        speed = 0;
        getImage();
        setDialogue();
        setItems();
    }

    @Override
    public void speak() {
        facePlayer();
        panel.gameState = GameState.TRADE;
        panel.ui.tradingNPC = this;
    }

    // SETTING THINGS UP
    private void getImage()  {
        up1 = initEntitySprites("npc/merchant_down_1");
        up2 = initEntitySprites("npc/merchant_down_2");
        down1 = initEntitySprites("npc/merchant_down_1");
        down2 = initEntitySprites("npc/merchant_down_2");
        left1 = initEntitySprites("npc/merchant_down_1");
        left2 = initEntitySprites("npc/merchant_down_2");
        right1 = initEntitySprites("npc/merchant_down_1");
        right2 = initEntitySprites("npc/merchant_down_2");
    }
    private void setDialogue() {
        dialogue[0][0] = "He he, so you found me. \nI have some good stuff. \nDo you want to trade?";
        dialogue[1][0] = "Come again, hehe!";
        dialogue[2][0] = "You need more coins to buy that!";
        dialogue[3][0] = "Your inventory is full!";
        dialogue[4][0] = "You cannot sell an equipped item!";
    }
    private void setItems() {
        inventory.add(new PotionObj(panel));
        inventory.add(new KeyObj(panel));
        inventory.add(new SwordNormalObj(panel));
        inventory.add(new AxeObj(panel));
        inventory.add(new ShieldWoodObj(panel));
        inventory.add(new IronShieldObj(panel));
        inventory.add(new LanternObj(panel));
        inventory.add(new TentObj(panel));
    }

}
