From 641d59814ba2d53d536edbc03157af0b0592ce78 Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 31 Oct 2024 03:19:41 -0700 Subject: [PATCH] Improve maintainability of UEF ACU enhancements (#6498) --- changelog/snippets/other.6498.md | 1 + units/UEL0001/UEL0001_script.lua | 597 +++++++++++++++++++------------ 2 files changed, 376 insertions(+), 222 deletions(-) create mode 100644 changelog/snippets/other.6498.md diff --git a/changelog/snippets/other.6498.md b/changelog/snippets/other.6498.md new file mode 100644 index 0000000000..6387b72138 --- /dev/null +++ b/changelog/snippets/other.6498.md @@ -0,0 +1 @@ +- (#6498) Refactor the Enhancements section in the Unit script file to replace the long if/else chain with a more modular design. Each enhancement should have its own dedicated function, enabling cleaner code organization and easier maintenance. The CreateEnhancement function will then call the appropriate enhancement function based on specific enhancement criteria. diff --git a/units/UEL0001/UEL0001_script.lua b/units/UEL0001/UEL0001_script.lua index 80dfcab0bc..3be7b2711a 100644 --- a/units/UEL0001/UEL0001_script.lua +++ b/units/UEL0001/UEL0001_script.lua @@ -302,239 +302,392 @@ UEL0001 = ClassUnit(ACUUnit) { attachee:SetDoNotTarget(false) end, + --------------------------------------------------------------------------- + --#region Enhancements + + -- Drone Upgrades + ---@param self UEL0001 - ---@param enh string - CreateEnhancement = function(self, enh) - ACUUnit.CreateEnhancement(self, enh) + ---@param bp Blueprint unused + ProcessEnhancementLeftPod = function(self, bp) + local location = self:GetPosition('AttachSpecial02') + local pod = CreateUnitHPR('UEA0001', self.Army, location[1], location[2], location[3], 0, 0, 0) + pod:SetParent(self, 'LeftPod') + pod:SetCreator(self) + self.Trash:Add(pod) + self.HasLeftPod = true + self.LeftPod = pod + end, - local bp = self:GetBlueprint().Enhancements[enh] - if not bp then return end - if enh == 'LeftPod' then - local location = self:GetPosition('AttachSpecial02') - local pod = CreateUnitHPR('UEA0001', self.Army, location[1], location[2], location[3], 0, 0, 0) - pod:SetParent(self, 'LeftPod') - pod:SetCreator(self) - self.Trash:Add(pod) - self.HasLeftPod = true - self.LeftPod = pod - elseif enh == 'RightPod' then - local location = self:GetPosition('AttachSpecial01') - local pod = CreateUnitHPR('UEA0001', self.Army, location[1], location[2], location[3], 0, 0, 0) - pod:SetParent(self, 'RightPod') - pod:SetCreator(self) - self.Trash:Add(pod) - self.HasRightPod = true - self.RightPod = pod - elseif enh == 'LeftPodRemove' or enh == 'RightPodRemove' then - if self.HasLeftPod == true then - self.HasLeftPod = false - if self.LeftPod and not self.LeftPod.Dead then - self.LeftPod:Kill() - self.LeftPod = nil - end - if self.RebuildingPod ~= nil then - RemoveEconomyEvent(self, self.RebuildingPod) - self.RebuildingPod = nil - end - end - if self.HasRightPod == true then - self.HasRightPod = false - if self.RightPod and not self.RightPod.Dead then - self.RightPod:Kill() - self.RightPod = nil - end - if self.RebuildingPod2 ~= nil then - RemoveEconomyEvent(self, self.RebuildingPod2) - self.RebuildingPod2 = nil - end + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementLeftPodRemove = function(self, bp) + if self.HasLeftPod == true then + self.HasLeftPod = false + if self.LeftPod and not self.LeftPod.Dead then + self.LeftPod:Kill() + self.LeftPod = nil end - KillThread(self.RebuildThread) - KillThread(self.RebuildThread2) - elseif enh == 'Teleporter' then - self:AddCommandCap('RULEUCC_Teleport') - elseif enh == 'TeleporterRemove' then - self:RemoveCommandCap('RULEUCC_Teleport') - elseif enh == 'Shield' then - self:AddToggleCap('RULEUTC_ShieldToggle') - self:CreateShield(bp) - self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0) - self:SetMaintenanceConsumptionActive() - elseif enh == 'ShieldRemove' then - self:DestroyShield() - self:SetMaintenanceConsumptionInactive() - RemoveUnitEnhancement(self, 'ShieldRemove') - self:RemoveToggleCap('RULEUTC_ShieldToggle') - elseif enh == 'ShieldGeneratorField' then - self:AddToggleCap('RULEUTC_ShieldToggle') - self:DestroyShield() - self:ForkThread( - function() - WaitTicks(1) - self:CreateShield(bp) - self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0) - self:SetMaintenanceConsumptionActive() - end - ) - elseif enh == 'ShieldGeneratorFieldRemove' then - self:DestroyShield() - self:SetMaintenanceConsumptionInactive() - self:RemoveToggleCap('RULEUTC_ShieldToggle') - elseif enh == 'AdvancedEngineering' then - local cat = ParseEntityCategory(bp.BuildableCategoryAdds) - self:RemoveBuildRestriction(cat) - if not Buffs['UEFACUT2BuildRate'] then - BuffBlueprint { - Name = 'UEFACUT2BuildRate', - DisplayName = 'UEFACUT2BuildRate', - BuffType = 'ACUBUILDRATE', - Stacks = 'REPLACE', - Duration = -1, - Affects = { - BuildRate = { - Add = bp.NewBuildRate - self:GetBlueprint().Economy.BuildRate, - Mult = 1, - }, - MaxHealth = { - Add = bp.NewHealth, - Mult = 1.0, - }, - Regen = { - Add = bp.NewRegenRate, - Mult = 1.0, - }, - }, - } + if self.RebuildingPod ~= nil then + RemoveEconomyEvent(self, self.RebuildingPod) + self.RebuildingPod = nil end - Buff.ApplyBuff(self, 'UEFACUT2BuildRate') - elseif enh == 'AdvancedEngineeringRemove' then - local bp = self:GetBlueprint().Economy.BuildRate - if not bp then return end - self:RestoreBuildRestrictions() - self:AddBuildRestriction(categories.UEF * - (categories.BUILTBYTIER2COMMANDER + categories.BUILTBYTIER3COMMANDER)) - self:AddBuildRestriction(categories.UEF * - (categories.BUILTBYTIER2COMMANDER + categories.BUILTBYTIER3COMMANDER)) - if Buff.HasBuff(self, 'UEFACUT2BuildRate') then - Buff.RemoveBuff(self, 'UEFACUT2BuildRate') + end + KillThread(self.RebuildThread) + end, + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementRightPod = function(self, bp) + local location = self:GetPosition('AttachSpecial01') + local pod = CreateUnitHPR('UEA0001', self.Army, location[1], location[2], location[3], 0, 0, 0) + pod:SetParent(self, 'RightPod') + pod:SetCreator(self) + self.Trash:Add(pod) + self.HasRightPod = true + self.RightPod = pod + end, + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementRightPodRemove = function(self, bp) + if self.HasLeftPod == true then + self.HasLeftPod = false + if self.LeftPod and not self.LeftPod.Dead then + self.LeftPod:Kill() + self.LeftPod = nil end - elseif enh == 'T3Engineering' then - local cat = ParseEntityCategory(bp.BuildableCategoryAdds) - self:RemoveBuildRestriction(cat) - if not Buffs['UEFACUT3BuildRate'] then - BuffBlueprint { - Name = 'UEFACUT3BuildRate', - DisplayName = 'UEFCUT3BuildRate', - BuffType = 'ACUBUILDRATE', - Stacks = 'REPLACE', - Duration = -1, - Affects = { - BuildRate = { - Add = bp.NewBuildRate - self:GetBlueprint().Economy.BuildRate, - Mult = 1, - }, - MaxHealth = { - Add = bp.NewHealth, - Mult = 1.0, - }, - Regen = { - Add = bp.NewRegenRate, - Mult = 1.0, - }, - }, - } + if self.RebuildingPod ~= nil then + RemoveEconomyEvent(self, self.RebuildingPod) + self.RebuildingPod = nil end - Buff.ApplyBuff(self, 'UEFACUT3BuildRate') - elseif enh == 'T3EngineeringRemove' then - local bp = self:GetBlueprint().Economy.BuildRate - if not bp then return end - self:RestoreBuildRestrictions() - if Buff.HasBuff(self, 'UEFACUT3BuildRate') then - Buff.RemoveBuff(self, 'UEFACUT3BuildRate') + end + if self.HasRightPod == true then + self.HasRightPod = false + if self.RightPod and not self.RightPod.Dead then + self.RightPod:Kill() + self.RightPod = nil end - self:AddBuildRestriction(categories.UEF * - (categories.BUILTBYTIER2COMMANDER + categories.BUILTBYTIER3COMMANDER)) - elseif enh == 'DamageStabilization' then - if not Buffs['UEFACUDamageStabilization'] then - BuffBlueprint { - Name = 'UEFACUDamageStabilization', - DisplayName = 'UEFACUDamageStabilization', - BuffType = 'DamageStabilization', - Stacks = 'REPLACE', - Duration = -1, - Affects = { - MaxHealth = { - Add = bp.NewHealth, - Mult = 1.0, - }, - Regen = { - Add = bp.NewRegenRate, - Mult = 1.0, - }, - }, - } + if self.RebuildingPod2 ~= nil then + RemoveEconomyEvent(self, self.RebuildingPod2) + self.RebuildingPod2 = nil end - Buff.ApplyBuff(self, 'UEFACUDamageStabilization') - elseif enh == 'DamageStabilizationRemove' then - if Buff.HasBuff(self, 'UEFACUDamageStabilization') then - Buff.RemoveBuff(self, 'UEFACUDamageStabilization') + end + KillThread(self.RebuildThread) + KillThread(self.RebuildThread2) + end, + + -- Teleport Upgrade + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementTeleporter = function(self, bp) + self:AddCommandCap('RULEUCC_Teleport') + end, + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementTeleporterRemove = function(self, bp) + self:RemoveCommandCap('RULEUCC_Teleport') + end, + + -- Personal Shield + + ---@param self UEL0001 + ---@param bp Blueprint + ProcessEnhancementShield = function(self, bp) + self:AddToggleCap('RULEUTC_ShieldToggle') + self:CreateShield(bp) + self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0) + self:SetMaintenanceConsumptionActive() + end, + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementShieldRemove = function(self, bp) + self:DestroyShield() + self:SetMaintenanceConsumptionInactive() + RemoveUnitEnhancement(self, 'ShieldRemove') + self:RemoveToggleCap('RULEUTC_ShieldToggle') + end, + + -- Bubble Shield + + ---@param self UEL0001 + ---@param bp Blueprint + ProcessEnhancementShieldGeneratorField = function(self, bp) + self:AddToggleCap('RULEUTC_ShieldToggle') + self:DestroyShield() + self:ForkThread( + function() + WaitTicks(1) + self:CreateShield(bp) + self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0) + self:SetMaintenanceConsumptionActive() end - elseif enh == 'HeavyAntiMatterCannon' then - local wep = self:GetWeaponByLabel('RightZephyr') - wep:AddDamageMod(bp.ZephyrDamageMod) - wep:ChangeMaxRadius(bp.NewMaxRadius or 44) - local oc = self:GetWeaponByLabel('OverCharge') - oc:ChangeMaxRadius(bp.NewMaxRadius or 44) - local aoc = self:GetWeaponByLabel('AutoOverCharge') - aoc:ChangeMaxRadius(bp.NewMaxRadius or 44) - elseif enh == 'HeavyAntiMatterCannonRemove' then - local bp = self:GetBlueprint().Enhancements['HeavyAntiMatterCannon'] - if not bp then return end - local wep = self:GetWeaponByLabel('RightZephyr') - wep:AddDamageMod(-bp.ZephyrDamageMod) - local bpDisrupt = self:GetBlueprint().Weapon[1].MaxRadius - wep:ChangeMaxRadius(bpDisrupt or 22) - local oc = self:GetWeaponByLabel('OverCharge') - oc:ChangeMaxRadius(bpDisrupt or 22) - local aoc = self:GetWeaponByLabel('AutoOverCharge') - aoc:ChangeMaxRadius(bpDisrupt or 22) - elseif enh == 'ResourceAllocation' then - local bp = self:GetBlueprint().Enhancements[enh] - local bpEcon = self:GetBlueprint().Economy - if not bp then return end - self:SetProductionPerSecondEnergy((bp.ProductionPerSecondEnergy + bpEcon.ProductionPerSecondEnergy) or 0) - self:SetProductionPerSecondMass((bp.ProductionPerSecondMass + bpEcon.ProductionPerSecondMass) or 0) - elseif enh == 'ResourceAllocationRemove' then - local bpEcon = self:GetBlueprint().Economy - self:SetProductionPerSecondEnergy(bpEcon.ProductionPerSecondEnergy or 0) - self:SetProductionPerSecondMass(bpEcon.ProductionPerSecondMass or 0) - elseif enh == 'TacticalMissile' then - self:AddCommandCap('RULEUCC_Tactical') - self:AddCommandCap('RULEUCC_SiloBuildTactical') - self:SetWeaponEnabledByLabel('TacMissile', true) - elseif enh == 'TacticalNukeMissile' then - self:RemoveCommandCap('RULEUCC_Tactical') - self:RemoveCommandCap('RULEUCC_SiloBuildTactical') - self:AddCommandCap('RULEUCC_Nuke') - self:AddCommandCap('RULEUCC_SiloBuildNuke') - self:SetWeaponEnabledByLabel('TacMissile', false) - self:SetWeaponEnabledByLabel('TacNukeMissile', true) - local amt = self:GetTacticalSiloAmmoCount() - self:RemoveTacticalSiloAmmo(amt or 0) - self:StopSiloBuild() - elseif enh == 'TacticalMissileRemove' or enh == 'TacticalNukeMissileRemove' then - self:RemoveCommandCap('RULEUCC_Nuke') - self:RemoveCommandCap('RULEUCC_SiloBuildNuke') - self:RemoveCommandCap('RULEUCC_Tactical') - self:RemoveCommandCap('RULEUCC_SiloBuildTactical') - self:SetWeaponEnabledByLabel('TacMissile', false) - self:SetWeaponEnabledByLabel('TacNukeMissile', false) - local amt = self:GetTacticalSiloAmmoCount() - self:RemoveTacticalSiloAmmo(amt or 0) - local amt = self:GetNukeSiloAmmoCount() - self:RemoveNukeSiloAmmo(amt or 0) - self:StopSiloBuild() + ) + end, + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementShieldGeneratorFieldRemove = function(self, bp) + self:DestroyShield() + self:SetMaintenanceConsumptionInactive() + self:RemoveToggleCap('RULEUTC_ShieldToggle') + end, + + -- T2 Engineering Suite + + ---@param self UEL0001 + ---@param bp Blueprint + ProcessEnhancementAdvancedEngineering = function(self, bp) + local cat = ParseEntityCategory(bp.BuildableCategoryAdds) + self:RemoveBuildRestriction(cat) + if not Buffs['UEFACUT2BuildRate'] then + BuffBlueprint { + Name = 'UEFACUT2BuildRate', + DisplayName = 'UEFACUT2BuildRate', + BuffType = 'ACUBUILDRATE', + Stacks = 'REPLACE', + Duration = -1, + Affects = { + BuildRate = { + Add = bp.NewBuildRate - self:GetBlueprint().Economy.BuildRate, + Mult = 1, + }, + MaxHealth = { + Add = bp.NewHealth, + Mult = 1.0, + }, + Regen = { + Add = bp.NewRegenRate, + Mult = 1.0, + }, + }, + } + end + Buff.ApplyBuff(self, 'UEFACUT2BuildRate') + + end, + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementAdvancedEngineeringRemove = function(self, bp) + local bp = self:GetBlueprint().Economy.BuildRate + if not bp then return end + self:RestoreBuildRestrictions() + self:AddBuildRestriction(categories.UEF * + (categories.BUILTBYTIER2COMMANDER + categories.BUILTBYTIER3COMMANDER)) + self:AddBuildRestriction(categories.UEF * + (categories.BUILTBYTIER2COMMANDER + categories.BUILTBYTIER3COMMANDER)) + if Buff.HasBuff(self, 'UEFACUT2BuildRate') then + Buff.RemoveBuff(self, 'UEFACUT2BuildRate') + end + end, + + -- T3 Engineering Suite + + ---@param self UEL0001 + ---@param bp Blueprint + ProcessEnhancementT3Engineering = function(self, bp) + local cat = ParseEntityCategory(bp.BuildableCategoryAdds) + self:RemoveBuildRestriction(cat) + if not Buffs['UEFACUT3BuildRate'] then + BuffBlueprint { + Name = 'UEFACUT3BuildRate', + DisplayName = 'UEFCUT3BuildRate', + BuffType = 'ACUBUILDRATE', + Stacks = 'REPLACE', + Duration = -1, + Affects = { + BuildRate = { + Add = bp.NewBuildRate - self:GetBlueprint().Economy.BuildRate, + Mult = 1, + }, + MaxHealth = { + Add = bp.NewHealth, + Mult = 1.0, + }, + Regen = { + Add = bp.NewRegenRate, + Mult = 1.0, + }, + }, + } + end + Buff.ApplyBuff(self, 'UEFACUT3BuildRate') + + end, + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementT3EngineeringRemove = function(self, bp) + local bp = self:GetBlueprint().Economy.BuildRate + if not bp then return end + self:RestoreBuildRestrictions() + if Buff.HasBuff(self, 'UEFACUT3BuildRate') then + Buff.RemoveBuff(self, 'UEFACUT3BuildRate') + end + self:AddBuildRestriction(categories.UEF * (categories.BUILTBYTIER2COMMANDER + categories.BUILTBYTIER3COMMANDER)) + end, + + -- Nano Repair System + + ---@param self UEL0001 + ---@param bp Blueprint + ProcessEnhancementDamageStabilization = function(self, bp) + if not Buffs['UEFACUDamageStabilization'] then + BuffBlueprint { + Name = 'UEFACUDamageStabilization', + DisplayName = 'UEFACUDamageStabilization', + BuffType = 'DamageStabilization', + Stacks = 'REPLACE', + Duration = -1, + Affects = { + MaxHealth = { + Add = bp.NewHealth, + Mult = 1.0, + }, + Regen = { + Add = bp.NewRegenRate, + Mult = 1.0, + }, + }, + } + end + Buff.ApplyBuff(self, 'UEFACUDamageStabilization') + + end, + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementDamageStabilizationRemove = function(self, bp) + if Buff.HasBuff(self, 'UEFACUDamageStabilization') then + Buff.RemoveBuff(self, 'UEFACUDamageStabilization') + end + end, + + -- Gun Upgrade + + ---@param self UEL0001 + ---@param bp Blueprint + ProcessEnhancementHeavyAntiMatterCannon = function(self, bp) + local wep = self:GetWeaponByLabel('RightZephyr') + wep:AddDamageMod(bp.ZephyrDamageMod) + wep:ChangeMaxRadius(bp.NewMaxRadius or 44) + local oc = self:GetWeaponByLabel('OverCharge') + oc:ChangeMaxRadius(bp.NewMaxRadius or 44) + local aoc = self:GetWeaponByLabel('AutoOverCharge') + aoc:ChangeMaxRadius(bp.NewMaxRadius or 44) + end, + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementHeavyAntiMatterCannonRemove = function(self, bp) + local bp = self:GetBlueprint().Enhancements['HeavyAntiMatterCannon'] + if not bp then return end + local wep = self:GetWeaponByLabel('RightZephyr') + wep:AddDamageMod(-bp.ZephyrDamageMod) + local bpDisrupt = self:GetBlueprint().Weapon[1].MaxRadius + wep:ChangeMaxRadius(bpDisrupt or 22) + local oc = self:GetWeaponByLabel('OverCharge') + oc:ChangeMaxRadius(bpDisrupt or 22) + local aoc = self:GetWeaponByLabel('AutoOverCharge') + aoc:ChangeMaxRadius(bpDisrupt or 22) + end, + + -- RAS + + ---@param self UEL0001 + ---@param bp Blueprint + ProcessEnhancementResourceAllocation = function(self, bp) + local bpEcon = self:GetBlueprint().Economy + if not bp then return end + self:SetProductionPerSecondEnergy((bp.ProductionPerSecondEnergy + bpEcon.ProductionPerSecondEnergy) or 0) + self:SetProductionPerSecondMass((bp.ProductionPerSecondMass + bpEcon.ProductionPerSecondMass) or 0) + + end, + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementResourceAllocationRemove = function(self, bp) + local bpEcon = self:GetBlueprint().Economy + self:SetProductionPerSecondEnergy(bpEcon.ProductionPerSecondEnergy or 0) + self:SetProductionPerSecondMass(bpEcon.ProductionPerSecondMass or 0) + end, + + -- Tactical Missile Launcher + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementTacticalMissile = function(self, bp) + self:AddCommandCap('RULEUCC_Tactical') + self:AddCommandCap('RULEUCC_SiloBuildTactical') + self:SetWeaponEnabledByLabel('TacMissile', true) + end, + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementTacticalMissileRemove = function(self, bp) + self:RemoveCommandCap('RULEUCC_Tactical') + self:RemoveCommandCap('RULEUCC_SiloBuildTactical') + self:SetWeaponEnabledByLabel('TacMissile', false) + local amt = self:GetTacticalSiloAmmoCount() + self:RemoveTacticalSiloAmmo(amt or 0) + self:StopSiloBuild() + end, + + -- Billy Nuke + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementTacticalNukeMissile = function(self, bp) + self:RemoveCommandCap('RULEUCC_Tactical') + self:RemoveCommandCap('RULEUCC_SiloBuildTactical') + self:AddCommandCap('RULEUCC_Nuke') + self:AddCommandCap('RULEUCC_SiloBuildNuke') + self:SetWeaponEnabledByLabel('TacMissile', false) + self:SetWeaponEnabledByLabel('TacNukeMissile', true) + local amt = self:GetTacticalSiloAmmoCount() + self:RemoveTacticalSiloAmmo(amt or 0) + self:StopSiloBuild() + end, + + ---@param self UEL0001 + ---@param bp Blueprint unused + ProcessEnhancementTacticalNukeMissileRemove = function(self, bp) + self:RemoveCommandCap('RULEUCC_Nuke') + self:RemoveCommandCap('RULEUCC_SiloBuildNuke') + self:RemoveCommandCap('RULEUCC_Tactical') + self:RemoveCommandCap('RULEUCC_SiloBuildTactical') + self:SetWeaponEnabledByLabel('TacMissile', false) + self:SetWeaponEnabledByLabel('TacNukeMissile', false) + local amt = self:GetTacticalSiloAmmoCount() + self:RemoveTacticalSiloAmmo(amt or 0) + local amt = self:GetNukeSiloAmmoCount() + self:RemoveNukeSiloAmmo(amt or 0) + self:StopSiloBuild() + end, + + + ---@param self UEL0001 + ---@param enh string + CreateEnhancement = function(self, enh) + ACUUnit.CreateEnhancement(self, enh) + + local bp = self:GetBlueprint().Enhancements[enh] + if not bp then return end + + local ref = 'ProcessEnhancement' .. enh + local handler = self[ref] + if handler then + handler(self, bp) + else + WARN("Missing enhancement: ", enh, " for unit: ", self:GetUnitId(), " note that the function name should be called: ", ref) end end, + + --#endregion } TypeClass = UEL0001