require "Insurgent/InsurgentTraitDefinitions"

DemolitionsSpecialistTrait = CreateInsurgentTrait()
DemolitionsSpecialistTrait.name = "DemolitionsSpecialist"
DemolitionsSpecialistTrait.insurgentExclusive = true

function DemolitionsSpecialistTrait.Create()
    local demolitionsspecialist = TraitFactory.addTrait("DemolitionsSpecialist", getText("UI_trait_DemolitionsSpecialist"), 4, getText("UI_trait_DemolitionsSpecialistDesc"), false, false);
	demolitionsspecialist:addXPBoost(Perks.Electricity, 1);
    demolitionsspecialist:getFreeRecipes():add("Make Remote Controller V1");
    demolitionsspecialist:getFreeRecipes():add("Make Remote Controller V2");
    demolitionsspecialist:getFreeRecipes():add("Make Remote Controller V3");
    demolitionsspecialist:getFreeRecipes():add("Make Remote Trigger");
    demolitionsspecialist:getFreeRecipes():add("Make Timer");	
    demolitionsspecialist:getFreeRecipes():add("Make Aerosol bomb");
    demolitionsspecialist:getFreeRecipes():add("Make Flame bomb");
    demolitionsspecialist:getFreeRecipes():add("Make Pipe bomb");
    demolitionsspecialist:getFreeRecipes():add("Make Smoke Bomb");
    return demolitionsspecialist;
end

function DemolitionsSpecialistTrait.OnNewGame(player)
    if player:HasTrait("DemolitionsSpecialist") then
        local inv = player:getInventory();
        inv:AddItems("Base.PipeBomb", 3);	
        inv:AddItems("Base.FlameTrap", 3);
        inv:AddItems("Base.Base.SmokeBomb", 3);
    end	
end

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