do

local CBFP_oldURL0301 = URL0301

URL0301 = Class(CBFP_oldURL0301) {

    CreateEnhancement = function(self, enh)
        local bp = self:GetBlueprint().Enhancements[enh]
        if not bp then return end

        if enh == 'SelfRepairSystem' then
            # added by brute51 - fix for bug SCU regen upgrade doesnt stack with veteran bonus [140]
            CWalkingLandUnit.CreateEnhancement(self, enh)
            local bpRegenRate = self:GetBlueprint().Enhancements.SelfRepairSystem.NewRegenRate or 0
            if not Buffs['CybranSCURegenerateBonus'] then
               BuffBlueprint {
                    Name = 'CybranSCURegenerateBonus',
                    DisplayName = 'CybranSCURegenerateBonus',
                    BuffType = 'SCUREGENERATEBONUS',
                    Stacks = 'ALWAYS',
                    Duration = -1,
                    Affects = {
                        Regen = {
                            Add = bpRegenRate,
                            Mult = 1.0,
                        },
                    },
                } 
            end
            if Buff.HasBuff( self, 'CybranSCURegenerateBonus' ) then
                Buff.RemoveBuff( self, 'CybranSCURegenerateBonus' )
            end  
            Buff.ApplyBuff(self, 'CybranSCURegenerateBonus')
        elseif enh == 'SelfRepairSystemRemove' then
            # added by brute51 - fix for bug SCU regen upgrade doesnt stack with veteran bonus [140]
            CWalkingLandUnit.CreateEnhancement(self, enh)
            if Buff.HasBuff( self, 'CybranSCURegenerateBonus' ) then
                Buff.RemoveBuff( self, 'CybranSCURegenerateBonus' )
            end
        else
            CBFP_oldURL0301.CreateEnhancement(self, enh)
        end
    end,
 
}

TypeClass = URL0301

end