mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Improvements to skeleton transformer logic
This commit is contained in:
@@ -429,6 +429,11 @@
|
|||||||
{
|
{
|
||||||
"type" : "DRAGON_NATURE"
|
"type" : "DRAGON_NATURE"
|
||||||
},
|
},
|
||||||
|
"dragonSkeleton" :
|
||||||
|
{
|
||||||
|
"type" : "SKELETON_TRANSFORMER_TARGET",
|
||||||
|
"subtype" : "boneDragon"
|
||||||
|
},
|
||||||
"canFly" :
|
"canFly" :
|
||||||
{
|
{
|
||||||
"type" : "FLYING"
|
"type" : "FLYING"
|
||||||
@@ -474,6 +479,11 @@
|
|||||||
{
|
{
|
||||||
"type" : "DRAGON_NATURE"
|
"type" : "DRAGON_NATURE"
|
||||||
},
|
},
|
||||||
|
"dragonSkeleton" :
|
||||||
|
{
|
||||||
|
"type" : "SKELETON_TRANSFORMER_TARGET",
|
||||||
|
"subtype" : "boneDragon"
|
||||||
|
},
|
||||||
"canFly" :
|
"canFly" :
|
||||||
{
|
{
|
||||||
"type" : "FLYING"
|
"type" : "FLYING"
|
||||||
|
|||||||
@@ -349,9 +349,10 @@
|
|||||||
{
|
{
|
||||||
"type" : "ATTACKS_ALL_ADJACENT"
|
"type" : "ATTACKS_ALL_ADJACENT"
|
||||||
},
|
},
|
||||||
"draconicSkeleton" :
|
"dragonSkeleton" :
|
||||||
{
|
{
|
||||||
"type" : "DRACONIC_SKELETON"
|
"type" : "SKELETON_TRANSFORMER_TARGET",
|
||||||
|
"subtype" : "boneDragon"
|
||||||
},
|
},
|
||||||
"noRetaliation" :
|
"noRetaliation" :
|
||||||
{
|
{
|
||||||
@@ -389,9 +390,10 @@
|
|||||||
{
|
{
|
||||||
"type" : "ATTACKS_ALL_ADJACENT"
|
"type" : "ATTACKS_ALL_ADJACENT"
|
||||||
},
|
},
|
||||||
"draconicSkeleton" :
|
"dragonSkeleton" :
|
||||||
{
|
{
|
||||||
"type" : "DRACONIC_SKELETON"
|
"type" : "SKELETON_TRANSFORMER_TARGET",
|
||||||
|
"subtype" : "boneDragon"
|
||||||
},
|
},
|
||||||
"noRetaliation" :
|
"noRetaliation" :
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,6 +75,11 @@
|
|||||||
{
|
{
|
||||||
"type" : "DRAGON_NATURE"
|
"type" : "DRAGON_NATURE"
|
||||||
},
|
},
|
||||||
|
"dragonSkeleton" :
|
||||||
|
{
|
||||||
|
"type" : "SKELETON_TRANSFORMER_TARGET",
|
||||||
|
"subtype" : "boneDragon"
|
||||||
|
},
|
||||||
"canFly" :
|
"canFly" :
|
||||||
{
|
{
|
||||||
"type" : "FLYING"
|
"type" : "FLYING"
|
||||||
@@ -135,6 +140,11 @@
|
|||||||
{
|
{
|
||||||
"type" : "DRAGON_NATURE"
|
"type" : "DRAGON_NATURE"
|
||||||
},
|
},
|
||||||
|
"dragonSkeleton" :
|
||||||
|
{
|
||||||
|
"type" : "SKELETON_TRANSFORMER_TARGET",
|
||||||
|
"subtype" : "boneDragon"
|
||||||
|
},
|
||||||
"crystals" :
|
"crystals" :
|
||||||
{
|
{
|
||||||
"type" : "SPECIAL_CRYSTAL_GENERATION"
|
"type" : "SPECIAL_CRYSTAL_GENERATION"
|
||||||
@@ -176,6 +186,11 @@
|
|||||||
{
|
{
|
||||||
"type" : "DRAGON_NATURE"
|
"type" : "DRAGON_NATURE"
|
||||||
},
|
},
|
||||||
|
"dragonSkeleton" :
|
||||||
|
{
|
||||||
|
"type" : "SKELETON_TRANSFORMER_TARGET",
|
||||||
|
"subtype" : "boneDragon"
|
||||||
|
},
|
||||||
"canFly" :
|
"canFly" :
|
||||||
{
|
{
|
||||||
"type" : "FLYING"
|
"type" : "FLYING"
|
||||||
@@ -284,6 +299,11 @@
|
|||||||
{
|
{
|
||||||
"type" : "DRAGON_NATURE"
|
"type" : "DRAGON_NATURE"
|
||||||
},
|
},
|
||||||
|
"dragonSkeleton" :
|
||||||
|
{
|
||||||
|
"type" : "SKELETON_TRANSFORMER_TARGET",
|
||||||
|
"subtype" : "boneDragon"
|
||||||
|
},
|
||||||
"canFly" :
|
"canFly" :
|
||||||
{
|
{
|
||||||
"type" : "FLYING"
|
"type" : "FLYING"
|
||||||
|
|||||||
@@ -366,6 +366,11 @@
|
|||||||
{
|
{
|
||||||
"type" : "DRAGON_NATURE"
|
"type" : "DRAGON_NATURE"
|
||||||
},
|
},
|
||||||
|
"dragonSkeleton" :
|
||||||
|
{
|
||||||
|
"type" : "SKELETON_TRANSFORMER_TARGET",
|
||||||
|
"subtype" : "boneDragon"
|
||||||
|
},
|
||||||
"canFly" :
|
"canFly" :
|
||||||
{
|
{
|
||||||
"type" : "FLYING"
|
"type" : "FLYING"
|
||||||
@@ -411,6 +416,11 @@
|
|||||||
{
|
{
|
||||||
"type" : "DRAGON_NATURE"
|
"type" : "DRAGON_NATURE"
|
||||||
},
|
},
|
||||||
|
"dragonSkeleton" :
|
||||||
|
{
|
||||||
|
"type" : "SKELETON_TRANSFORMER_TARGET",
|
||||||
|
"subtype" : "boneDragon"
|
||||||
|
},
|
||||||
"canFly" :
|
"canFly" :
|
||||||
{
|
{
|
||||||
"type" : "FLYING"
|
"type" : "FLYING"
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ class JsonNode;
|
|||||||
BONUS_NAME(DESTRUCTION) /*kills extra units after hit, subtype = 0 - kill percentage of units, 1 - kill amount, val = chance in percent to trigger, additional info - amount/percentage to kill*/ \
|
BONUS_NAME(DESTRUCTION) /*kills extra units after hit, subtype = 0 - kill percentage of units, 1 - kill amount, val = chance in percent to trigger, additional info - amount/percentage to kill*/ \
|
||||||
BONUS_NAME(SPECIAL_CRYSTAL_GENERATION) /*crystal dragon crystal generation*/ \
|
BONUS_NAME(SPECIAL_CRYSTAL_GENERATION) /*crystal dragon crystal generation*/ \
|
||||||
BONUS_NAME(NO_SPELLCAST_BY_DEFAULT) /*spellcast will not be default attack option for this creature*/ \
|
BONUS_NAME(NO_SPELLCAST_BY_DEFAULT) /*spellcast will not be default attack option for this creature*/ \
|
||||||
BONUS_NAME(DRACONIC_SKELETON) /* for skeleton transformer */ \
|
BONUS_NAME(SKELETON_TRANSFORMER_TARGET) /* for skeleton transformer */ \
|
||||||
BONUS_NAME(SPECIAL_ADD_VALUE_ENCHANT) /*specialty spell like Aenin has, increased effect of spell, additionalInfo = value to add*/\
|
BONUS_NAME(SPECIAL_ADD_VALUE_ENCHANT) /*specialty spell like Aenin has, increased effect of spell, additionalInfo = value to add*/\
|
||||||
BONUS_NAME(SPECIAL_FIXED_VALUE_ENCHANT) /*specialty spell like Melody has, constant spell effect (i.e. 3 luck), additionalInfo = value to fix.*/\
|
BONUS_NAME(SPECIAL_FIXED_VALUE_ENCHANT) /*specialty spell like Melody has, constant spell effect (i.e. 3 luck), additionalInfo = value to fix.*/\
|
||||||
BONUS_NAME(THIEVES_GUILD_ACCESS) \
|
BONUS_NAME(THIEVES_GUILD_ACCESS) \
|
||||||
|
|||||||
@@ -70,9 +70,6 @@ void CArmedInstance::updateMoraleBonusFromArmy()
|
|||||||
std::set<FactionID> factions;
|
std::set<FactionID> factions;
|
||||||
bool hasUndead = false;
|
bool hasUndead = false;
|
||||||
|
|
||||||
const std::string undeadCacheKey = "type_UNDEAD";
|
|
||||||
static const CSelector undeadSelector = Selector::type()(BonusType::UNDEAD);
|
|
||||||
|
|
||||||
for(const auto & slot : Slots())
|
for(const auto & slot : Slots())
|
||||||
{
|
{
|
||||||
const auto * creature = slot.second->getCreatureID().toEntity(LIBRARY);
|
const auto * creature = slot.second->getCreatureID().toEntity(LIBRARY);
|
||||||
@@ -82,7 +79,7 @@ void CArmedInstance::updateMoraleBonusFromArmy()
|
|||||||
if (!hasUndead)
|
if (!hasUndead)
|
||||||
{
|
{
|
||||||
//this is costly check, let's skip it at first undead
|
//this is costly check, let's skip it at first undead
|
||||||
hasUndead |= slot.second->hasBonus(undeadSelector, undeadCacheKey);
|
hasUndead |= slot.second->hasBonusOfType(BonusType::UNDEAD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3254,11 +3254,10 @@ bool CGameHandler::transformInUndead(const IMarket *market, const CGHeroInstance
|
|||||||
//resulting creature - bone dragons or skeletons
|
//resulting creature - bone dragons or skeletons
|
||||||
CreatureID resCreature = CreatureID::SKELETON;
|
CreatureID resCreature = CreatureID::SKELETON;
|
||||||
|
|
||||||
if (!s.hasBonusOfType(BonusType::UNDEAD))
|
auto customTargerBonus = s.getBonusesOfType(BonusType::SKELETON_TRANSFORMER_TARGET);
|
||||||
{
|
if (!customTargerBonus->empty())
|
||||||
if (s.hasBonusOfType(BonusType::DRAGON_NATURE) || s.hasBonusOfType(BonusType::DRACONIC_SKELETON))
|
resCreature = customTargerBonus->front()->subtype.as<CreatureID>();
|
||||||
resCreature = CreatureID::BONE_DRAGON;
|
|
||||||
}
|
|
||||||
changeStackType(StackLocation(army->id, slot), resCreature.toCreature());
|
changeStackType(StackLocation(army->id, slot), resCreature.toCreature());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user