require "Insurgent/InsurgentTraitDefinitions"

LoadoutAssaultTrait = CreateInsurgentTrait()
LoadoutAssaultTrait.name = "LoadoutAssault"
LoadoutAssaultTrait.insurgentExclusive = true
LoadoutAssaultTrait.mutualExclusions = {"LoadoutMarksman", "LoadoutRifleman", "LoadoutMachinegunner", "LoadoutRecon"}
LoadoutAssaultTrait.description  = getText("UI_trait_LoadoutAssaultDesc")

function LoadoutAssaultTrait.Create()
    local lAssault = TraitFactory.addTrait("LoadoutAssault", getText("UI_trait_LoadoutAssault"), 4, LoadoutAssaultTrait.description, false, false);
    lAssault:addXPBoost(Perks.Reloading, 1);
    return lAssault;
end

function LoadoutAssaultTrait.OnNewGame(player)
    if not player:HasTrait("LoadoutAssault") then
        return
    end

    player:getInventory():AddItem("Base.Sledgehammer");

    local weapon = InsurgentWeaponUtil.addWeapon(player, "Base.Shotgun", {"Base.ChokeTubeFull", "Base.AmmoStraps"})
    InsurgentWeaponUtil.addMags(player, "Base.ShotgunShellsBox", 8) -- Should still work despite being boxes of shells, not mags
    InsurgentWeaponUtil.equipWeapon(player, weapon) -- Not sure how to load a shotgun yet
end

function LoadoutAssaultTrait.RegisterEvents()
    Events.OnNewGame.Add(LoadoutAssaultTrait.OnNewGame)
end