
------------------------------------------------Variables------------------------------------------------

require( "package/typedef.lua" );
require( "package/leveldesign/ld_variables_define.lua" );
DebugOut( "create knowledge tree (file : package/leveldesign/knowledge_tree.lua)" );

------------------------------------------------------------------------------------------------

function F_knowledge_upgrade_level( fValue )
	SetFaerieGainedFactor ( G_faerie_gain_factor + G_faerie_gain_factor * fValue);
end

function F_knowledge_upgrade_to_level_1()
	F_knowledge_upgrade_level( G_knowledge_tree_knowledge1_effect_factor );
	LogGameEvent( "Feerie 1", Tome_buy_event );
end
function F_knowledge_upgrade_to_level_2()
	F_knowledge_upgrade_level( G_knowledge_tree_knowledge2_effect_factor );
	LogGameEvent( "Feerie 2", Tome_buy_event );
end
function F_knowledge_upgrade_to_level_3()
	F_knowledge_upgrade_level( G_knowledge_tree_knowledge3_effect_factor );
	LogGameEvent( "Feerie 3", Tome_buy_event );
end
function F_knowledge_upgrade_to_level_4()
	F_knowledge_upgrade_level( G_knowledge_tree_knowledge4_effect_factor );
	LogGameEvent( "Feerie 4", Tome_buy_event );
end

KnowledgeTree
{
  name = "SavoirTree",
  type = Knowledge,
  
  KnowledgeNode
  {
    name = "savoir1",
    callback_reached = "",
	modifications_function = "F_knowledge_upgrade_to_level_1",
    
    price = G_knowledge_tree_knowledge1_cost,
  },
  
  KnowledgeNode
  {
    name = "savoir2",
    callback_reached = "",
	modifications_function = "F_knowledge_upgrade_to_level_2",
    
    price = G_knowledge_tree_knowledge2_cost,
  },
  
  KnowledgeNode
  {
    name = "savoir3",
    callback_reached = "",
	modifications_function = "F_knowledge_upgrade_to_level_3",
    
    price = G_knowledge_tree_knowledge3_cost,
  },
  
  KnowledgeNode
  {
    name = "savoir4",
    callback_reached = "",
	modifications_function = "F_knowledge_upgrade_to_level_4",
    
    price = G_knowledge_tree_knowledge4_cost,
  },
}

function F_nature_upgrade_level( fValue )
	SetGatherFactor ( G_food_gather_factor + G_food_gather_factor * fValue );
end

function F_nature_upgrade_to_level_1()
	F_nature_upgrade_level( G_knowledge_tree_nature1_effect_factor );
	LogGameEvent( "Recolt 1", Tome_buy_event );
end
function F_nature_upgrade_to_level_2()
	F_nature_upgrade_level( G_knowledge_tree_nature2_effect_factor );
	LogGameEvent( "Recolt 2", Tome_buy_event );
end
function F_nature_upgrade_to_level_3()
	F_nature_upgrade_level( G_knowledge_tree_nature3_effect_factor );
	LogGameEvent( "Recolt 3", Tome_buy_event );
end
function F_nature_upgrade_to_level_4()
	F_nature_upgrade_level( G_knowledge_tree_nature4_effect_factor );
	LogGameEvent( "Recolt 4", Tome_buy_event );
end

KnowledgeTree
{
  name = "NatureTree",
  type = Nature,
  
  KnowledgeNode
  {
    name = "nature1",
    callback_reached = "",
    modifications_function = "F_nature_upgrade_to_level_1",
    
    price = G_knowledge_tree_nature1_cost,
  },
  
  KnowledgeNode
  {
    name = "nature2",
    callback_reached = "",
	modifications_function = "F_nature_upgrade_to_level_2",
    
    price = G_knowledge_tree_nature2_cost,
  },
  
  KnowledgeNode
  {
    name = "nature3",
    callback_reached = "",
	modifications_function = "F_nature_upgrade_to_level_3",
    
    price = G_knowledge_tree_nature3_cost,
  },
  
  KnowledgeNode
  {
    name = "nature4",
    callback_reached = "",
	modifications_function = "F_nature_upgrade_to_level_4",
    
    price = G_knowledge_tree_nature4_cost,
  },
}

