|
@@ -38,10 +38,17 @@ void Spell::loadSpellIcon(QString spell_folder) {
|
|
|
}
|
|
|
|
|
|
void Spell::loadSpellTraits(QString spell_folder) {
|
|
|
- /*
|
|
|
- * you can do it by yourself, i need to sleep
|
|
|
- */
|
|
|
-
|
|
|
+ QFile file(spell_folder + "traits.txt");
|
|
|
+ file.open(QIODevice::ReadOnly);
|
|
|
+ QTextStream in(&file);
|
|
|
+ in.setCodec("UTF-8");
|
|
|
+ QString traits_containts = in.readAll();
|
|
|
+ QStringList params = traits_containts.split("\n");
|
|
|
+ assert(params.size() >= 1);
|
|
|
+ size_t countEffects = params[0].toInt();
|
|
|
+ for (size_t i = 1; i <= countEffects; ++i){
|
|
|
+ effects_.push_back(new Effect(params[i]));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
QString Spell::getSpellName() const {
|
|
@@ -69,7 +76,12 @@ bool Spell::getForCell(){
|
|
|
void Spell::setForCell(bool value){
|
|
|
forCell_ = value;
|
|
|
}
|
|
|
-bool Spell::canCastToCell(Cell* destination, Cell* from){
|
|
|
- //if(from -> lenOfActualPath(destination) == 1) return true;
|
|
|
- return false;
|
|
|
+
|
|
|
+bool Spell::isNeirbor(Cell* destination, Cell* from){
|
|
|
+ return from -> getleft() == destination ||
|
|
|
+ from -> getleftDown() == destination ||
|
|
|
+ from -> getleftUp() == destination ||
|
|
|
+ from -> getright() == destination ||
|
|
|
+ from -> getrightDown() == destination ||
|
|
|
+ from -> getrightUp() == destination;
|
|
|
}
|