mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Use ArtifactInstanceID in CGArtifact
This commit is contained in:
@@ -238,7 +238,7 @@ uint64_t RewardEvaluator::getArmyReward(
|
||||
case Obj::SPELL_SCROLL:
|
||||
//FALL_THROUGH
|
||||
case Obj::ARTIFACT:
|
||||
return evaluateArtifactArmyValue(dynamic_cast<const CGArtifact *>(target)->storedArtifact->getType());
|
||||
return evaluateArtifactArmyValue(dynamic_cast<const CGArtifact *>(target)->getArtifactInstance()->getType());
|
||||
case Obj::HERO:
|
||||
return relations == PlayerRelations::ENEMIES
|
||||
? enemyArmyEliminationRewardRatio * dynamic_cast<const CGHeroInstance *>(target)->getArmyStrength()
|
||||
|
||||
@@ -92,7 +92,7 @@ std::optional<int> MapObjectsEvaluator::getObjectValue(const CGObjectInstance *
|
||||
else if(obj->ID == Obj::ARTIFACT)
|
||||
{
|
||||
auto artifactObject = dynamic_cast<const CGArtifact *>(obj);
|
||||
switch(artifactObject->storedArtifact->getType()->aClass)
|
||||
switch(artifactObject->getArtifactInstance()->getType()->aClass)
|
||||
{
|
||||
case CArtifact::EartClass::ART_TREASURE:
|
||||
return 2000;
|
||||
@@ -111,7 +111,7 @@ std::optional<int> MapObjectsEvaluator::getObjectValue(const CGObjectInstance *
|
||||
else if(obj->ID == Obj::SPELL_SCROLL)
|
||||
{
|
||||
auto scrollObject = dynamic_cast<const CGArtifact *>(obj);
|
||||
auto spell = scrollObject->storedArtifact->getScrollSpellID().toSpell();
|
||||
auto spell = scrollObject->getArtifactInstance()->getScrollSpellID().toSpell();
|
||||
if(spell)
|
||||
{
|
||||
switch(spell->getLevel())
|
||||
@@ -126,7 +126,7 @@ std::optional<int> MapObjectsEvaluator::getObjectValue(const CGObjectInstance *
|
||||
}
|
||||
}
|
||||
else
|
||||
logAi->warn("AI found spell scroll with invalid spell ID: %s", scrollObject->storedArtifact->getScrollSpellID());
|
||||
logAi->warn("AI found spell scroll with invalid spell ID: %s", scrollObject->getArtifactInstance()->getScrollSpellID());
|
||||
}
|
||||
|
||||
return getObjectValue(obj->ID, obj->subID);
|
||||
|
||||
@@ -1764,7 +1764,7 @@ const CGObjectInstance * VCAI::lookForArt(ArtifactID aid) const
|
||||
{
|
||||
for(const CGObjectInstance * obj : ai->visitableObjs)
|
||||
{
|
||||
if(obj->ID == Obj::ARTIFACT && dynamic_cast<const CGArtifact *>(obj)->getArtifact() == aid)
|
||||
if(obj->ID == Obj::ARTIFACT && dynamic_cast<const CGArtifact *>(obj)->getArtifactType() == aid)
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user