require "Insurgent/InsurgentTraitDefinitions"

CombatEngineerTrait = CreateInsurgentTrait()
CombatEngineerTrait.name = "CombatEngineer"
CombatEngineerTrait.insurgentExclusive = true

function CombatEngineerTrait.Create()
    local combatengineer = TraitFactory.addTrait("CombatEngineer", getText("UI_trait_CombatEngineer"), 4, getText("UI_trait_CombatEngineerDesc"), false, false);
	combatengineer:addXPBoost(Perks.Mechanics, 3);
	combatengineer:addXPBoost(Perks.Woodwork, 2);
	combatengineer:addXPBoost(Perks.MetalWelding, 3);
	combatengineer:addXPBoost(Perks.Maintenance, 1);
	combatengineer:getFreeRecipes():add("Basic Mechanics");
    combatengineer:getFreeRecipes():add("Intermediate Mechanics");
    combatengineer:getFreeRecipes():add("Advanced Mechanics")
    combatengineer:getFreeRecipes():add("Make Metal Walls");
    combatengineer:getFreeRecipes():add("Make Metal Fences");
    combatengineer:getFreeRecipes():add("Make Metal Containers");
    combatengineer:getFreeRecipes():add("Make Metal Sheet");
    combatengineer:getFreeRecipes():add("Make Small Metal Sheet");
    combatengineer:getFreeRecipes():add("Make Metal Roof");
	combatengineer:getFreeRecipes():add("Make Remote Controller V1");
    combatengineer:getFreeRecipes():add("Make Remote Controller V2");
    combatengineer:getFreeRecipes():add("Make Remote Controller V3");
    combatengineer:getFreeRecipes():add("Make Remote Trigger");
    combatengineer:getFreeRecipes():add("Make Timer");
    return combatengineer
end

function CombatEngineerTrait.OnNewGame(player)
    if player:HasTrait("CombatEngineer") then
        local inv = player:getInventory();
        inv:AddItems("Base.NoiseTrap", 3);
        inv:AddItems("Base.Base.SmokeBomb", 3);			
        inv:AddItems("Base.BallPeenHammer", 1);			
        inv:AddItems("Base.BlowTorch", 1);
        inv:AddItems("Base.WeldingMask", 1);
    end	
end

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