Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Incorrect Actor Property Values #756

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Code/client/Games/Skyrim/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,14 @@ void Actor::SetActorValue(uint32_t aId, float aValue) noexcept

void Actor::ForceActorValue(ActorValueOwner::ForceMode aMode, uint32_t aId, float aValue) noexcept
{
const float current = GetActorValue(aId);
actorValueOwner.ForceCurrent(aMode, aId, aValue - current);
float initialValue = aMode == ActorValueOwner::ForceMode::PERMANENT
? GetActorPermanentValue(aId)
: GetActorValue(aId);

if (aValue == initialValue)
return;

actorValueOwner.ForceCurrent(aMode, aId, aValue - initialValue);
}

Inventory Actor::GetActorInventory() const noexcept
Expand Down Expand Up @@ -716,16 +722,10 @@ void Actor::SetMagicEquipment(const MagicEquipment& acEquipment) noexcept
void Actor::SetActorValues(const ActorValues& acActorValues) noexcept
{
for (auto& value : acActorValues.ActorMaxValuesList)
{
float current = actorValueOwner.GetValue(value.first);
actorValueOwner.ForceCurrent(ActorValueOwner::ForceMode::PERMANENT, value.first, value.second - current);
}
ForceActorValue(ActorValueOwner::ForceMode::PERMANENT, value.first, value.second);

for (auto& value : acActorValues.ActorValuesList)
{
float current = actorValueOwner.GetValue(value.first);
actorValueOwner.ForceCurrent(ActorValueOwner::ForceMode::DAMAGE, value.first, value.second - current);
}
ForceActorValue(ActorValueOwner::ForceMode::DAMAGE, value.first, value.second);
}

void Actor::SetFactions(const Factions& acFactions) noexcept
Expand Down
Loading