
candyRecipe = {}
candyRecipe.OnCreate = {}
candyRecipe.OnGiveXP = {}







function Recipe.OnCreate.OpenSweetsPackage(items, result, player)
	local candyrand = ZombRand(1,9)
	if candyrand == 1 then
	player:getInventory():AddItems("CCS.ChitChat", 1);
	player:getInventory():AddItems("CCS.Leeroy", 1);
	player:getInventory():AddItems("CCS.SNM", 1);
	player:getInventory():AddItems("CCS.Boreal", 1);
	player:getInventory():AddItems("CCS.Tittles", 1);
	player:Say("Variety pack!(1) SCORE!");

	elseif candyrand == 2 then
	player:getInventory():AddItems("CCS.Snackers", 1);
	player:getInventory():AddItems("CCS.ZersheyBar", 1);
	player:getInventory():AddItems("CCS.4muskepeers", 1);
	player:getInventory():AddItems("CCS.Coffeechisps", 1);
	player:getInventory():AddItems("CCS.Almondjaws", 1);
	player:Say("Variety pack!(2) SCORE!");

	elseif candyrand == 3 then
	player:getInventory():AddItems("CCS.Snackers", 5);
	player:Say("Snackers!");

	elseif candyrand == 4 then
	player:getInventory():AddItems("CCS.Tittles", 5);
	player:Say("Ti.. Ti.. Tittles!");

	elseif candyrand == 5 then
	player:getInventory():AddItems("CCS.SNM", 5);
	player:Say("SNM snacks!");

	elseif candyrand == 6 then
	player:getInventory():AddItems("CCS.Almondjaws", 5);
	player:Say("Almond Jaws for days!");

	elseif candyrand == 7 then
	player:getInventory():AddItems("CCS.4muskepeers", 5);
	player:Say("The 4 Muskepeers");

	elseif candyrand == 8 then
	player:getInventory():AddItems("CCS.Boreal", 5);
	player:Say("More-eo Cookies");

	elseif candyrand == 9 then
	player:getInventory():AddItems("CCS.ZersheyBar", 5);
	player:Say("Stocked up on Zershey Bars for a while");


end
end


function Recipe.OnCreate.OpenBagofRollys(items, result, player)
	player:Say("So one Blue...");
	local rollyrand = ZombRand(100)

	if rollyrand >= 66 then
	player:getInventory():AddItems("CCS.RRBlue", 2);
	player:Say("2 more Blues...");
	elseif rollyrand <= 33 then
	player:getInventory():AddItems("CCS.RRRed", 2);
	player:Say("2 Red...");
	else 
	player:getInventory():AddItems("CCS.RRGreen", 2);
	player:Say("2 Green...");
end

	local rolly2rand = ZombRand(100)

	if rolly2rand >= 66 then
	player:getInventory():AddItems("CCS.RRBlue", 2);
	player:Say("and even more Blue!");
	elseif rolly2rand <= 33 then
	player:getInventory():AddItems("CCS.RRRed", 2);
	player:Say("and 2 Red");
	else 
	player:getInventory():AddItems("CCS.RRGreen", 2);
	player:Say("and 2 Green");
	


end
end


function Recipe.OnGiveXP.Cooking0(recipe, ingredients, result, player)
    player:getXp():AddXP(Perks.Cooking, 0);
end

function OnEat_GumStick(food, player)
        local gumrand = ZombRand(50)

	if gumrand >= 48 then
	player:Say("*gagging sound* O God wrong pipe! Almost chocked to death..");
	else
	player:Say("");
    
   
	end
	end

function OnEat_RedDeath(food, player)
        
	player:Say("I should be careful with these. They could kill me");
    
   
	end
	

function OnEat_GumStickRed(food, character, percent)
local script = food:getScriptItem()
percent = percent * (food:getStressChange() * 100) / script:getStressChange()
    local bodyDamage = character:getBodyDamage()
    local stats = character:getStats()
    if character:HasTrait("Smoker") then
        bodyDamage:setUnhappynessLevel(bodyDamage:getUnhappynessLevel() - 10 * percent);
        if bodyDamage:getUnhappynessLevel() < 0 then
            bodyDamage:setUnhappynessLevel(0);
        end
        stats:setStress(stats:getStress() - 10 * percent);
         if stats:getStress() < 0 then
            stats:setStress(-.25);
        end

		end
        end

   
	

function OnEat_GumStickBlue(food, character, percent)
	local script = food:getScriptItem()
          
    percent = percent * (food:getStressChange() * 100) / script:getStressChange()
    local bodyDamage = character:getBodyDamage()
    local stats = character:getStats()
    if character:HasTrait("Smoker") then
	
	stats:setStress(stats:getStress() - 10 * percent);
        if stats:getStress() < 0 then
        stats:setStress(0);
        end
	
		end

	end
	
    
   
	



OpenSweetsPackage_OnCreate = Recipe.OnCreate.OpenSweetsPackage
