mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-17 20:58:07 +02:00
Fix components problem
This commit is contained in:
parent
44d72dce51
commit
e3538f24ab
@ -51,11 +51,6 @@ void CRewardableConstructor::configureObject(CGObjectInstance * object, CRandomG
|
||||
{
|
||||
bonus.source = BonusSource::OBJECT;
|
||||
bonus.sid = rewardableObject->ID;
|
||||
//TODO: bonus.description = object->getObjectName();
|
||||
if (bonus.type == BonusType::MORALE)
|
||||
rewardInfo.reward.extraComponents.emplace_back(Component::EComponentType::MORALE, 0, bonus.val, 0);
|
||||
if (bonus.type == BonusType::LUCK)
|
||||
rewardInfo.reward.extraComponents.emplace_back(Component::EComponentType::LUCK, 0, bonus.val, 0);
|
||||
}
|
||||
}
|
||||
assert(!rewardableObject->configuration.info.empty());
|
||||
|
@ -307,10 +307,6 @@ void CTownRewardableBuilding::initObj(CRandomGenerator & rand)
|
||||
{
|
||||
bonus.source = BonusSource::TOWN_STRUCTURE;
|
||||
bonus.sid = bID;
|
||||
if (bonus.type == BonusType::MORALE)
|
||||
rewardInfo.reward.extraComponents.emplace_back(Component::EComponentType::MORALE, 0, bonus.val, 0);
|
||||
if (bonus.type == BonusType::LUCK)
|
||||
rewardInfo.reward.extraComponents.emplace_back(Component::EComponentType::LUCK, 0, bonus.val, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1024,8 +1024,10 @@ void CMapLoaderH3M::readBoxContent(CGPandoraBox * object, const int3 & mapPositi
|
||||
|
||||
reward.heroExperience = reader->readUInt32();
|
||||
reward.manaDiff = reader->readInt32();
|
||||
reward.bonuses.emplace_back(BonusDuration::ONE_BATTLE, BonusType::MORALE, BonusSource::OBJECT, reader->readUInt8(), idToBeGiven);
|
||||
reward.bonuses.emplace_back(BonusDuration::ONE_BATTLE, BonusType::LUCK, BonusSource::OBJECT, reader->readUInt8(), idToBeGiven);
|
||||
if(auto val = reader->readUInt8())
|
||||
reward.bonuses.emplace_back(BonusDuration::ONE_BATTLE, BonusType::MORALE, BonusSource::OBJECT, val, idToBeGiven);
|
||||
if(auto val = reader->readUInt8())
|
||||
reward.bonuses.emplace_back(BonusDuration::ONE_BATTLE, BonusType::LUCK, BonusSource::OBJECT, val, idToBeGiven);
|
||||
|
||||
reader->readResourses(reward.resources);
|
||||
for(int x = 0; x < GameConstants::PRIMARY_SKILLS; ++x)
|
||||
|
@ -61,7 +61,15 @@ void Rewardable::Reward::loadComponents(std::vector<Component> & comps,
|
||||
{
|
||||
for (auto comp : extraComponents)
|
||||
comps.push_back(comp);
|
||||
|
||||
|
||||
for (auto & bonus : bonuses)
|
||||
{
|
||||
if (bonus.type == BonusType::MORALE)
|
||||
comps.emplace_back(Component::EComponentType::MORALE, 0, bonus.val, 0);
|
||||
if (bonus.type == BonusType::LUCK)
|
||||
comps.emplace_back(Component::EComponentType::LUCK, 0, bonus.val, 0);
|
||||
}
|
||||
|
||||
if (heroExperience)
|
||||
{
|
||||
comps.emplace_back(Component::EComponentType::EXPERIENCE, 0, static_cast<si32>(h->calculateXp(heroExperience)), 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user