require "Insurgent/InsurgentTraitDefinitions"

LoadoutPistoleerTrait = CreateInsurgentTrait()
LoadoutPistoleerTrait.name = "LoadoutPistoleer"
LoadoutPistoleerTrait.insurgentExclusive = true
LoadoutPistoleerTrait.description  = getText("UI_trait_LoadoutPistoleerDesc")

function LoadoutPistoleerTrait.Create()
    local lPistoleer = TraitFactory.addTrait("LoadoutPistoleer", getText("UI_trait_LoadoutPistoleer"), 2, LoadoutPistoleerTrait.description, false, false);
	lPistoleer:addXPBoost(Perks.Reloading, 1);
    return lPistoleer;
end

function LoadoutPistoleerTrait.OnNewGame(player)
    if not player:HasTrait("LoadoutPistoleer") then
        return
    end

    local weapon = InsurgentWeaponUtil.addWeapon(player, "Base.Pistol2", {"Base.RedDot", "Base.Laser"})
    InsurgentWeaponUtil.addMags(player, "Base.45Clip", 4)
end

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