require "Insurgent/InsurgentTraitDefinitions"

SurvivalSpecialistTrait = CreateInsurgentTrait()
SurvivalSpecialistTrait.name = "SurvivalSpecialist"
SurvivalSpecialistTrait.insurgentExclusive = true

function SurvivalSpecialistTrait.Create()
    local survivalspecialist = TraitFactory.addTrait("SurvivalSpecialist", getText("UI_trait_SurvivalSpecialist"), 4, getText("UI_trait_SurvivalSpecialistDesc"), false, false);
	survivalspecialist:addXPBoost(Perks.PlantScavenging, 3);
	survivalspecialist:addXPBoost(Perks.Trapping, 3);
	survivalspecialist:addXPBoost(Perks.Fishing, 3);
	survivalspecialist:addXPBoost(Perks.Farming, 3);
	survivalspecialist:addXPBoost(Perks.Axe, 2);
    survivalspecialist:getFreeRecipes():add("Herbalist");
    survivalspecialist:getFreeRecipes():add("Make Mildew Cure");
	survivalspecialist:getFreeRecipes():add("Make Flies Cure");
    survivalspecialist:getFreeRecipes():add("Make Fishing Rod");
    survivalspecialist:getFreeRecipes():add("Fix Fishing Rod");
    survivalspecialist:getFreeRecipes():add("Get Wire Back");
    survivalspecialist:getFreeRecipes():add("Make Fishing Net");
	survivalspecialist:getFreeRecipes():add("Make Stick Trap");
    survivalspecialist:getFreeRecipes():add("Make Snare Trap");
    survivalspecialist:getFreeRecipes():add("Make Wooden Cage Trap");
	survivalspecialist:getFreeRecipes():add("Make Trap Box");
    survivalspecialist:getFreeRecipes():add("Make Cage Trap");
    return survivalspecialist;
end

function SurvivalSpecialistTrait.OnNewGame(player)
    if player:HasTrait("SurvivalSpecialist") then
        local inv = player:getInventory();
        inv:AddItems("camping.CampingTentKit", 1);		
        inv:AddItems("camping.CampfireKit", 1);				
        inv:AddItems("Base.Matches", 1);
        inv:AddItems("Base.HandAxe", 1);
    end	
end

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