mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Removed remaining integer bonus subtypes from configs
This commit is contained in:
@@ -445,6 +445,7 @@ static void loadBonusSubtype(TBonusSubtype & subtype, BonusType type, const Json
|
||||
case BonusType::SPELL_DAMAGE:
|
||||
case BonusType::SPELLS_OF_SCHOOL:
|
||||
case BonusType::SPELL_DAMAGE_REDUCTION:
|
||||
case BonusType::SPELL_SCHOOL_IMMUNITY:
|
||||
{
|
||||
VLC->identifiers()->requestIdentifier( "spellSchool", node, [&subtype](int32_t identifier)
|
||||
{
|
||||
@@ -475,6 +476,7 @@ static void loadBonusSubtype(TBonusSubtype & subtype, BonusType type, const Json
|
||||
case BonusType::SPECIAL_UPGRADE:
|
||||
case BonusType::HATE:
|
||||
case BonusType::SUMMON_GUARDIANS:
|
||||
case BonusType::MANUAL_CONTROL:
|
||||
{
|
||||
VLC->identifiers()->requestIdentifier( "creature", node, [&subtype](int32_t identifier)
|
||||
{
|
||||
@@ -482,6 +484,10 @@ static void loadBonusSubtype(TBonusSubtype & subtype, BonusType type, const Json
|
||||
});
|
||||
break;
|
||||
}
|
||||
case BonusType::SPELL_IMMUNITY:
|
||||
case BonusType::SPECIAL_ADD_VALUE_ENCHANT:
|
||||
case BonusType::SPECIAL_FIXED_VALUE_ENCHANT:
|
||||
case BonusType::SPECIAL_PECULIAR_ENCHANT:
|
||||
case BonusType::SPECIAL_SPELL_LEV:
|
||||
case BonusType::SPECIFIC_SPELL_DAMAGE:
|
||||
case BonusType::SPELL:
|
||||
@@ -497,6 +503,7 @@ static void loadBonusSubtype(TBonusSubtype & subtype, BonusType type, const Json
|
||||
case BonusType::SPECIFIC_SPELL_POWER:
|
||||
case BonusType::ENCHANTED:
|
||||
case BonusType::MORE_DAMAGE_FROM_SPELL:
|
||||
case BonusType::NOT_ACTIVE:
|
||||
{
|
||||
VLC->identifiers()->requestIdentifier( "spell", node, [&subtype](int32_t identifier)
|
||||
{
|
||||
@@ -515,7 +522,6 @@ static void loadBonusSubtype(TBonusSubtype & subtype, BonusType type, const Json
|
||||
case BonusType::MOVEMENT:
|
||||
case BonusType::WATER_WALKING:
|
||||
case BonusType::FLYING_MOVEMENT:
|
||||
case BonusType::SPECIAL_PECULIAR_ENCHANT:
|
||||
case BonusType::NEGATE_ALL_NATURAL_IMMUNITIES:
|
||||
case BonusType::CREATURE_DAMAGE:
|
||||
case BonusType::FLYING:
|
||||
@@ -548,21 +554,21 @@ static void loadBonusSourceInstance(TBonusSourceID & sourceInstance, BonusSource
|
||||
{
|
||||
if (node.isNull())
|
||||
{
|
||||
sourceInstance = TBonusSourceID();
|
||||
sourceInstance = BonusSourceID();
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.isNumber()) // Compatibility code for 1.3 or older
|
||||
{
|
||||
logMod->warn("Bonus source must be string!");
|
||||
sourceInstance = TBonusSourceID(node.Integer());
|
||||
sourceInstance = BonusSourceID(node.Integer());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!node.isString())
|
||||
{
|
||||
logMod->warn("Bonus source must be string!");
|
||||
sourceInstance = TBonusSourceID();
|
||||
sourceInstance = BonusSourceID();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1039,7 +1045,7 @@ bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b)
|
||||
else
|
||||
b->type = it->second;
|
||||
|
||||
loadBonusSubtype(b->subtype, b->type, params->isConverted ? params->toJson() : ability);
|
||||
loadBonusSubtype(b->subtype, b->type, params->isConverted ? params->toJson()["subtype"] : ability["subtype"]);
|
||||
|
||||
if(!params->isConverted)
|
||||
{
|
||||
|
||||
@@ -353,6 +353,7 @@ const JsonNode & BonusParams::toJson()
|
||||
ret["targetSourceType"].String() = vstd::findKey(bonusSourceMap, *targetType);
|
||||
jsonCreated = true;
|
||||
}
|
||||
ret.setMeta(ModScope::scopeGame());
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
@@ -42,6 +42,46 @@ CIdentifierStorage::CIdentifierStorage()
|
||||
registerObject(ModScope::scopeBuiltin(), "primSkill", NPrimarySkill::names[i], i);
|
||||
registerObject(ModScope::scopeBuiltin(), "primarySkill", NPrimarySkill::names[i], i);
|
||||
}
|
||||
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "creatureDamageBoth", 0);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "creatureDamageMin", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "creatureDamageMax", 2);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "damageTypeAll", -1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "damageTypeMelee", 0);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "damageTypeRanged", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "heroMovementLand", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "heroMovementSea", 0);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "heroMovementPenalty", 2);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "heroMovementFull", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "deathStareGorgon", 0);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "deathStareCommander", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "rebirthRegular", 0);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "rebirthSpecial", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "visionsMonsters", 0);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "visionsHeroes", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "visionsTowns", 2);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "immunityBattleWide", 0);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "immunityEnemyHero", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "transmutationPerHealth", 0);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "transmutationPerUnit", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "destructionKillPercentage", 0);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "destructionKillAmount", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "soulStealPermanent", 0);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "soulStealBattle", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "movementFlying", 0);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "movementTeleporting", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "spellLevel1", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "spellLevel2", 2);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "spellLevel3", 3);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "spellLevel4", 4);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "spellLevel5", 5);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "creatureLevel1", 1);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "creatureLevel2", 2);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "creatureLevel3", 3);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "creatureLevel4", 4);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "creatureLevel5", 5);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "creatureLevel6", 6);
|
||||
registerObject(ModScope::scopeBuiltin(), "bonusSubtype", "creatureLevel7", 7);
|
||||
}
|
||||
|
||||
void CIdentifierStorage::checkIdentifier(std::string & ID)
|
||||
@@ -107,7 +147,7 @@ CIdentifierStorage::ObjectCallback CIdentifierStorage::ObjectCallback::fromNameA
|
||||
if(!typeAndName.first.empty())
|
||||
{
|
||||
if (typeAndName.first != type)
|
||||
logMod->error("Identifier '%s' from mod '%s' requested with different type! Type '%s' expected!", fullName, scope, type);
|
||||
logMod->warn("Identifier '%s' from mod '%s' requested with different type! Type '%s' expected!", fullName, scope, type);
|
||||
else
|
||||
logMod->debug("Target type for identifier '%s' defined in mod '%s' is redundant!", fullName, scope);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user