function F_music_upgrade_level( fValue )
	
	SetPassiveMoral( G_passive_moral_increase + G_passive_moral_increase * fValue );	
	SetSocializeMoralIncrease( G_socialize_moral_increase + G_socialize_moral_increase * fValue );
	
end 

function F_music_upgrade_to_level_1()
	F_music_upgrade_level( G_knowledge_tree_music1_effect_factor );
	LogGameEvent( "Moral 1", Tome_buy_event );
end
function F_music_upgrade_to_level_2()
	F_music_upgrade_level( G_knowledge_tree_music2_effect_factor );
	LogGameEvent( "Moral 2", Tome_buy_event );
end
function F_music_upgrade_to_level_3()
	F_music_upgrade_level( G_knowledge_tree_music3_effect_factor );
	LogGameEvent( "Moral 3", Tome_buy_event );
end
function F_music_upgrade_to_level_4()
	F_music_upgrade_level( G_knowledge_tree_music4_effect_factor );
	LogGameEvent( "Moral 4", Tome_buy_event );
end

KnowledgeTree
{
  name = "MusiqueTree",
  type = Music,
  
  KnowledgeNode
  {
    name = "musique1",
    callback_reached = "",
	modifications_function = "F_music_upgrade_to_level_1",
    
    price = G_knowledge_tree_music1_cost,
  },
  
  KnowledgeNode
  {
    name = "musique2",
    callback_reached = "",
	modifications_function = "F_music_upgrade_to_level_2",
    
    price = G_knowledge_tree_music2_cost,
  },
  
  KnowledgeNode
  {
    name = "musique3",
    callback_reached = "",
	modifications_function = "F_music_upgrade_to_level_3",
    
    price = G_knowledge_tree_music3_cost,
  },
  
  KnowledgeNode
  {
    name = "musique4",
    callback_reached = "",
	modifications_function = "F_music_upgrade_to_level_4",
    
    price = G_knowledge_tree_music4_cost,
  },
}

function F_exploration_upgrade_level( fValue )

	SetPassiveCharacterSpeed( G_passive_speed_increase + G_passive_speed_increase * fValue );
	SetSpiritFearFactor( G_character_fear_factor_near_spirit - G_character_fear_factor_near_spirit * fValue );	
	
end

function F_exploration_upgrade_to_level_1()
	F_exploration_upgrade_level( G_knowledge_tree_exploration1_effect_factor );
	LogGameEvent( "Movement 1", Tome_buy_event );
end
function F_exploration_upgrade_to_level_2()
	F_exploration_upgrade_level( G_knowledge_tree_exploration2_effect_factor );
	LogGameEvent( "Movement 2", Tome_buy_event );
end
function F_exploration_upgrade_to_level_3()
	F_exploration_upgrade_level( G_knowledge_tree_exploration3_effect_factor );
	LogGameEvent( "Movement 3", Tome_buy_event );
end
function F_exploration_upgrade_to_level_4()
	F_exploration_upgrade_level( G_knowledge_tree_exploration4_effect_factor );
	LogGameEvent( "Movement 4", Tome_buy_event );
end

KnowledgeTree
{
  name = "ExplorationTree",
  type = Exploration,
  
  KnowledgeNode
  {
    name = "exploration1",
    callback_reached = "",
	modifications_function = "F_exploration_upgrade_to_level_1",
    
    price = G_knowledge_tree_exploration1_cost,
  },
  
  KnowledgeNode
  {
    name = "exploration2",
    callback_reached = "",
	modifications_function = "F_exploration_upgrade_to_level_2",
    
    price = G_knowledge_tree_exploration2_cost,
  },
  
  KnowledgeNode
  {
    name = "exploration3",
    callback_reached = "",
	modifications_function = "F_exploration_upgrade_to_level_3",
    
    price = G_knowledge_tree_exploration3_cost,
  },
  
  KnowledgeNode
  {
    name = "exploration4",
    callback_reached = "",
	modifications_function = "F_exploration_upgrade_to_level_4",
    
    price = G_knowledge_tree_exploration4_cost,
  },
}