1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Improvements to skeleton transformer logic

This commit is contained in:
Ivan Savenko
2025-06-11 12:22:53 +03:00
parent 0979f409c7
commit 0e2463f9c4
7 changed files with 52 additions and 14 deletions

View File

@@ -429,6 +429,11 @@
{
"type" : "DRAGON_NATURE"
},
"dragonSkeleton" :
{
"type" : "SKELETON_TRANSFORMER_TARGET",
"subtype" : "boneDragon"
},
"canFly" :
{
"type" : "FLYING"
@@ -474,6 +479,11 @@
{
"type" : "DRAGON_NATURE"
},
"dragonSkeleton" :
{
"type" : "SKELETON_TRANSFORMER_TARGET",
"subtype" : "boneDragon"
},
"canFly" :
{
"type" : "FLYING"

View File

@@ -349,9 +349,10 @@
{
"type" : "ATTACKS_ALL_ADJACENT"
},
"draconicSkeleton" :
"dragonSkeleton" :
{
"type" : "DRACONIC_SKELETON"
"type" : "SKELETON_TRANSFORMER_TARGET",
"subtype" : "boneDragon"
},
"noRetaliation" :
{
@@ -389,9 +390,10 @@
{
"type" : "ATTACKS_ALL_ADJACENT"
},
"draconicSkeleton" :
"dragonSkeleton" :
{
"type" : "DRACONIC_SKELETON"
"type" : "SKELETON_TRANSFORMER_TARGET",
"subtype" : "boneDragon"
},
"noRetaliation" :
{

View File

@@ -75,6 +75,11 @@
{
"type" : "DRAGON_NATURE"
},
"dragonSkeleton" :
{
"type" : "SKELETON_TRANSFORMER_TARGET",
"subtype" : "boneDragon"
},
"canFly" :
{
"type" : "FLYING"
@@ -135,6 +140,11 @@
{
"type" : "DRAGON_NATURE"
},
"dragonSkeleton" :
{
"type" : "SKELETON_TRANSFORMER_TARGET",
"subtype" : "boneDragon"
},
"crystals" :
{
"type" : "SPECIAL_CRYSTAL_GENERATION"
@@ -176,6 +186,11 @@
{
"type" : "DRAGON_NATURE"
},
"dragonSkeleton" :
{
"type" : "SKELETON_TRANSFORMER_TARGET",
"subtype" : "boneDragon"
},
"canFly" :
{
"type" : "FLYING"
@@ -284,6 +299,11 @@
{
"type" : "DRAGON_NATURE"
},
"dragonSkeleton" :
{
"type" : "SKELETON_TRANSFORMER_TARGET",
"subtype" : "boneDragon"
},
"canFly" :
{
"type" : "FLYING"

View File

@@ -366,6 +366,11 @@
{
"type" : "DRAGON_NATURE"
},
"dragonSkeleton" :
{
"type" : "SKELETON_TRANSFORMER_TARGET",
"subtype" : "boneDragon"
},
"canFly" :
{
"type" : "FLYING"
@@ -411,6 +416,11 @@
{
"type" : "DRAGON_NATURE"
},
"dragonSkeleton" :
{
"type" : "SKELETON_TRANSFORMER_TARGET",
"subtype" : "boneDragon"
},
"canFly" :
{
"type" : "FLYING"

View File

@@ -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(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(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_FIXED_VALUE_ENCHANT) /*specialty spell like Melody has, constant spell effect (i.e. 3 luck), additionalInfo = value to fix.*/\
BONUS_NAME(THIEVES_GUILD_ACCESS) \

View File

@@ -70,9 +70,6 @@ void CArmedInstance::updateMoraleBonusFromArmy()
std::set<FactionID> factions;
bool hasUndead = false;
const std::string undeadCacheKey = "type_UNDEAD";
static const CSelector undeadSelector = Selector::type()(BonusType::UNDEAD);
for(const auto & slot : Slots())
{
const auto * creature = slot.second->getCreatureID().toEntity(LIBRARY);
@@ -82,7 +79,7 @@ void CArmedInstance::updateMoraleBonusFromArmy()
if (!hasUndead)
{
//this is costly check, let's skip it at first undead
hasUndead |= slot.second->hasBonus(undeadSelector, undeadCacheKey);
hasUndead |= slot.second->hasBonusOfType(BonusType::UNDEAD);
}
}

View File

@@ -3254,11 +3254,10 @@ bool CGameHandler::transformInUndead(const IMarket *market, const CGHeroInstance
//resulting creature - bone dragons or skeletons
CreatureID resCreature = CreatureID::SKELETON;
if (!s.hasBonusOfType(BonusType::UNDEAD))
{
if (s.hasBonusOfType(BonusType::DRAGON_NATURE) || s.hasBonusOfType(BonusType::DRACONIC_SKELETON))
resCreature = CreatureID::BONE_DRAGON;
}
auto customTargerBonus = s.getBonusesOfType(BonusType::SKELETON_TRANSFORMER_TARGET);
if (!customTargerBonus->empty())
resCreature = customTargerBonus->front()->subtype.as<CreatureID>();
changeStackType(StackLocation(army->id, slot), resCreature.toCreature());
return true;
}