1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Merge pull request #4563 from SoundSSGood/vcmiScrolls

Improvements to the artifact creation
This commit is contained in:
Ivan Savenko
2024-09-05 17:10:13 +03:00
committed by GitHub
26 changed files with 168 additions and 150 deletions

View File

@@ -957,14 +957,15 @@ bool CMapLoaderH3M::loadArtifactToSlot(CGHeroInstance * hero, int slot)
// H3 bug workaround - Enemy hero on 3rd scenario of Good1.h3c campaign ("Long Live The Queen")
// He has Shackles of War (normally - MISC slot artifact) in LEFT_HAND slot set in editor
// Artifact seems to be missing in game, so skip artifacts that don't fit target slot
auto * artifact = ArtifactUtils::createArtifact(map, artifactID);
if(artifact->canBePutAt(hero, ArtifactPosition(slot)))
if(ArtifactID(artifactID).toArtifact()->canBePutAt(hero, ArtifactPosition(slot)))
{
auto * artifact = ArtifactUtils::createArtifact(artifactID);
artifact->putAt(*hero, ArtifactPosition(slot));
map->addNewArtifactInstance(artifact);
}
else
{
logGlobal->warn("Map '%s': Artifact '%s' can't be put at the slot %d", mapName, artifact->artType->getNameTranslated(), slot);
logGlobal->warn("Map '%s': Artifact '%s' can't be put at the slot %d", mapName, ArtifactID(artifactID).toArtifact()->getNameTranslated(), slot);
return false;
}
@@ -1308,7 +1309,8 @@ CGObjectInstance * CMapLoaderH3M::readArtifact(const int3 & mapPosition, std::sh
artID = ArtifactID(objectTemplate->subid);
}
object->storedArtifact = ArtifactUtils::createArtifact(map, artID, spellID.getNum());
object->storedArtifact = ArtifactUtils::createArtifact(artID, spellID.getNum());
map->addNewArtifactInstance(object->storedArtifact);
return object;
}