// // Created by IgorBat on 21.04.2018. // #include "abstractfactory.h" #include "effects/effect.h" #include #include #include #include #include #include #include Effect::Effect(QString parameters) { QStringList params = parameters.split("|"); assert(params.size() >= 3); effect_name_ = params[0]; count_ = params[1].toInt(); durability_ = params[2].toInt(); QString effect_folder = ":/assets/effects/" + effect_name_ + "/"; loadEffectDescr(effect_folder); loadEffectIcon(effect_folder); } void Effect::loadUnitDescr(QString effect_folder) { QFile file(effect_folder + "descr.txt"); file.open(QIODevice::ReadOnly); QTextStream in(&file); in.setCodec("UTF-8"); effect_descr_ = in.readAll(); } void Effect::loadUnitIcon(QString effect_folder) { effect_icon_.load(effect_folder + "icon.png"); } QString Effect::getEffectName() const { return effect_name_; } QString Effect::getEffectDescr() const { return effect_descr_; } QImage Effect::getEffectIcon() const { return effect_icon_; } int Effect::getCount(){ return count_; } void Effect::setCount(int value){ count_ = value; } int Effect::getDurability(){ return durability_; }; void Effect::setDurability(int value){ durability_ = value; }