"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Item = void 0;
class Item {
    constructor(data, G) {
        this.G = G;
    }
    calculateMinimumCost() {
        const gInfo = this.G.items[this.name];
        let cost = gInfo.g;
        if (gInfo.compound) {
            for (let i = 0; i < this.level; i++) {
                cost *= 3;
                let scrollLevel = 0;
                for (const grade of gInfo.grades) {
                    if (i + 1 < grade) {
                        const scrollInfo = this.G.items[`cscroll${scrollLevel}`];
                        cost += scrollInfo.g;
                        break;
                    }
                    scrollLevel++;
                }
            }
        }
        else if (gInfo.upgrade) {
            for (let i = 0; i < this.level; i++) {
                let scrollLevel = 0;
                for (const grade of gInfo.grades) {
                    if (i + 1 < grade) {
                        const scrollInfo = this.G.items[`scroll${scrollLevel}`];
                        cost += scrollInfo.g;
                        break;
                    }
                    scrollLevel++;
                }
            }
        }
        return cost;
    }
}
exports.Item = Item;
//# sourceMappingURL=Item.js.map