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

Move vetDamage total inside instigator check #6110

Open
wants to merge 9 commits into
base: deploy/fafdevelop
Choose a base branch
from
11 changes: 9 additions & 2 deletions lua/defaultcomponents.lua
Expand Up @@ -610,10 +610,12 @@ VeterancyComponent = ClassSimple {

-- optionally, these fields are defined too to inform UI of our veterancy status
if blueprint.VetEnabled then
self:UpdateStat('VetLevel', 0)
self:UpdateStat('VetExperience', 0)
self:UpdateStat('VetLevel', 0)
self:UpdateStat('MassValueKilled', 0)
self.VetExperience = 0
self.VetLevel = 0
self.MassValueKilled = 0
end
end,

Expand All @@ -624,12 +626,12 @@ VeterancyComponent = ClassSimple {
---@param damageType DamageType unused
DoTakeDamage = function(self, instigator, amount, vector, damageType)
amount = MathMin(amount, self:GetMaxHealth())
self.VetDamageTaken = self.VetDamageTaken + amount
if instigator and
instigator.IsUnit and
(not IsDestroyed(instigator)) and
IsEnemy(self.Army, instigator.Army)
then
self.VetDamageTaken = self.VetDamageTaken + amount
local entityId = instigator.EntityId
local vetInstigators = self.VetInstigators
local vetDamage = self.VetDamage
Expand Down Expand Up @@ -665,6 +667,11 @@ VeterancyComponent = ClassSimple {
return
end

-- Update a mass value killed stat, not used
-- by veterancy but potentially useful to the player
self.MassValueKilled = self.MassValueKilled + experience
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other veterancy values start with Vet, I think this one should too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do VetMassKillCredit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about VetMassKilled?

self:UpdateStat('MassValueKilled', self.MassValueKilled)

local currExperience = self.VetExperience
local currLevel = self.VetLevel

Expand Down