mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-28 03:57:02 +02:00
few formatting. Mostly space-> tab
This commit is contained in:
parent
1d7c63da57
commit
3e101d89ef
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
namespace SpellConfig
|
namespace SpellConfig
|
||||||
{
|
{
|
||||||
static const std::string LEVEL_NAMES[] = {"none", "basic", "advanced", "expert"};
|
static const std::string LEVEL_NAMES[] = {"none", "basic", "advanced", "expert"};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ namespace SRSLPraserHelpers
|
|||||||
}
|
}
|
||||||
|
|
||||||
CSpell::LevelInfo::LevelInfo()
|
CSpell::LevelInfo::LevelInfo()
|
||||||
:description(""),cost(0),power(0),AIValue(0),smartTarget(true),range("0")
|
:description(""),cost(0),power(0),AIValue(0),smartTarget(true),range("0")
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ CSpell::CSpell():
|
|||||||
isRising(false), isDamage(false), isOffensive(false),
|
isRising(false), isDamage(false), isOffensive(false),
|
||||||
targetType(ETargetType::NO_TARGET)
|
targetType(ETargetType::NO_TARGET)
|
||||||
{
|
{
|
||||||
levels.resize(GameConstants::SPELL_SCHOOL_LEVELS);
|
levels.resize(GameConstants::SPELL_SCHOOL_LEVELS);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSpell::~CSpell()
|
CSpell::~CSpell()
|
||||||
@ -163,8 +163,8 @@ const CSpell::LevelInfo & CSpell::getLevelInfo(const int level) const
|
|||||||
{
|
{
|
||||||
if(level < 0 || level >= GameConstants::SPELL_SCHOOL_LEVELS)
|
if(level < 0 || level >= GameConstants::SPELL_SCHOOL_LEVELS)
|
||||||
{
|
{
|
||||||
logGlobal->errorStream() << __FUNCTION__ << " invalid school level " << level;
|
logGlobal->errorStream() << __FUNCTION__ << " invalid school level " << level;
|
||||||
throw new std::runtime_error("Invalid school level");
|
throw new std::runtime_error("Invalid school level");
|
||||||
}
|
}
|
||||||
|
|
||||||
return levels.at(level);
|
return levels.at(level);
|
||||||
@ -173,7 +173,7 @@ const CSpell::LevelInfo & CSpell::getLevelInfo(const int level) const
|
|||||||
|
|
||||||
std::vector<BattleHex> CSpell::rangeInHexes(BattleHex centralHex, ui8 schoolLvl, ui8 side, bool *outDroppedHexes) const
|
std::vector<BattleHex> CSpell::rangeInHexes(BattleHex centralHex, ui8 schoolLvl, ui8 side, bool *outDroppedHexes) const
|
||||||
{
|
{
|
||||||
using namespace SRSLPraserHelpers;
|
using namespace SRSLPraserHelpers;
|
||||||
|
|
||||||
std::vector<BattleHex> ret;
|
std::vector<BattleHex> ret;
|
||||||
|
|
||||||
@ -280,15 +280,15 @@ CSpell::ETargetType CSpell::getTargetType() const
|
|||||||
|
|
||||||
const CSpell::TargetInfo CSpell::getTargetInfo(const int level) const
|
const CSpell::TargetInfo CSpell::getTargetInfo(const int level) const
|
||||||
{
|
{
|
||||||
TargetInfo info;
|
TargetInfo info;
|
||||||
|
|
||||||
auto & levelInfo = getLevelInfo(level);
|
auto & levelInfo = getLevelInfo(level);
|
||||||
|
|
||||||
info.type = getTargetType();
|
info.type = getTargetType();
|
||||||
info.smart = levelInfo.smartTarget;
|
info.smart = levelInfo.smartTarget;
|
||||||
info.massive = levelInfo.range == "X";
|
info.massive = levelInfo.range == "X";
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ bool CSpell::isOffensiveSpell() const
|
|||||||
|
|
||||||
bool CSpell::isSpecialSpell() const
|
bool CSpell::isSpecialSpell() const
|
||||||
{
|
{
|
||||||
return isSpecial;
|
return isSpecial;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSpell::hasEffects() const
|
bool CSpell::hasEffects() const
|
||||||
@ -356,12 +356,12 @@ const std::string& CSpell::getCastSound() const
|
|||||||
|
|
||||||
si32 CSpell::getCost(const int skillLevel) const
|
si32 CSpell::getCost(const int skillLevel) const
|
||||||
{
|
{
|
||||||
return getLevelInfo(skillLevel).cost;
|
return getLevelInfo(skillLevel).cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
si32 CSpell::getPower(const int skillLevel) const
|
si32 CSpell::getPower(const int skillLevel) const
|
||||||
{
|
{
|
||||||
return getLevelInfo(skillLevel).power;
|
return getLevelInfo(skillLevel).power;
|
||||||
}
|
}
|
||||||
|
|
||||||
//si32 CSpell::calculatePower(const int skillLevel) const
|
//si32 CSpell::calculatePower(const int skillLevel) const
|
||||||
@ -371,11 +371,11 @@ si32 CSpell::getPower(const int skillLevel) const
|
|||||||
|
|
||||||
si32 CSpell::getProbability(const TFaction factionId) const
|
si32 CSpell::getProbability(const TFaction factionId) const
|
||||||
{
|
{
|
||||||
if(!vstd::contains(probabilities,factionId))
|
if(!vstd::contains(probabilities,factionId))
|
||||||
{
|
{
|
||||||
return defaultProbability;
|
return defaultProbability;
|
||||||
}
|
}
|
||||||
return probabilities.at(factionId);
|
return probabilities.at(factionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -383,17 +383,17 @@ void CSpell::getEffects(std::vector<Bonus>& lst, const int level) const
|
|||||||
{
|
{
|
||||||
if(level < 0 || level >= GameConstants::SPELL_SCHOOL_LEVELS)
|
if(level < 0 || level >= GameConstants::SPELL_SCHOOL_LEVELS)
|
||||||
{
|
{
|
||||||
logGlobal->errorStream() << __FUNCTION__ << " invalid school level " << level;
|
logGlobal->errorStream() << __FUNCTION__ << " invalid school level " << level;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<Bonus> & effects = levels[level].effects;
|
const std::vector<Bonus> & effects = levels[level].effects;
|
||||||
|
|
||||||
if(effects.empty())
|
if(effects.empty())
|
||||||
{
|
{
|
||||||
logGlobal->errorStream() << __FUNCTION__ << " This spell (" + name + ") has no effects for level " << level;
|
logGlobal->errorStream() << __FUNCTION__ << " This spell (" + name + ") has no effects for level " << level;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lst.reserve(lst.size() + effects.size());
|
lst.reserve(lst.size() + effects.size());
|
||||||
|
|
||||||
@ -415,17 +415,17 @@ bool CSpell::isImmuneBy(const IBonusBearer* obj) const
|
|||||||
|
|
||||||
//2. Check absolute immunities
|
//2. Check absolute immunities
|
||||||
//todo: check config: some creatures are unaffected always, for example undead to resurrection.
|
//todo: check config: some creatures are unaffected always, for example undead to resurrection.
|
||||||
for(auto b : absoluteImmunities)
|
for(auto b : absoluteImmunities)
|
||||||
{
|
{
|
||||||
if (obj->hasBonusOfType(b))
|
if (obj->hasBonusOfType(b))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//3. Check negation
|
//3. Check negation
|
||||||
if(obj->hasBonusOfType(Bonus::NEGATE_ALL_NATURAL_IMMUNITIES)) //Orb of vulnerability
|
if(obj->hasBonusOfType(Bonus::NEGATE_ALL_NATURAL_IMMUNITIES)) //Orb of vulnerability
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//4. Check negatable immunities
|
//4. Check negatable immunities
|
||||||
for(auto b : immunities)
|
for(auto b : immunities)
|
||||||
{
|
{
|
||||||
if (obj->hasBonusOfType(b))
|
if (obj->hasBonusOfType(b))
|
||||||
@ -444,7 +444,7 @@ bool CSpell::isImmuneBy(const IBonusBearer* obj) const
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
//4. Check elemental immunities
|
//4. Check elemental immunities
|
||||||
if(fire)
|
if(fire)
|
||||||
{
|
{
|
||||||
if(battleTestElementalImmunity(Bonus::FIRE_IMMUNITY))
|
if(battleTestElementalImmunity(Bonus::FIRE_IMMUNITY))
|
||||||
@ -480,23 +480,23 @@ bool CSpell::isImmuneBy(const IBonusBearer* obj) const
|
|||||||
|
|
||||||
void CSpell::setIsOffensive(const bool val)
|
void CSpell::setIsOffensive(const bool val)
|
||||||
{
|
{
|
||||||
isOffensive = val;
|
isOffensive = val;
|
||||||
|
|
||||||
if(val)
|
if(val)
|
||||||
{
|
{
|
||||||
positiveness = CSpell::NEGATIVE;
|
positiveness = CSpell::NEGATIVE;
|
||||||
isDamage = true;
|
isDamage = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSpell::setIsRising(const bool val)
|
void CSpell::setIsRising(const bool val)
|
||||||
{
|
{
|
||||||
isRising = val;
|
isRising = val;
|
||||||
|
|
||||||
if(val)
|
if(val)
|
||||||
{
|
{
|
||||||
positiveness = CSpell::POSITIVE;
|
positiveness = CSpell::POSITIVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -517,99 +517,99 @@ CSpellHandler::CSpellHandler()
|
|||||||
|
|
||||||
std::vector<JsonNode> CSpellHandler::loadLegacyData(size_t dataSize)
|
std::vector<JsonNode> CSpellHandler::loadLegacyData(size_t dataSize)
|
||||||
{
|
{
|
||||||
using namespace SpellConfig;
|
using namespace SpellConfig;
|
||||||
std::vector<JsonNode> legacyData;
|
std::vector<JsonNode> legacyData;
|
||||||
|
|
||||||
CLegacyConfigParser parser("DATA/SPTRAITS.TXT");
|
CLegacyConfigParser parser("DATA/SPTRAITS.TXT");
|
||||||
|
|
||||||
auto readSchool = [&](JsonMap& schools, const std::string& name)
|
auto readSchool = [&](JsonMap& schools, const std::string& name)
|
||||||
{
|
{
|
||||||
if (parser.readString() == "x")
|
if (parser.readString() == "x")
|
||||||
{
|
{
|
||||||
schools[name].Bool() = true;
|
schools[name].Bool() = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto read = [&,this](bool combat, bool ability)
|
auto read = [&,this](bool combat, bool ability)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
JsonNode lineNode(JsonNode::DATA_STRUCT);
|
JsonNode lineNode(JsonNode::DATA_STRUCT);
|
||||||
|
|
||||||
const si32 id = legacyData.size();
|
const si32 id = legacyData.size();
|
||||||
|
|
||||||
lineNode["index"].Float() = id;
|
lineNode["index"].Float() = id;
|
||||||
lineNode["type"].String() = ability ? "ability" : (combat ? "combat" : "adventure");
|
lineNode["type"].String() = ability ? "ability" : (combat ? "combat" : "adventure");
|
||||||
|
|
||||||
lineNode["name"].String() = parser.readString();
|
lineNode["name"].String() = parser.readString();
|
||||||
|
|
||||||
parser.readString(); //ignored unused abbreviated name
|
parser.readString(); //ignored unused abbreviated name
|
||||||
lineNode["level"].Float() = parser.readNumber();
|
lineNode["level"].Float() = parser.readNumber();
|
||||||
|
|
||||||
auto& schools = lineNode["school"].Struct();
|
auto& schools = lineNode["school"].Struct();
|
||||||
|
|
||||||
readSchool(schools, "earth");
|
readSchool(schools, "earth");
|
||||||
readSchool(schools, "water");
|
readSchool(schools, "water");
|
||||||
readSchool(schools, "fire");
|
readSchool(schools, "fire");
|
||||||
readSchool(schools, "air");
|
readSchool(schools, "air");
|
||||||
|
|
||||||
auto& levels = lineNode["levels"].Struct();
|
auto& levels = lineNode["levels"].Struct();
|
||||||
|
|
||||||
auto getLevel = [&](const size_t idx)->JsonMap&
|
auto getLevel = [&](const size_t idx)->JsonMap&
|
||||||
{
|
{
|
||||||
assert(idx < GameConstants::SPELL_SCHOOL_LEVELS);
|
assert(idx < GameConstants::SPELL_SCHOOL_LEVELS);
|
||||||
return levels[LEVEL_NAMES[idx]].Struct();
|
return levels[LEVEL_NAMES[idx]].Struct();
|
||||||
};
|
};
|
||||||
|
|
||||||
auto costs = parser.readNumArray<si32>(GameConstants::SPELL_SCHOOL_LEVELS);
|
auto costs = parser.readNumArray<si32>(GameConstants::SPELL_SCHOOL_LEVELS);
|
||||||
lineNode["power"].Float() = parser.readNumber();
|
lineNode["power"].Float() = parser.readNumber();
|
||||||
auto powers = parser.readNumArray<si32>(GameConstants::SPELL_SCHOOL_LEVELS);
|
auto powers = parser.readNumArray<si32>(GameConstants::SPELL_SCHOOL_LEVELS);
|
||||||
|
|
||||||
auto& chances = lineNode["gainChance"].Struct();
|
auto& chances = lineNode["gainChance"].Struct();
|
||||||
|
|
||||||
for(size_t i = 0; i < GameConstants::F_NUMBER ; i++){
|
for(size_t i = 0; i < GameConstants::F_NUMBER ; i++){
|
||||||
chances[ETownType::names[i]].Float() = parser.readNumber();
|
chances[ETownType::names[i]].Float() = parser.readNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto AIVals = parser.readNumArray<si32>(GameConstants::SPELL_SCHOOL_LEVELS);
|
auto AIVals = parser.readNumArray<si32>(GameConstants::SPELL_SCHOOL_LEVELS);
|
||||||
|
|
||||||
std::vector<std::string> descriptions;
|
std::vector<std::string> descriptions;
|
||||||
for(size_t i = 0; i < GameConstants::SPELL_SCHOOL_LEVELS ; i++)
|
for(size_t i = 0; i < GameConstants::SPELL_SCHOOL_LEVELS ; i++)
|
||||||
descriptions.push_back(parser.readString());
|
descriptions.push_back(parser.readString());
|
||||||
|
|
||||||
std::string attributes = parser.readString();
|
std::string attributes = parser.readString();
|
||||||
|
|
||||||
std::string targetType = "NO_TARGET";
|
std::string targetType = "NO_TARGET";
|
||||||
|
|
||||||
if(attributes.find("CREATURE_TARGET_1") != std::string::npos
|
if(attributes.find("CREATURE_TARGET_1") != std::string::npos
|
||||||
|| attributes.find("CREATURE_TARGET_2") != std::string::npos)
|
|| attributes.find("CREATURE_TARGET_2") != std::string::npos)
|
||||||
targetType = "CREATURE_EXPERT_MASSIVE";
|
targetType = "CREATURE_EXPERT_MASSIVE";
|
||||||
else if(attributes.find("CREATURE_TARGET") != std::string::npos)
|
else if(attributes.find("CREATURE_TARGET") != std::string::npos)
|
||||||
targetType = "CREATURE";
|
targetType = "CREATURE";
|
||||||
else if(attributes.find("OBSTACLE_TARGET") != std::string::npos)
|
else if(attributes.find("OBSTACLE_TARGET") != std::string::npos)
|
||||||
targetType = "OBSTACLE";
|
targetType = "OBSTACLE";
|
||||||
|
|
||||||
//save parsed level specific data
|
//save parsed level specific data
|
||||||
for(size_t i = 0; i < GameConstants::SPELL_SCHOOL_LEVELS; i++)
|
for(size_t i = 0; i < GameConstants::SPELL_SCHOOL_LEVELS; i++)
|
||||||
{
|
{
|
||||||
auto& level = getLevel(i);
|
auto& level = getLevel(i);
|
||||||
level["description"].String() = descriptions[i];
|
level["description"].String() = descriptions[i];
|
||||||
level["cost"].Float() = costs[i];
|
level["cost"].Float() = costs[i];
|
||||||
level["power"].Float() = powers[i];
|
level["power"].Float() = powers[i];
|
||||||
level["aiValue"].Float() = AIVals[i];
|
level["aiValue"].Float() = AIVals[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(targetType == "CREATURE_EXPERT_MASSIVE")
|
if(targetType == "CREATURE_EXPERT_MASSIVE")
|
||||||
{
|
{
|
||||||
lineNode["targetType"].String() = "CREATURE";
|
lineNode["targetType"].String() = "CREATURE";
|
||||||
getLevel(3)["range"].String() = "X";
|
getLevel(3)["range"].String() = "X";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lineNode["targetType"].String() = targetType;
|
lineNode["targetType"].String() = targetType;
|
||||||
}
|
}
|
||||||
|
|
||||||
legacyData.push_back(lineNode);
|
legacyData.push_back(lineNode);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -633,9 +633,9 @@ std::vector<JsonNode> CSpellHandler::loadLegacyData(size_t dataSize)
|
|||||||
//clone Acid Breath attributes for Acid Breath damage effect
|
//clone Acid Breath attributes for Acid Breath damage effect
|
||||||
JsonNode temp = legacyData[SpellID::ACID_BREATH_DEFENSE];
|
JsonNode temp = legacyData[SpellID::ACID_BREATH_DEFENSE];
|
||||||
temp["index"].Float() = SpellID::ACID_BREATH_DAMAGE;
|
temp["index"].Float() = SpellID::ACID_BREATH_DAMAGE;
|
||||||
legacyData.push_back(temp);
|
legacyData.push_back(temp);
|
||||||
|
|
||||||
objects.resize(legacyData.size());
|
objects.resize(legacyData.size());
|
||||||
|
|
||||||
return legacyData;
|
return legacyData;
|
||||||
}
|
}
|
||||||
@ -751,23 +751,23 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
|
|||||||
logGlobal->errorStream() << "No positiveness specified, assumed NEUTRAL";
|
logGlobal->errorStream() << "No positiveness specified, assumed NEUTRAL";
|
||||||
}
|
}
|
||||||
|
|
||||||
spell->isSpecial = flags["special"].Bool();
|
spell->isSpecial = flags["special"].Bool();
|
||||||
|
|
||||||
auto findBonus = [&](std::string name, std::vector<Bonus::BonusType> &vec)
|
auto findBonus = [&](std::string name, std::vector<Bonus::BonusType> &vec)
|
||||||
{
|
{
|
||||||
auto it = bonusNameMap.find(name);
|
auto it = bonusNameMap.find(name);
|
||||||
if(it == bonusNameMap.end())
|
if(it == bonusNameMap.end())
|
||||||
{
|
{
|
||||||
logGlobal->errorStream() << spell->name << ": invalid bonus name" << name;
|
logGlobal->errorStream() << spell->name << ": invalid bonus name" << name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vec.push_back((Bonus::BonusType)it->second);
|
vec.push_back((Bonus::BonusType)it->second);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto readBonusStruct = [&](std::string name, std::vector<Bonus::BonusType> &vec)
|
auto readBonusStruct = [&](std::string name, std::vector<Bonus::BonusType> &vec)
|
||||||
{
|
{
|
||||||
for(auto bonusData: json[name].Struct())
|
for(auto bonusData: json[name].Struct())
|
||||||
{
|
{
|
||||||
const std::string bonusId = bonusData.first;
|
const std::string bonusId = bonusData.first;
|
||||||
@ -776,16 +776,16 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
|
|||||||
if(flag)
|
if(flag)
|
||||||
findBonus(bonusId, vec);
|
findBonus(bonusId, vec);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
readBonusStruct("immunity", spell->immunities);
|
readBonusStruct("immunity", spell->immunities);
|
||||||
|
|
||||||
readBonusStruct("absoluteImmunity", spell->absoluteImmunities);
|
readBonusStruct("absoluteImmunity", spell->absoluteImmunities);
|
||||||
|
|
||||||
readBonusStruct("limit", spell->limiters);
|
readBonusStruct("limit", spell->limiters);
|
||||||
|
|
||||||
|
|
||||||
const JsonNode & graphicsNode = json["graphics"];
|
const JsonNode & graphicsNode = json["graphics"];
|
||||||
|
|
||||||
spell->iconImmune = graphicsNode["iconImmune"].String();
|
spell->iconImmune = graphicsNode["iconImmune"].String();
|
||||||
spell->iconBook = graphicsNode["iconBook"].String();
|
spell->iconBook = graphicsNode["iconBook"].String();
|
||||||
@ -800,9 +800,9 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
|
|||||||
spell->castSound = soundsNode["cast"].String();
|
spell->castSound = soundsNode["cast"].String();
|
||||||
|
|
||||||
|
|
||||||
//load level attributes
|
//load level attributes
|
||||||
|
|
||||||
const int levelsCount = GameConstants::SPELL_SCHOOL_LEVELS;
|
const int levelsCount = GameConstants::SPELL_SCHOOL_LEVELS;
|
||||||
|
|
||||||
for(int levelIndex = 0; levelIndex < levelsCount; levelIndex++)
|
for(int levelIndex = 0; levelIndex < levelsCount; levelIndex++)
|
||||||
{
|
{
|
||||||
@ -838,12 +838,12 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return spell;
|
return spell;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSpellHandler::afterLoadFinalization()
|
void CSpellHandler::afterLoadFinalization()
|
||||||
{
|
{
|
||||||
//FIXME: it is a bad place for this code, should refactor loadFromJson to know object id during loading
|
//FIXME: it is a bad place for this code, should refactor loadFromJson to know object id during loading
|
||||||
for(auto spell: objects)
|
for(auto spell: objects)
|
||||||
for(auto & level: spell->levels)
|
for(auto & level: spell->levels)
|
||||||
for(auto & bonus: level.effects)
|
for(auto & bonus: level.effects)
|
||||||
|
@ -23,43 +23,43 @@ struct BattleHex;
|
|||||||
class DLL_LINKAGE CSpell
|
class DLL_LINKAGE CSpell
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct LevelInfo
|
struct LevelInfo
|
||||||
{
|
{
|
||||||
std::string description; //descriptions of spell for skill level
|
std::string description; //descriptions of spell for skill level
|
||||||
si32 cost; //per skill level: 0 - none, 1 - basic, etc
|
si32 cost; //per skill level: 0 - none, 1 - basic, etc
|
||||||
si32 power; //per skill level: 0 - none, 1 - basic, etc
|
si32 power; //per skill level: 0 - none, 1 - basic, etc
|
||||||
si32 AIValue; //AI values: per skill level: 0 - none, 1 - basic, etc
|
si32 AIValue; //AI values: per skill level: 0 - none, 1 - basic, etc
|
||||||
|
|
||||||
bool smartTarget;
|
bool smartTarget;
|
||||||
std::string range;
|
std::string range;
|
||||||
|
|
||||||
std::vector<Bonus> effects;
|
std::vector<Bonus> effects;
|
||||||
|
|
||||||
LevelInfo();
|
LevelInfo();
|
||||||
~LevelInfo();
|
~LevelInfo();
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
h & description & cost & power & AIValue & smartTarget & range & effects;
|
h & description & cost & power & AIValue & smartTarget & range & effects;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Low level accessor. Don`t use it if absolutely necessary
|
/** \brief Low level accessor. Don`t use it if absolutely necessary
|
||||||
*
|
*
|
||||||
* \param level. spell school level
|
* \param level. spell school level
|
||||||
* \return Spell level info structure
|
* \return Spell level info structure
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const CSpell::LevelInfo& getLevelInfo(const int level) const;
|
const CSpell::LevelInfo& getLevelInfo(const int level) const;
|
||||||
public:
|
public:
|
||||||
enum ETargetType {NO_TARGET, CREATURE, OBSTACLE};
|
enum ETargetType {NO_TARGET, CREATURE, OBSTACLE};
|
||||||
enum ESpellPositiveness {NEGATIVE = -1, NEUTRAL = 0, POSITIVE = 1};
|
enum ESpellPositiveness {NEGATIVE = -1, NEUTRAL = 0, POSITIVE = 1};
|
||||||
|
|
||||||
struct TargetInfo
|
struct TargetInfo
|
||||||
{
|
{
|
||||||
ETargetType type;
|
ETargetType type;
|
||||||
bool smart;
|
bool smart;
|
||||||
bool massive;
|
bool massive;
|
||||||
};
|
};
|
||||||
|
|
||||||
SpellID id;
|
SpellID id;
|
||||||
@ -110,12 +110,12 @@ public:
|
|||||||
|
|
||||||
si32 getCost(const int skillLevel) const;
|
si32 getCost(const int skillLevel) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns spell level power, base power ignored
|
* Returns spell level power, base power ignored
|
||||||
*/
|
*/
|
||||||
si32 getPower(const int skillLevel) const;
|
si32 getPower(const int skillLevel) const;
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Returns spell power, taking base power into account
|
// * Returns spell power, taking base power into account
|
||||||
// */
|
// */
|
||||||
// si32 calculatePower(const int skillLevel) const;
|
// si32 calculatePower(const int skillLevel) const;
|
||||||
@ -124,8 +124,8 @@ public:
|
|||||||
si32 getProbability(const TFaction factionId) const;
|
si32 getProbability(const TFaction factionId) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns resource name of icon for SPELL_IMMUNITY bonus
|
* Returns resource name of icon for SPELL_IMMUNITY bonus
|
||||||
*/
|
*/
|
||||||
const std::string& getIconImmune() const;
|
const std::string& getIconImmune() const;
|
||||||
|
|
||||||
const std::string& getCastSound() const;
|
const std::string& getCastSound() const;
|
||||||
@ -133,29 +133,29 @@ public:
|
|||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
h & identifier & id & name & level & earth & water & fire & air & power
|
h & identifier & id & name & level & earth & water & fire & air & power
|
||||||
& probabilities & attributes & combatSpell & creatureAbility & positiveness & counteredSpells & mainEffectAnim;
|
& probabilities & attributes & combatSpell & creatureAbility & positiveness & counteredSpells & mainEffectAnim;
|
||||||
h & isRising & isDamage & isOffensive;
|
h & isRising & isDamage & isOffensive;
|
||||||
h & targetType;
|
h & targetType;
|
||||||
h & immunities & limiters;
|
h & immunities & limiters;
|
||||||
h & iconImmune;
|
h & iconImmune;
|
||||||
h & absoluteImmunities & defaultProbability;
|
h & absoluteImmunities & defaultProbability;
|
||||||
|
|
||||||
h & isSpecial;
|
h & isSpecial;
|
||||||
|
|
||||||
h & castSound & iconBook & iconEffect & iconScenarioBonus & iconScroll;
|
h & castSound & iconBook & iconEffect & iconScenarioBonus & iconScroll;
|
||||||
|
|
||||||
h & levels;
|
h & levels;
|
||||||
|
|
||||||
}
|
}
|
||||||
friend class CSpellHandler;
|
friend class CSpellHandler;
|
||||||
friend class Graphics;
|
friend class Graphics;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setIsOffensive(const bool val);
|
void setIsOffensive(const bool val);
|
||||||
void setIsRising(const bool val);
|
void setIsRising(const bool val);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
si32 defaultProbability;
|
si32 defaultProbability;
|
||||||
|
|
||||||
bool isRising;
|
bool isRising;
|
||||||
bool isDamage;
|
bool isDamage;
|
||||||
@ -198,10 +198,10 @@ public:
|
|||||||
CSpellHandler();
|
CSpellHandler();
|
||||||
virtual ~CSpellHandler();
|
virtual ~CSpellHandler();
|
||||||
|
|
||||||
///IHandler base
|
///IHandler base
|
||||||
|
|
||||||
std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
|
std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
|
||||||
void afterLoadFinalization() override;
|
void afterLoadFinalization() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of default allowed spells. OH3 spells are all allowed by default.
|
* Gets a list of default allowed spells. OH3 spells are all allowed by default.
|
||||||
@ -217,5 +217,5 @@ public:
|
|||||||
h & objects ;
|
h & objects ;
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
CSpell * loadFromJson(const JsonNode & json) override;
|
CSpell * loadFromJson(const JsonNode & json) override;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user