1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Spell scrolls as a reward

This commit is contained in:
Ivan Savenko
2025-05-01 17:59:32 +03:00
parent 62e774c91e
commit 5dec3efa2f
5 changed files with 39 additions and 23 deletions

View File

@@ -206,6 +206,11 @@ int getDwellingArmyCost(const CGObjectInstance * target)
return cost;
}
static uint64_t evaluateSpellScrollArmyValue(const SpellID &)
{
return 1500;
}
static uint64_t evaluateArtifactArmyValue(const CArtifact * art)
{
if(art->getId() == ArtifactID::SPELL_SCROLL)
@@ -265,23 +270,14 @@ uint64_t RewardEvaluator::getArmyReward(
auto rewardValue = 0;
if(!info.reward.grantedArtifacts.empty())
{
for(auto artID : info.reward.grantedArtifacts)
{
const auto * art = artID.toArtifact();
for(auto artID : info.reward.grantedArtifacts)
rewardValue += evaluateArtifactArmyValue(artID.toArtifact());
rewardValue += evaluateArtifactArmyValue(art);
}
}
for(auto scroll : info.reward.scrolls)
rewardValue += evaluateSpellScrollArmyValue(scroll);
if(!info.reward.creatures.empty())
{
for(const auto & stackInfo : info.reward.creatures)
{
rewardValue += stackInfo.getType()->getAIValue() * stackInfo.getCount();
}
}
for(const auto & stackInfo : info.reward.creatures)
rewardValue += stackInfo.getType()->getAIValue() * stackInfo.getCount();
totalValue += rewardValue > 0 ? rewardValue / (info.reward.grantedArtifacts.size() + info.reward.creatures.size()) : 0;
}