dofile( "mods/spellbound_bundle/files/scripts/utils.lua" )

spellbound_actions = {
	--[[
	{
		id          = "SPELLBOUND_SPELL_RUNE",
		name 		= "",
		description = "Throw on ground with spells to merge",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui/module_empty.png",
		type 		= ACTION_TYPE_OTHER,
		spawn_level                       = "0,1,2,3,4,5,6,7,8",
		spawn_probability                 = "1,1,1,1,1,1,1,1,1",
		price = 200,
		mana = 100,
		max_uses = -1,
		custom_xml_file = "mods/spellbound_bundle/files/entities/projectiles/empty_module.xml",
		action 		= function(recursion_level, iteration)
			--EntitySave( current_action.inventoryitem_id, "TestEntity.xml")
			function getPlayerEntity()
				local players = EntityGetWithTag("player_unit")
				if #players == 0 then return end
			
				return players[1]
			end
	
			function getCurrentlyEquippedWandId()
				local i2c_id = EntityGetFirstComponentIncludingDisabled(getPlayerEntity(), "Inventory2Component")
				local wand_id = ComponentGetValue2( i2c_id, "mActiveItem" )
				
				if(EntityHasTag(wand_id, "wand")) then
					return wand_id
				else
					return -1
				end
			end
	
	
			if(current_action ~= nil and current_action.deck_index ~= nil)then
	
				local id = current_action.deck_index + 1
	
				local wand = getCurrentlyEquippedWandId()
	
				local spells = EntityGetAllChildren( wand )
				
				local card = spells[id]
	
				local stored_spells = EntityGetVariable(card, "storedspells", "string") or ""
	
				for spell_id in string.gmatch(stored_spells, '([^,]+)') do
					for k, v in pairs(actions)do
						if(v.id == spell_id)then
							v.action()
						end
					end
				end
	
			end
	
		end,
	},
	{
		id          = "SPELLBOUND_MODIFIER_RUNE",
		name 		= "",
		description = "Throw on ground with spells to merge",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui/module_empty.png",
		type 		= ACTION_TYPE_OTHER,
		spawn_level                       = "0,1,2,3,4,5,6,7,8",
		spawn_probability                 = "1,1,1,1,1,1,1,1,1",
		price = 200,
		mana = 100,
		max_uses = -1,
		custom_xml_file = "mods/spellbound_bundle/files/entities/projectiles/empty_module2.xml",
		action 		= function(recursion_level, iteration)
			--EntitySave( current_action.inventoryitem_id, "TestEntity.xml")
			function getPlayerEntity()
				local players = EntityGetWithTag("player_unit")
				if #players == 0 then return end
			
				return players[1]
			end
	
			function getCurrentlyEquippedWandId()
				local i2c_id = EntityGetFirstComponentIncludingDisabled(getPlayerEntity(), "Inventory2Component")
				local wand_id = ComponentGetValue2( i2c_id, "mActiveItem" )
				
				if(EntityHasTag(wand_id, "wand")) then
					return wand_id
				else
					return -1
				end
			end
	
	
			old_add_projectile = add_projectile
			
			old_add_projectile_trigger_timer = add_projectile_trigger_timer
	
			old_add_projectile_trigger_hit_world = add_projectile_trigger_hit_world
			
			old_add_projectile_trigger_death = add_projectile_trigger_death
	
			add_projectile = function( entity_filename )
				c.extra_entities = c.extra_entities .. entity_filename .. ","
			end
			
			add_projectile_trigger_timer = function( entity_filename, delay_frames, action_draw_count )
				c.extra_entities = c.extra_entities .. entity_filename .. ","
			end
			
			add_projectile_trigger_hit_world = function( entity_filename, action_draw_count )
				c.extra_entities = c.extra_entities .. entity_filename .. ","
			end
			
			add_projectile_trigger_death = function( entity_filename, action_draw_count )
				c.extra_entities = c.extra_entities .. entity_filename .. ","
			end
	
	
			if(current_action ~= nil and current_action.deck_index ~= nil)then
	
				local id = current_action.deck_index + 1
	
				local wand = getCurrentlyEquippedWandId()
	
				local spells = EntityGetAllChildren( wand )
				
				local card = spells[id]
	
				local stored_spells = EntityGetVariable(card, "storedspells", "string") or ""
	
				for spell_id in string.gmatch(stored_spells, '([^,]+)') do
					for k, v in pairs(actions)do
						if(v.id == spell_id)then
							v.action()
						end
					end
				end
	
			end
	
			add_projectile = old_add_projectile
			
			add_projectile_trigger_timer = old_add_projectile_trigger_timer
	
			add_projectile_trigger_hit_world = old_add_projectile_trigger_hit_world
			
			add_projectile_trigger_death = old_add_projectile_trigger_death
			
			draw_actions( 1, true )	
		end,
	},
	{
		id          = "SPELLBOUND_PROJECTILE_RUNE",
		name 		= "",
		description = "Throw on ground with spells to merge",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui/module_empty.png",
		spawn_level                       = "0,1,2,3,4,5,6,7,8",
		spawn_probability                 = "1,1,1,1,1,1,1,1,1",
		price = 200,
		max_uses = -1,
		custom_xml_file = "mods/spellbound_bundle/files/entities/projectiles/empty_module3.xml",
		action 		= function(recursion_level, iteration)
			--EntitySave( current_action.inventoryitem_id, "TestEntity.xml")
			function getPlayerEntity()
				local players = EntityGetWithTag("player_unit")
				if #players == 0 then return end
			
				return players[1]
			end
	
			function getCurrentlyEquippedWandId()
				local i2c_id = EntityGetFirstComponentIncludingDisabled(getPlayerEntity(), "Inventory2Component")
				local wand_id = ComponentGetValue2( i2c_id, "mActiveItem" )
				
				if(EntityHasTag(wand_id, "wand")) then
					return wand_id
				else
					return -1
				end
			end
	
	
			old_add_projectile = add_projectile
			
			old_add_projectile_trigger_timer = add_projectile_trigger_timer
	
			old_add_projectile_trigger_hit_world = add_projectile_trigger_hit_world
			
			old_add_projectile_trigger_death = add_projectile_trigger_death
	
	
			local average_draw_count = 0
	
			local spell_count = 0
	
			local timers = 0
			local worlds = 0
			local deaths = 0
	
			local is_trigger_timer = false
			local is_trigger_death = false
			local is_trigger_world = false
			local no_trigger = false
	
			local average_time = 0
	
			local last_projectile = "data/entities/projectiles/deck/light_bullet.xml"
	
			add_projectile = function( entity_filename )
				c.extra_entities = c.extra_entities .. entity_filename .. ","
				spell_count = spell_count + 1
				last_projectile = entity_filename
			end
			
			add_projectile_trigger_timer = function( entity_filename, delay_frames, action_draw_count )
				c.extra_entities = c.extra_entities .. entity_filename .. ","
				spell_count = spell_count + 1
				average_draw_count = average_draw_count + action_draw_count
				timers = timers + 1
				average_time = average_time + delay_frames
				last_projectile = entity_filename
			end
			
			add_projectile_trigger_hit_world = function( entity_filename, action_draw_count )
				c.extra_entities = c.extra_entities .. entity_filename .. ","
				spell_count = spell_count + 1
				average_draw_count = average_draw_count + action_draw_count
				worlds = worlds + 1
				last_projectile = entity_filename
			end
			
			add_projectile_trigger_death = function( entity_filename, action_draw_count )
				c.extra_entities = c.extra_entities .. entity_filename .. ","
				spell_count = spell_count + 1
				average_draw_count = average_draw_count + action_draw_count
				deaths = deaths + 1
				last_projectile = entity_filename
			end
	
	
			local empty = true
	
	
			if(current_action ~= nil and current_action.deck_index ~= nil)then
	
				local id = current_action.deck_index + 1
	
				local wand = getCurrentlyEquippedWandId()
	
				local spells = EntityGetAllChildren( wand )
				
				local card = spells[id]
	
				local stored_spells = EntityGetVariable(card, "storedspells", "string") or ""
	
				EntitySave(wand, "wand.xml")


				for spell_id in string.gmatch(stored_spells, '([^,]+)') do
					empty = false
					for k, v in pairs(actions)do
						if(v.id == spell_id)then
							v.action()
						end
					end
				end
	
			end
	
			average_time = average_time / timers
			average_draw_count = math.ceil(average_draw_count / spell_count)
	
			if(timers > worlds and timers > deaths)then
				is_trigger_timer = true
			elseif(deaths > timers and deaths > worlds)then
				is_trigger_death = true
			elseif(worlds > timers and worlds > deaths)then
				is_trigger_world = true
			else
				if(average_draw_count > 0)then
					is_trigger_world = true
				else
					no_trigger = true
				end
			end
	
	
			add_projectile = old_add_projectile
			
			add_projectile_trigger_timer = old_add_projectile_trigger_timer
	
			add_projectile_trigger_hit_world = old_add_projectile_trigger_hit_world
			
			add_projectile_trigger_death = old_add_projectile_trigger_death
			
			if(not empty)then
				if(no_trigger)then
					add_projectile(last_projectile)
				elseif(is_trigger_timer)then
					add_projectile_trigger_timer( last_projectile, average_time, average_draw_count )
				elseif(is_trigger_world)then
					add_projectile_trigger_hit_world( last_projectile, average_draw_count )
				elseif(is_trigger_death)then
					add_projectile_trigger_death( last_projectile, average_draw_count )
				end
			end
		end,
	},]]
	{
		id          = "SPELLBOUND_FROZEN_CORE",
		name 		= "Frozen Core",
		description = "Provides an aura of freezing magic, seems to help you aim.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/frozen_core.png",
		sprite_unidentified = "data/ui_gfx/gun_actions/freeze_field_unidentified.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,2,4,5", -- FREEZE_FIELD
		spawn_probability                 = "1,1,1,1", -- FREEZE_FIELD
		price = 200,
		mana = 65,
		--max_uses = 15,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/frozen_core.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 15
		draw_actions( 1, true ) end,
	},


	{
		id          = "SPELLBOUND_FIRE_SKULL",
		name 		= "Screeching skull",
		description = "Find new friends, meet new creatures, little one.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/fire_skull.png",
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/screeching_skull.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "2,4,5,6",
		spawn_probability                 = "1,1,1,1", 
		price = 150,
		mana = 75,
		--max_uses = -1,
		action 		= function()
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/screeching_skull.xml")
			c.fire_rate_wait = c.fire_rate_wait +3.0
			c.screenshake = c.screenshake + 20.0
			c.damage_critical_chance = c.damage_critical_chance + 0.0
			c.damage_critical_multiplier = c.damage_critical_multiplier + 0.1
			shot_effects.recoil_knockback = shot_effects.recoil_knockback + 10
		end,
	},

	-- add wind effect like twitch intergration has

	{
		id          = "SPELLBOUND_BULLET_VORTEX",
		name 		= "Bullet Vortex",
		description = "Your projectiles have a strong whirlwind around them that capture enemy projectiles.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/forceful_projectiles.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "3,4,5,6",
		spawn_probability                 = "1,1,1,1", 
		price = 80,
		mana = 60,
		--max_uses = 120,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/bullet_vortex.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 5
			draw_actions( 1, true ) 
		end,
	},

	{
		id          = "SPELLBOUND_SLOW_PROJECTILES",
		name 		= "Slow Projectiles",
		description = "Projectiles have more air friction but do double damage.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/slow_projectiles.png",
		sprite_unidentified = "data/ui_gfx/gun_actions/slow_bullet_unidentified.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "1,2,3,4", -- SLOW_BULLET
		spawn_probability                 = "1,1,1,1", -- SLOW_BULLET
		price = 160,
		mana = 30,
		--max_uses = 50,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/slow_projectiles.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 5
			c.screenshake = c.screenshake + 2 
			draw_actions( 1, true ) 
		end,
	},

	{
		id          = "SPELLBOUND_BLACKHOLE_INFUSION",
		name 		= "Blackhole Infusion",
		description = "Projectiles have the power of black holes infused in them.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/blackhole_infusion.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,2,4,5", -- BLACK_HOLE
		spawn_probability                 = "1,1,1,1", -- BLACK_HOLE
		price = 200,
		mana = 180,
		max_uses = 5,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/blackhole_infusion.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 150
			c.screenshake = c.screenshake + 20
			draw_actions( 1, true ) 
		end,
	},

	{
		id          = "SPELLBOUND_VOID_SHOT",
		name 		= "Void Shot",
		description = "Projectiles cause an implosion",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/void_shot.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "1,3,5,6", -- BLACK_HOLE_BIG
		spawn_probability                 = "1,1,1,1", -- BLACK_HOLE_BIG
		price = 320,
		mana = 240,
		--max_uses    = 6, 
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/void_shot.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 80
			c.screenshake = c.screenshake + 5
			c.damage_projectile_add = c.damage_projectile_add - 0.05
			draw_actions( 1, true ) 
		end,
	},

	{
		id          = "SPELLBOUND_BUBBLE_PROJECTILES",
		name 		= "Bubble Projectiles",
		description = "Projectiles are encased in a bubble?",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/bubble_projectiles.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,4,5,6",
		spawn_probability                 = "1,1,1,1", 
		price = 100,
		mana = 15,
		--max_uses = 120,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/bubble_projectiles.xml,"
			draw_actions( 1, true ) 
		end,
	},
	--[[
	{
		id          = "SPELLBOUND_BLADE_SHOT",
		name 		= "Blade Shot",
		description = "Projectiles have sharp blades attached to that that cause enemies to bleed.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/blade_shot.png",
		sprite_unidentified = "data/ui_gfx/gun_actions/disc_bullet_unidentified.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,4",
		spawn_probability                 = "1,1,1,1", 
		price = 120,
		mana = 20,
		--max_uses = 40,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/blade_shot.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 10
			c.screenshake = c.screenshake + 5
		draw_actions( 1, true ) end,
	},


	{
		id          = "SPELLBOUND_CHAIN_SHOT",
		name 		= "Chain Shot",
		description = "Spells chain from enemy to enemy.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/chain_shot.png",
		type 		= ACTION_TYPE_OTHER,
		spawn_level                       = "0,4,5,6",
		spawn_probability                 = "1,1,1,1",
		price = 240,
		mana = 20,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/chain_shot.xml,"
			draw_actions( 1, true );
		end,
	},
	--]]
	{
		id          = "SPELLBOUND_RUBBER_COATING",
		name 		= "Rubber Coating",
		description = "makes spells very bouncy, however they can also damage the caster.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/rubber_coating.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,6", -- RUBBER_BALL
		spawn_probability                 = "1,1,1", -- RUBBER_BALL
		price = 60,
		mana = 15,
		--max_uses = 150,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/rubber_coating.xml,"
			-- damage = 0.3
			c.fire_rate_wait = c.fire_rate_wait - 2
			draw_actions( 1, true ) 
		end,
	},
	
	{
			id          = "SPELLBOUND_CALTROPS",
			name 		= "Handful of caltrops",
			description = "Throws a handful of caltrops, they can also damage the thrower",
			sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/caltrops.png",
			sprite_unidentified = "data/ui_gfx/gun_actions/disc_bullet_unidentified.png",
			type 		= ACTION_TYPE_PROJECTILE,
			related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/caltrops.xml"},
			spawn_level                       = "1,2,4,6",
			spawn_probability                 = "1,1,1,1", 
			price = 120,
			mana = 45,
			--max_uses = 40,
			action 		= function()
				add_projectile("mods/spellbound_bundle/files/entities/projectiles/caltrops.xml")
				add_projectile("mods/spellbound_bundle/files/entities/projectiles/caltrops.xml")
				add_projectile("mods/spellbound_bundle/files/entities/projectiles/caltrops.xml")
				-- damage = 0.3
				c.fire_rate_wait = c.fire_rate_wait + 20
				c.spread_degrees = c.spread_degrees + 30
				shot_effects.recoil_knockback = 0.1
			end,
	},

	{
		id          = "SPELLBOUND_SHRAPNEL_SHOT",
		name 		= "Shrapnel Shot",
		description = "Your projectiles explode into shrapnel",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/shrapnel.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "1,2,3,4,5",
		spawn_probability                 = "1,1,1,1,1",
		price = 60,
		mana = 30,
		--max_uses = 150,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/shrapnel_shot.xml,"
			-- damage = 0.3
			c.fire_rate_wait = c.fire_rate_wait - 2
			draw_actions( 1, true ) 
		end,
	},

	{
		id          = "SPELLBOUND_ENERGETIC_PROJECTILES",
		name 		= "Energetic Projectiles",
		description = "Projectiles have enhanced magical properties",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/energetic_projectiles.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1", 
		price = 220,
		mana = 70, 
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/energetic_projectiles.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 60
			--current_reload_time = current_reload_time + 40
			c.ragdoll_fx = 2
			shot_effects.recoil_knockback = 120.0
			draw_actions( 1, true ) 
		end,
	},
	--[[
	{
		id          = "SPELLBOUND_SPIRAL_FIELD",
		name 		= "Spiral Field",
		description = "Projectiles have a magical spiral around them.",
		sprite 		= "mods/spellbound_bundle/files//gfx/ui_gfx/spiral_field.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "4,5,6", -- SPIRAL_SHOT
		spawn_probability                 = "1,1,1", -- SPIRAL_SHOT
		price = 190,
		mana = 50,
		--max_uses    = 15, 
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/spiral_field.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 20
		draw_actions( 1, true ) end,
	},
	--]]
	{
		id          = "SPELLBOUND_DARK_FLAME_TRAIL",
		name 		= "Dark Flame Trail",
		description = "Projectiles create a trail of dark flame.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/darkflame_trail.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,3,5,6", -- DARKFLAME
		spawn_probability                 = "1,1,1,1", -- DARKFLAME
		price = 180,
		mana = 90,
		--max_uses    = 60, 
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/darkflame_trail.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 20
		draw_actions( 1, true ) end,
	},
	--[[

	{
		id          = "SPELLBOUND_CRUMBLING_SHOT",
		name 		= "Crumbling shot",
		description = "Projectiles cause the earth to crumble.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/tremor_shot.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,3,4,5,6", -- BOMB_HOLY
		spawn_probability                 = "1,1,1,1,1", -- BOMB_HOLY
		price = 250,
		mana = 140, 
		max_uses = 40,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/crumble_shot.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 20
			draw_actions( 1, true )
		end,
	},
	--]]

	{
		id          = "SPELLBOUND_TRAIL_OF_ROCK_SPIRITS",
		name 		= "Trail of rock spirits",
		description = "Your projectiles leave a trail of baby rock spirits.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/trail_of_rock_spirits.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,3,4,5,6", -- BOMB
		spawn_probability                 = "1,1,1,1,1,1,1", -- BOMB
		price = 200,
		mana = 120,
		max_uses = 15,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/rock_spirit_trail.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 80
		draw_actions( 1, true ) end,
	},

	{
		id          = "SPELLBOUND_PYRE_ENCHANTMENT",
		name 		= "Pyre Enchantment",
		description = "Give your spells a fiery kick",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/pyre_enchantment.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "1,2,3,4", -- SLIMEBALL
		spawn_probability                 = "1,1,1,1", -- SLIMEBALL
		price = 90,
		mana = 25,
		--max_uses    = 70, 
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/pyre_enchantment.xml,"
			draw_actions( 1, true ) 
		end,
	},
	--[[
	{
		id          = "SPELLBOUND_RECALL",
		name 		= "Magic mirror",
		description = "Shoot spell to set location, shoot again to teleport to that location.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/recall.png",
		related_projectiles = {"mods/spellbound_bundle/files/entities/projectiles/recall.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "0,1,2,4,5,6", -- TELEPORT_PROJECTILE
		spawn_probability                 = "1,1,1,1,1,1", -- TELEPORT_PROJECTILE
		price = 90,
		mana = 40,
		max_uses = 8,
		custom_xml_file = "mods/spellbound_bundle/files/entities/misc/recall_extra.xml",
		action 		= function()
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/recall.xml")
			c.fire_rate_wait = c.fire_rate_wait + 3
			c.spread_degrees = c.spread_degrees - 1.0
		end,
	},
	--]]
	{
		id          = "SPELLBOUND_TOXIC_AURA",
		name 		= "Toxic Aura",
		description = "Projectiles have a toxic aura.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/toxic_aura.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1", 
		price = 80,
		mana = 40,
		--max_uses = 10,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/toxic_aura.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 10
		draw_actions( 1, true ) end,
	},
	{
		id          = "SPELLBOUND_WHISKY_AURA",
		name 		= "Whisky Aura",
		description = "Projectiles have a whisky aura.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/whisky_aura.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1", 
		price = 80,
		mana = 40,
		--max_uses = 10,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/whisky_aura.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 10
		draw_actions( 1, true ) end,
	},
	{
		id          = "SPELLBOUND_SLIME_AURA",
		name 		= "Slime Aura",
		description = "Projectiles have a slime aura.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/slime_aura.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1", 
		price = 80,
		mana = 40,
		--max_uses = 10,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/slime_aura.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 10
		draw_actions( 1, true ) end,
	},


	{
		id          = "SPELLBOUND_HEAT_WAVE",
		name 		= "Heat Wave",
		description = "Your projectiles create a wave of scorching heat.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/heat_wave.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "1,2,3,4", -- SLIMEBALL
		spawn_probability                 = "1,1,1,1", -- SLIMEBALL
		price = 170,
		mana = 20,
		--max_uses = 15,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/heat_wave.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 20
		draw_actions( 1, true ) end,
	},

	--[[

	{
		id          = "SPELLBOUND_CHARM",
		name 		= "$action_charm",
		description = "$actiondesc_charm",
		sprite 		= "data/ui_gfx/gun_actions/charm.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "1,3,4,5", -- HITFX_BURNING_CRITICAL_HIT
		spawn_probability                 = "1,1,1,1", -- HITFX_BURNING_CRITICAL_HIT
		price = 100,
		mana = 30,
		max_uses = 10,
		custom_xml_file = "data/entities/misc/custom_cards/charm.xml",
		action 		= function()
			--c.damage_projectile_add = c.damage_projectile_add - 0.003
			--c.game_effect_entities = c.game_effect_entities .. "data/entities/misc/effect_polymorph.xml,"
			--c.extra_entities = c.extra_entities .. "data/entities/particles/polymorph.xml,"
			
			c.game_effect_entities = c.game_effect_entities .. "data/entities/misc/effect_charm_short.xml,"
			c.extra_entities = c.extra_entities .. "data/entities/particles/charm.xml,"
			draw_actions( 1, true )		
			
			-- c.extra_entities = c.extra_entities .. "data/entities/particles/freeze_charge.xml,"
		end,
	},



	{
		id          = "SPELLBOUND_BERSERK",
		name 		= "$action_berserk",
		description = "$actiondesc_berserk",
		sprite 		= "data/ui_gfx/gun_actions/berserk.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "1,3,4,5", -- HITFX_BURNING_CRITICAL_HIT
		spawn_probability                 = "1,1,1,1", -- HITFX_BURNING_CRITICAL_HIT
		price = 100,
		mana = 30,
		max_uses = 10,
		custom_xml_file = "data/entities/misc/custom_cards/berserk.xml",
		action 		= function()
			--c.damage_projectile_add = c.damage_projectile_add - 0.003
			--c.game_effect_entities = c.game_effect_entities .. "data/entities/misc/effect_polymorph.xml,"
			--c.extra_entities = c.extra_entities .. "data/entities/particles/polymorph.xml,"
			
			c.game_effect_entities = c.game_effect_entities .. "data/entities/misc/effect_berserk.xml,"
			c.extra_entities = c.extra_entities .. "data/entities/particles/berserk.xml,"
			draw_actions( 1, true )		
			
			-- c.extra_entities = c.extra_entities .. "data/entities/particles/freeze_charge.xml,"
		end,
	},


	{
		id          = "SPELLBOUND_ICETHROWER",
		name 		= "$action_icethrower",
		description = "A ball of ice.",
		sprite 		= "data/ui_gfx/gun_actions/icethrower.png",
		type 		= ACTION_TYPE_PROJECTILE,
		related_projectiles	= {"data/entities/projectiles/icethrower.xml"},
		spawn_level                       = "0,1,2,4",
		spawn_probability                 = "1,1,1,1", 
		price = 260,
		mana = 100,
		max_uses = 75,
		custom_xml_file = "data/entities/misc/custom_cards/icethrower.xml",
		action 		= function()
			add_projectile("data/entities/projectiles/icethrower.xml")
			c.spread_degrees = c.spread_degrees + 2.0
		end,

	},
	--]]

	{
		id          = "SPELLBOUND_DUCK",
		name 		= "$action_duck",
		description = "Helps your spells fly, reducing their mana costs slightly",
		sprite 		= "data/ui_gfx/gun_actions/duck.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1", 
		price = 100,
		mana = -10,
		action 		= function()
			c.sprite = "data/enemies_gfx/duck.xml"
			--c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/duck.xml,"
			draw_actions( 1, true )
		end,


	},


	{
		id          = "SPELLBOUND_BLOOM_PROJECTILES",
		name 		= "Bloom Projectiles",
		description = "Projectiles shoot out acid sacs.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/bloom_projectiles.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1", 
		price = 100,
		mana = 80,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/bloom_projectiles.xml,"
			current_reload_time = current_reload_time + 80
			draw_actions( 1, true )	
		end,
	},


	{
		id          = "SPELLBOUND_BLOOM_SHOT",
		name 		= "Bloom Shot",
		description = "Projectile that shoots out acid sacs.",
		sprite 		= "data/ui_gfx/gun_actions/bloomshot.png",
		type 		= ACTION_TYPE_PROJECTILE,
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/bloom_shot.xml"},
		spawn_level                       = "2,4,5,6",
		spawn_probability                 = "1,1,1,1", 
		price = 100,
		mana = 60, 
		max_uses = 25,
		custom_xml_file = "data/entities/misc/custom_cards/bloomshot.xml",
		action 		= function()
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/bloom_shot.xml")
			current_reload_time = current_reload_time + 80
		end,
	},


	{
		id          = "SPELLBOUND_ICECIRCLE",
		name 		= "$action_icecircle",
		description = "$actiondesc_icecircle",
		sprite 		= "data/ui_gfx/gun_actions/icecircle.png",
		related_projectiles	= {"data/entities/projectiles/iceskull_explosion.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "2,4,5,6",
		spawn_probability                 = "1,1,1,1", 

		price = 130,
		mana = 100,
		--
		custom_xml_file = "data/entities/misc/custom_cards/icecircle.xml",
		action 		= function()
			add_projectile("data/entities/projectiles/iceskull_explosion.xml")
			current_reload_time = current_reload_time + 60
		end,

	},
	--[[

	{
		id          = "SPELLBOUND_PORTABLE_STRIKE_DRONE",
		name 		= "Portable Strike Drone",
		description = "Drone friend that shoots for you.",
		sprite 		= "data/ui_gfx/gun_actions/drone.png",
		related_projectiles	= {"mods/spellbound_bundle/files/entities/enemies/portable_strike_drone.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "0,1,2,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1", 

		price = 100,
		mana = 60,
		max_uses    = 5,
		custom_xml_file = "mods/spellbound_bundle/files/entities/misc/portable_strike_drone.xml",
		action 		= function()
			add_projectile("mods/spellbound_bundle/files/entities/enemies/portable_strike_drone.xml")
			c.fire_rate_wait = c.fire_rate_wait + 60
		end,
	},
	--]]

	{
		id          = "SPELLBOUND_ASCENDANT_FIREBALL",
		name 		= "ascendant fireball",
		description = "The gods have angered you.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/ascendant_fireball.png", 
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/ascendant_fireball.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "2,4,5,6",
		spawn_probability                 = "1,1,1,1", 
		price = 150,
		mana = 50,
		max_uses = 20,
		action 		= function()
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/ascendant_fireball.xml")
			c.fire_rate_wait = c.fire_rate_wait +50.0
			c.screenshake = c.screenshake + 20.0
			c.damage_critical_chance = c.damage_critical_chance + 0.0
			c.damage_critical_multiplier = c.damage_critical_multiplier + 0.1
			shot_effects.recoil_knockback = shot_effects.recoil_knockback + 10
		end,
	},

	{
		id          = "SPELLBOUND_LIGHTNING_INFUSION",
		name 		= "Lightning infusion",
		description = "sparks rapidly fly from your spells, as well as having a trail of lightning",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/lightning_infusion.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "3,4,5,6",
		spawn_probability                 = "1,1,1,1", 
		price = 250,
		mana = 25,
		--max_uses = 30,
		custom_xml_file = "data/entities/misc/custom_cards/electric_charge.xml",
		action 		= function()
			c.fire_rate_wait = c.fire_rate_wait + 5
			shot_effects.recoil_knockback = 40.0
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/lightning_infusion.xml,"
			draw_actions( 1, true )		
		end,
	},


	{
		id          = "SPELLBOUND_CHAIN_LIGHTNING",
		name 		= "Lightning trigger",
		description = "A long range strike of lightning with a trigger",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/chain_lightning.png",
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/chain_lightning.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "1,2,5,6", -- LIGHTNING
		spawn_probability                 = "1,1,1,1", -- LIGHTNING
		price = 250,
		mana = 25,
		--max_uses = 30,
		custom_xml_file = "data/entities/misc/custom_cards/electric_charge.xml",
		action 		= function()
			c.fire_rate_wait = c.fire_rate_wait + 5
			shot_effects.recoil_knockback = 40.0
			add_projectile_trigger_hit_world("mods/spellbound_bundle/files/entities/projectiles/chain_lightning.xml", 1)
		end,
	}, 


	{
		id          = "SPELLBOUND_SHARD_SHOT",
		name 		= "Shardshot",
		description = "A rain of sparks",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/shardshot.png",
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/shardshot.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "1,2,3,4,5",
		spawn_probability                 = "1,1,1,1,1", 
		price = 150,
		mana = 5,
		--max_uses = -1,
		action 		= function()
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/shardshot.xml")
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/shardshot.xml")
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/shardshot.xml")
			c.fire_rate_wait = c.fire_rate_wait -0.1
			c.screenshake = c.screenshake + 4.0
			c.damage_critical_chance = c.damage_critical_chance + 0.0
			c.damage_critical_multiplier = c.damage_critical_multiplier + 0.1
			shot_effects.recoil_knockback = shot_effects.recoil_knockback + 10
		end,
	},


	{
		id          = "SPELLBOUND_CRYSTAL_SHOT",
		name 		= "crystal shot",
		description = "Red laser not included",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/crystal_shot.png",
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/crystal_shot.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "2,3,4,5",
		spawn_probability                 = "1,1,1,1", 
		price = 250,
		mana = 25,
		--max_uses = 30,
		action 		= function()
			c.fire_rate_wait = c.fire_rate_wait +100.0
			shot_effects.recoil_knockback = 400.0
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/crystal_shot.xml")
		end,
	},
	--[[

	{
		id          = "SPELLBOUND_SWARM_SHOT",
		name 		= "swarm shot",
		description = "infesting magic",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/swarm_shot.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,4,6",
		spawn_probability                 = "1,1,1,1,1", 
		price = 250,
		mana = 25,
		max_uses = 50,
		action 		= function()
				c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/misc/swarm_shot_load.xml,"
				draw_actions( 1, true )
			end,
	},
	--]]

	{
		id          = "SPELLBOUND_CONTROL",
		name 		= "Controlled Projectiles",
		description = "Projectiles follow your cursor.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/chasing.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,3,4,5,6",
		spawn_probability                 = "1,1,1,1,1", 
		price = 300,
		mana = 50,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/chasing.xml,"
			draw_actions(1, true)
		end,
	},


	{
		id          = "SPELLBOUND_MUSHROOM_CLOUD",
		name 		= "Mushroom cloud",
		description = "Nuclear joke",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/mushroom_cloud.png",
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/mushroomcloud.xml"},
		type 		= ACTION_TYPE_STATIC_PROJECTILE,
		spawn_level                       = "0,1,2,3,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1,1", 
		price = 200,
		mana = 50,
		max_uses = 1,
		action 		= function()
				add_projectile("mods/spellbound_bundle/files/entities/projectiles/mushroomcloud.xml")
				c.fire_rate_wait = c.fire_rate_wait + 15
			end,
	},


	{
		id          = "SPELLBOUND_LUCKY_KNIFE",
		name 		= "Summon lucky knife",
		description = "you only get one, be sure to pick it up",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/knife.png",
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/knife_pickupable.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "0,1,2,4",
		spawn_probability                 = "1,1,1,1", 
		price = 150,
		mana = 15,
		max_uses = 1,
		action 		= function()
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/knife_pickupable.xml")
			c.fire_rate_wait = c.fire_rate_wait +800.0
			c.screenshake = c.screenshake + 20.0
			c.damage_critical_chance = c.damage_critical_chance + 0
			c.damage_critical_multiplier = c.damage_critical_multiplier + 0.0
			shot_effects.recoil_knockback = shot_effects.recoil_knockback + 10
		end,
	},


	{
		id          = "SPELLBOUND_STICKY_BOMB",
		name 		= "Sticky glob",
		description = "ew, i think i got some on me",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/sticky.png",
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/mine.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "0,1,2,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1", 
		price = 150,
		mana = 30,
		-- max_uses = 1,
		action 		= function()
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/mine.xml")
			c.fire_rate_wait = c.fire_rate_wait +50.0
			c.screenshake = c.screenshake + 20.0
			c.damage_critical_chance = c.damage_critical_chance + 0
			c.damage_critical_multiplier = c.damage_critical_multiplier + 0.1
			shot_effects.recoil_knockback = shot_effects.recoil_knockback + 10
		end,
	},


	{
		id          = "SPELLBOUND_STICKY_BOMB_TRIGGER",
		name 		= "Sticky glob with trigger",
		description = "ew, i think i got some on me",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/sticky_trigger.png",
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/mine_trigger.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "0,1,2,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1", 
		price = 150,
		mana = 30,
		-- max_uses = 1,
		action 		= function()
			add_projectile_trigger_death("mods/spellbound_bundle/files/entities/projectiles/mine_trigger.xml", 1)
			c.fire_rate_wait = c.fire_rate_wait +50.0
			c.screenshake = c.screenshake + 20.0
			c.damage_critical_chance = c.damage_critical_chance + 0
			c.damage_critical_multiplier = c.damage_critical_multiplier + 0.1
			shot_effects.recoil_knockback = shot_effects.recoil_knockback + 10
		end,
	},

		

	{
		id          = "SPELLBOUND_SUFFOCATION_FIELD",
		name        = "Circle of suffocation",
		description = "freedom to some.",
		sprite      = "mods/spellbound_bundle/files/gfx/ui_gfx/suffocation.png",
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/circleofsuffocation.xml"},
		type         = ACTION_TYPE_STATIC_PROJECTILE,
		spawn_level                       = "0,1,2,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1", 
		price = 200,
		mana = 50,
		max_uses = 5,
		action         = function()
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/circleofsuffocation.xml")
			c.fire_rate_wait = c.fire_rate_wait + 15
		end,
	},	

	
	{
			id          = "SPELLBOUND_VACUUM_SHOT",
			name 		= "Arcane Vacuum",
			description = "Triplecast that pulls your projectiles together using a arcane force.",
			sprite      = "mods/spellbound_bundle/files/gfx/ui_gfx/arcane_vacuum.png",
			related_projectiles	= {"mods/spellbound_bundle/files/entities/modifiers/orbit_bolt2.xml"},
			type 		= ACTION_TYPE_MODIFIER,
			spawn_level                         = "1,2,3,4,5,6", -- LIGHT_BULLET_TIMER
			spawn_probability                   = "1,1,1,1,1,1", -- LIGHT_BULLET_TIMER
			price = 140,
			mana = 30,
			--max_uses = 100,
			action 		= function()
				c.fire_rate_wait = math.max(c.fire_rate_wait - 5, 0)
				c.dampening = 0.1
				add_projectile("mods/spellbound_bundle/files/entities/modifiers/orbit_bolt2.xml")
				draw_actions( 3, true)
			end,
	},

	--[[

	{
		id          = "SPELLBOUND_SACRIFICIAL_PROJECTILES",
		name 		= "Sacrificial Projectiles",
		description = "Spells cast a homing duplicate of themselves on kill.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/kill_duplicate_homing.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,4,5,6",
		spawn_probability                 = "1,1,1,1", 
		price = 250,
		mana = 10,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/misc/sacrificiallaunchload.xml,"
			draw_actions( 1, true );
		end,
	},
	--]]


	{
		id          = "SPELLBOUND_ICE_SHARD",
		name 		= "Ice spear",
		description = "A spear of ice that gains damage the longer it is in the air",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/iceshard.png",
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/iceshard.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "0,1,2,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1", 
		price = 150,
		mana = 45,
		-- max_uses = 1,
		action 		= function()
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/iceshard.xml")
			c.fire_rate_wait = c.fire_rate_wait +10.0
			c.screenshake = c.screenshake + 5.0
			c.damage_critical_chance = c.damage_critical_chance + 0
			c.damage_critical_multiplier = c.damage_critical_multiplier + 0.1
			shot_effects.recoil_knockback = shot_effects.recoil_knockback + 10
		end,
	},


	{
		id          = "SPELLBOUND_AIR_BURST",
		name 		= "Airburst",
		description = "Who needs accuracy anyway?",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/air_burst.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1", 
		price = 200,
		mana = 25,
		--max_uses = 15,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/air_burst.xml,"
			c.fire_rate_wait = c.fire_rate_wait + 15
			c.damage_projectile_add = c.damage_projectile_add + 0.08
		draw_actions( 1, true ) end,
	},


	
	{
			id          = "SPELLBOUND_FORCE_MODULE",
			name 		= "Force Module",
			description = "Hold the fire button to charge spells in front of you.",
			sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/force_module.png",
			type 		= ACTION_TYPE_MODIFIER,
			spawn_level                       = "2,4,5,6",
			spawn_probability                 = "1,1,1,1", 
			price = 140,
			mana = 90,
			--max_uses = 100,
			action 		= function()
				c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/force_module.xml,"
				draw_actions( 1, true );
			end,
	}, 


	{
			id          = "SPELLBOUND_HELL_FIRE",
			name 		= "Hell Fire",
			description = "Makes hit enemies spontaneously explode after some time.",
			sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/hell_fire.png",
			type 		= ACTION_TYPE_MODIFIER,
			spawn_level                       = "0,1,2,4,5,6",
			spawn_probability                 = "1,1,1,1,1,1", 
			price = 230,
			mana = 50,
			--max_uses = 20,
			action 		= function()
				c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/hitfx_hell_fire.xml,mods/spellbound_bundle/files/entities/misc/firetrail.xml,"
				c.fire_rate_wait = c.fire_rate_wait + 12
				c.spread_degrees = c.spread_degrees + 7.5
				shot_effects.recoil_knockback = shot_effects.recoil_knockback + 50.0
				draw_actions( 1, true )
			end,
	},	

	
	{
			id          = "SPELLBOUND_SNARK",
			name 		= "A handful of snarks",
			description = "Small creatures that look very hungry.",
			sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/snark.png",
			related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/snark.xml"},
			type 		= ACTION_TYPE_PROJECTILE,
			spawn_level                       = "0,1,2,4,5",
			spawn_probability                 = "1,1,1,1,1", 
			price = 120,
			mana = 65,
			--max_uses = 40,
			action 		= function()
				add_projectile("mods/spellbound_bundle/files/entities/projectiles/snark.xml")
				add_projectile("mods/spellbound_bundle/files/entities/projectiles/snark.xml")
				add_projectile("mods/spellbound_bundle/files/entities/projectiles/snark.xml")
				add_projectile("mods/spellbound_bundle/files/entities/projectiles/snark.xml")
				add_projectile("mods/spellbound_bundle/files/entities/projectiles/snark.xml")
				-- damage = 0.3
				c.fire_rate_wait = c.fire_rate_wait + 50
				c.spread_degrees = c.spread_degrees + 30
				shot_effects.recoil_knockback = 0.1
			end,
	},


		
	{
			id          = "SPELLBOUND_GAS_SHOT",
			name 		= "Blast of gas",
			description = "Causes most spells to explode into radioactive gas",
			sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/gas_globe.png",
			type 		= ACTION_TYPE_MODIFIER,
			spawn_level                       = "0,1,2,4,5,6",
			spawn_probability                 = "0.9,0.9,0.9,0.9,0.9,0.9", 
			price = 140,
			mana = 60,
			--max_uses = 20,
			action 		= function()
				c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/gas_globe.xml,"
				c.fire_rate_wait = c.fire_rate_wait + 0
				c.spread_degrees = c.spread_degrees + 0
				shot_effects.recoil_knockback = shot_effects.recoil_knockback + 6
				draw_actions( 1, true )
			end,
	},	

		
	{
			id          = "SPELLBOUND_GAS_SHOT_FIRE",
			name 		= "Blast of napalm",
			description = "Causes most spells to explode into a fiery cocktail",
			sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/gas_globe_fire.png",
			type 		= ACTION_TYPE_MODIFIER,
			spawn_level                       = "0,1,2,4,5,6",
			spawn_probability                 = "0.9,0.9,0.9,0.9,0.9,0.9",
			price = 140,
			mana = 60,
			--max_uses = 20,
			action 		= function()
				c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/gas_globe_fire.xml,"
				c.fire_rate_wait = c.fire_rate_wait + 0
				c.spread_degrees = c.spread_degrees + 0
				shot_effects.recoil_knockback = shot_effects.recoil_knockback + 6
				draw_actions( 1, true )
			end,
	},	

		
	{
			id          = "SPELLBOUND_GAS_SHOT_POISON",
			name 		= "Blast of toxin",
			description = "Causes most spells to explode into debilitating poison",
			sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/gas_globe_poison.png",
			type 		= ACTION_TYPE_MODIFIER,
			spawn_level                       = "0,1,2,4,5,6",
			spawn_probability                 = "0.9,0.9,0.9,0.9,0.9,0.9",
			price = 140,
			mana = 60,
			--max_uses = 20,
			action 		= function()
				c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/gas_globe_poison.xml,"
				c.fire_rate_wait = c.fire_rate_wait + 0
				c.spread_degrees = c.spread_degrees + 0
				shot_effects.recoil_knockback = shot_effects.recoil_knockback + 6
				draw_actions( 1, true )
			end,
	},	

		
	{
			id          = "SPELLBOUND_GAS_SHOT_FREEZING",
			name 		= "Blast of frost",
			description = "Causes most spells to explode into freezing liquid",
			sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/gas_globe_freezing.png",
			type 		= ACTION_TYPE_MODIFIER,
			spawn_level                       = "0,1,2,4,5,6",
			spawn_probability                 = "0.9,0.9,0.9,0.9,0.9,0.9",
			price = 140,
			mana = 60,
			--max_uses = 20,
			action 		= function()
				c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/gas_globe_freezing.xml,"
				c.fire_rate_wait = c.fire_rate_wait + 0
				c.spread_degrees = c.spread_degrees + 0
				shot_effects.recoil_knockback = shot_effects.recoil_knockback + 6
				draw_actions( 1, true )
			end,
	},	

		
	{
			id          = "SPELLBOUND_GAS_SHOT_CONCRETE",
			name 		= "Blast of concrete",
			description = "Causes most spells to explode into concrete",
			sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/gas_globe_concrete.png",
			type 		= ACTION_TYPE_MODIFIER,
			spawn_level                       = "0,1,2,4,5,6",
			spawn_probability                 = "0.9,0.9,0.9,0.9,0.9,0.9",
			price = 140,
			mana = 60,
			--max_uses = 20,
			action 		= function()
				c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/gas_globe_concrete.xml,"
				c.fire_rate_wait = c.fire_rate_wait + 0
				c.spread_degrees = c.spread_degrees + 0
				shot_effects.recoil_knockback = shot_effects.recoil_knockback + 6
				draw_actions( 1, true )
			end,
	},	
	--[[
		
	{
			id          = "SPELLBOUND_GAS_SHOT_WET_CONCRETE",
			name 		= "Globe of wet concrete",
			description = "Causes most spells to explode into wet concrete",
			sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/gas_globe_concrete.png",
			type 		= ACTION_TYPE_MODIFIER,
			spawn_level                       = "1,2,3,4,5",
			spawn_probability                 = "1,1,1,1,1",
			price = 140,
			mana = 5,
			--max_uses = 20,
			action 		= function()
				c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/gas_globe_wet_concrete.xml,"
				c.fire_rate_wait = c.fire_rate_wait + 0
				c.spread_degrees = c.spread_degrees + 0
				shot_effects.recoil_knockback = shot_effects.recoil_knockback + 6
				draw_actions( 1, true )
			end,
	},	
	]]

	--[[
		
	{
			id          = "SPELLBOUND_GAS_SHOT_BURNING",
			name 		= "Blast of explosive gas",
			description = "Causes most spells to explode into explosive gas",
			sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/gas_globe_burning.png",
			type 		= ACTION_TYPE_MODIFIER,
			spawn_level                       = "0,1,2,4,5,6",
			spawn_probability                 = "0.9,0.9,0.9,0.9,0.9,0.9",
			price = 140,
			mana = 60,
			--max_uses = 20,
			action 		= function()
				c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/gas_globe_burning.xml,"
				c.fire_rate_wait = c.fire_rate_wait + 0
				c.spread_degrees = c.spread_degrees + 0
				shot_effects.recoil_knockback = shot_effects.recoil_knockback + 6
				draw_actions( 1, true )
			end,
	},	
	--]]

	{
		id          = "SPELLBOUND_GHOSTLY_LANCE",
		name 		= "Ghostly Lance",
		description = "Projectiles will pass through enemies, and some terrain, but wont explode on contact",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/ghostly_lance.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "1,2,5,6", -- LANCE
		spawn_probability                 = "1,1,1,1", -- LANCE
		price = 180,
		mana = 30,
		--max_uses = 30,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/ghostly_lance.xml,"
			-- damage = 0.3
			c.fire_rate_wait = c.fire_rate_wait + 20
			c.spread_degrees = c.spread_degrees - 10
			shot_effects.recoil_knockback = 60.0
		draw_actions( 1, true ) end,
	},

	{
		id          = "SPELLBOUND_PATHFINDING",
		name 		= "Pathfinding Projectiles",
		description = "Projectiles find a path to targets",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/pathfinding.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,3,4,5,6",
		spawn_probability                 = "1,1,1,1,1", 
		price = 300,
		mana = 0,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/projectile_pathfinding.xml,"
			draw_actions(1, true)
		end,
	},
	--[[
	{
		id          = "SPELLBOUND_CUBE",
		name 		= "Cube",
		description = "A cube.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/fire_skull.png",
		related_projectiles	= {"mods/spellbound_bundle/files/entities/projectiles/cube.xml"},
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "2,4,5,6",
		spawn_probability                 = "1,1,1,1", 
		price = 150,
		mana = 0,
		--max_uses = -1,
		action 		= function()
			add_projectile("mods/spellbound_bundle/files/entities/projectiles/cube.xml")
			c.fire_rate_wait = c.fire_rate_wait +3.0
			c.screenshake = c.screenshake + 20.0
			c.damage_critical_chance = c.damage_critical_chance + 0.0
			c.damage_critical_multiplier = c.damage_critical_multiplier + 0.1
			shot_effects.recoil_knockback = shot_effects.recoil_knockback + 10
		end,
	},
	]]
	--[[{
		id          = "GOKI_DUMMY_SHOT",
		name 		= "Dummy Shot",
		description = "This spell can be targeted by homing spells.",
		sprite 		= "mods/spellbound_bundle/files/goki_ports/actions/dummy_shot/icon.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "1,3,5",
		spawn_probability                 = "0.4,0.4,0.4", 
		price = 10,
		mana = 0,
		max_uses = -1,
		custom_xml_file = nil,
		action 		= function()
            c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/goki_ports/actions/dummy_shot/projectile_extra_entity.xml,";
            draw_actions( 1, true );
		end,
	},
	{
		id          = "GOKI_SEPARATOR",
		name 		= "Separator",
		description = "Cast a spell that has it's own modifier group",
		sprite 		= "mods/spellbound_bundle/files/goki_ports/actions/separator/icon.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "4,5,6",
		spawn_probability                 = "0.3,0.3,0.3", 
		price = 210,
		mana = 0,
		max_uses = -1,
		custom_xml_file = nil,
		action 		= function()
			if reflecting then return; end
			local old_c = c;
			BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/trigger_projectile.xml" );
				BeginTriggerDeath();
					c = {};
					reset_modifiers( c );
					for k,v in pairs(old_c) do
						c[k] = v;
					end
					draw_actions( 1, true );
					register_action( c );
					SetProjectileConfigs();
				EndTrigger();
			EndProjectile();
			c = old_c;
		end,
	},
	


	]]
	{
		id          = "GOKI_BARRIER_TRAIL",
		name 		= "Barrier Trail",
		description = "Gives projectiles a trail of barriers",
		sprite 		= "mods/spellbound_bundle/files/goki_ports/actions/barrier_trail/icon.png",
		related_projectiles	= nil,
		related_extra_entities = { "mods/spellbound_bundle/files/goki_ports/actions/barrier_trail/wall_builder.xml" },
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,3,4,5",
		spawn_probability                 = "0.7,0.7,0.7,0.7", 
		price = 200,
		mana = 20,
		max_uses = -1,
		custom_xml_file = nil,
		action 		= function()
            c.extra_entities = c.extra_entities.."mods/spellbound_bundle/files/goki_ports/actions/barrier_trail/wall_builder.xml,";
            draw_actions( 1, true );
		end,
	},
	{
		id          = "GOKI_CHAOTIC_BURST",
		name 		= "Chaotic Burst",
		description = "Cast an uncontrolled burst of projectiles",
		sprite 		= "mods/spellbound_bundle/files/goki_ports/actions/chaotic_burst/icon.png",
		related_projectiles	= {"mods/spellbound_bundle/files/goki_ports/actions/chaotic_burst/projectile.xml"},
		related_extra_entities = nil,
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "3,4,5,6",
		spawn_probability                 = "1,1,1,1", 
		price = 260,
		mana = 42,
		max_uses = -1,
		custom_xml_file = nil,
		action 		= function()
            add_projectile( "mods/spellbound_bundle/files/goki_ports/actions/chaotic_burst/projectile.xml" );
            add_projectile( "mods/spellbound_bundle/files/goki_ports/actions/chaotic_burst/projectile.xml" );
            add_projectile( "mods/spellbound_bundle/files/goki_ports/actions/chaotic_burst/projectile.xml" );
            add_projectile( "mods/spellbound_bundle/files/goki_ports/actions/chaotic_burst/projectile.xml" );
            add_projectile( "mods/spellbound_bundle/files/goki_ports/actions/chaotic_burst/projectile.xml" );
		end,
	},
	{
		id          = "GOKI_ZAP",
		name 		= "Zap",
		description = "A short lived spark of electricity.",
		sprite 		= "mods/spellbound_bundle/files/goki_ports/actions/zap/icon.png",
		related_projectiles	= {"mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml"},
		related_extra_entities = nil,
		type 		= ACTION_TYPE_PROJECTILE,
		spawn_level                       = "1,3,4",
		spawn_probability                 = "1,1,1", 
		price = 170,
		mana = 8,
		max_uses = -1,
		custom_xml_file = "mods/spellbound_bundle/files/goki_ports/actions/zap/custom_card.xml",
		action 		= function()
            c.fire_rate_wait = c.fire_rate_wait - 5;
            current_reload_time = current_reload_time - 5;
            
            if reflecting then 
                Reflection_RegisterProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                return;
            end

            if GameGetFrameNum() % 3 == 0 then
                BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                BeginTriggerDeath();
                    BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                    BeginTriggerDeath();
                        BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                        EndProjectile();
                        BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                        EndProjectile();
                        register_action( c );
                        SetProjectileConfigs();
                    EndTrigger();
                    EndProjectile();
                    BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                    BeginTriggerDeath();
                        BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                        EndProjectile();
                        BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                        EndProjectile();
                        register_action( c );
                        SetProjectileConfigs();
                    EndTrigger();
                    EndProjectile();
                    register_action( c );
                    SetProjectileConfigs();
                EndTrigger();
                EndProjectile();
            elseif GameGetFrameNum() % 3 == 1 then
                BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                BeginTriggerDeath();
                    BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                    BeginTriggerDeath();
                        BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                        EndProjectile();
                        register_action( c );
                        SetProjectileConfigs();
                    EndTrigger();
                    EndProjectile();

                    BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                    EndProjectile();

                    BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                    BeginTriggerDeath();
                        BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                        EndProjectile();
                        register_action( c );
                        SetProjectileConfigs();
                    EndTrigger();
                    EndProjectile();
                    register_action( c );
                    SetProjectileConfigs();
                EndTrigger();
                EndProjectile();
            else
                BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                BeginTriggerDeath();
                    BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                    BeginTriggerDeath();
                        BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                        EndProjectile();
                        register_action( c );
                        SetProjectileConfigs();
                    EndTrigger();
                    EndProjectile();
                EndTrigger();
                EndProjectile();

                BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                BeginTriggerDeath();
                    BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                    BeginTriggerDeath();
                        BeginProjectile( "mods/spellbound_bundle/files/goki_ports/actions/zap/projectile.xml" );
                        EndProjectile();
                        register_action( c );
                        SetProjectileConfigs();
                    EndTrigger();
                    EndProjectile();
                EndTrigger();
                EndProjectile();
            end
		end,
	},
	{
		id          = "GOKI_PROTECTIVE_ENCHANTMENT",
		name 		= "Protective Enchantment",
		description = "Causes projectiles to no longer damage the caster.",
		sprite 		= "mods/spellbound_bundle/files/goki_ports/actions/protective_enchantment/icon.png",
		related_projectiles	= nil,
		related_extra_entities = {"mods/spellbound_bundle/files/goki_ports/actions/protective_enchantment/projectile_extra_entity.xml"},
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,3,4,5,6",
		spawn_probability                 = "1,1,1,1,1,1,1", 
		price = 200,
		mana = 23,
		max_uses = -1,
		custom_xml_file = nil,
		action 		= function()
            --gkbrkn.mana_multiplier = gkbrkn.mana_multiplier * 3;
            c.fire_rate_wait = c.fire_rate_wait + 17;
            current_reload_time = current_reload_time + 17;
            c.extra_entities = c.extra_entities.."mods/spellbound_bundle/files/goki_ports/actions/protective_enchantment/projectile_extra_entity.xml,";
            draw_actions( 1, true );
		end,
	},
	{
		id          = "GOKI_CLINGING_SHOT",
		name 		= "Clinging Shot",
		description = "Cast a spell that is greatly attracted to an adjacent target.",
		sprite 		= "mods/spellbound_bundle/files/goki_ports/actions/clinging_shot/icon.png",
		related_projectiles	= nil,
		related_extra_entities = {"mods/spellbound_bundle/files/goki_ports/actions/clinging_shot/projectile_extra_entity.xml"},
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,3,4,5,6,10",
		spawn_probability                 = "0.12,0.12,0.12,0.24,0.24,0.36", 
		price = 150,
		mana = 30,
		max_uses = -1,
		custom_xml_file = nil,
		action 		= function()
            c.extra_entities = c.extra_entities.."mods/spellbound_bundle/files/goki_ports/actions/clinging_shot/projectile_extra_entity.xml,";
            draw_actions( 1, true );
		end,
	},
	{
		id          = "GOKI_GLITTERING_TRAIL",
		name 		= "Glittering Trail",
		description = "Projectiles gain a trail of explosions.",
		sprite 		= "mods/spellbound_bundle/files/goki_ports/actions/glittering_trail/icon.png",
		related_projectiles	= nil,
		related_extra_entities = {"mods/spellbound_bundle/files/goki_ports/actions/glittering_trail/projectile_extra_entity.xml"},
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,3,4,5,6",
		spawn_probability                 = "0.7,0.7,0.7,0.7,0.7", 
		price = 150,
		mana = 30,
		max_uses = -1,
		custom_xml_file = nil,
		action 		= function()
            c.extra_entities = c.extra_entities.."mods/spellbound_bundle/files/goki_ports/actions/glittering_trail/projectile_extra_entity.xml,";
            draw_actions( 1, true );
		end,
	},
	{
		id          = "GOKI_PERSISTENT_SHOT",
		name 		= "Persistent Shot",
		description = "Cast 2 spells that keep moving in the direction they were cast.",
		sprite 		= "mods/spellbound_bundle/files/goki_ports/actions/persistent_shot/icon.png",
		related_projectiles	= nil,
		related_extra_entities = {"mods/spellbound_bundle/files/goki_ports/actions/persistent_shot/projectile_extra_entity.xml"},
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,3,4",
		spawn_probability                 = "0.4,0.4,0.4,0.4,0.4",
		price = 160,
		mana = 17,
		max_uses = -1,
		custom_xml_file = nil,
		action 		= function()
            c.extra_entities = c.extra_entities.."mods/spellbound_bundle/files/goki_ports/actions/persistent_shot/projectile_extra_entity.xml,";
            draw_actions( 2, true );
		end,
	},
	{
		id          = "GOKI_ZERO_GRAVITY",
		name 		= "Zero Gravity",
		description = "Projectiles have no gravity.",
		sprite 		= "mods/spellbound_bundle/files/goki_ports/actions/zero_gravity/icon.png",
		related_projectiles	= nil,
		related_extra_entities = {"mods/spellbound_bundle/files/goki_ports/actions/zero_gravity/projectile_extra_entity.xml"},
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "0,1,2,3,4",
		spawn_probability                 = "0.4,0.4,0.4,0.4,0.4",
		price = 160,
		mana = 17,
		max_uses = -1,
		custom_xml_file = nil,
		action 		= function()
            c.extra_entities = c.extra_entities.."mods/spellbound_bundle/files/goki_ports/actions/zero_gravity/projectile_extra_entity.xml,";
            draw_actions( 1, true );
		end,
	},
	{
		id          = "SPELLBOUND_BUNDLE_SPELL_MERGE",
		name 		= "Spell Merge",
		description = "Merges all the spells in the current cast into a single one. Requires a multicast spell to work.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/spell_merger.png",
		related_projectiles	= nil,
		related_extra_entities = {},
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,3,4,5,6",
		spawn_probability                 = "1,1,1,1,1", 
		price = 160,
		mana = 20,
		max_uses = -1,
		custom_xml_file = nil,
		action 		= function(recursion_level, iteration)

			if(reflecting)then return end

			old_add_projectile = add_projectile
			
			old_add_projectile_trigger_timer = add_projectile_trigger_timer
	
			old_add_projectile_trigger_hit_world = add_projectile_trigger_hit_world
			
			old_add_projectile_trigger_death = add_projectile_trigger_death
	
	
			local average_draw_count = 0
	
			local spell_count = 0
	
			local timers = 0
			local worlds = 0
			local deaths = 0
	
			local is_trigger_timer = false
			local is_trigger_death = false
			local is_trigger_world = false
			local no_trigger = false
	
			local average_time = 0
	
			local last_projectile = nil
	
			add_projectile = function( entity_filename )
				c.extra_entities = c.extra_entities .. entity_filename .. ","
				spell_count = spell_count + 1
				last_projectile = entity_filename
			end
			
			add_projectile_trigger_timer = function( entity_filename, delay_frames, action_draw_count )
				c.extra_entities = c.extra_entities .. entity_filename .. ","
				spell_count = spell_count + 1
				average_draw_count = average_draw_count + action_draw_count
				timers = timers + 1
				average_time = average_time + delay_frames
				last_projectile = entity_filename
			end
			
			add_projectile_trigger_hit_world = function( entity_filename, action_draw_count )
				c.extra_entities = c.extra_entities .. entity_filename .. ","
				spell_count = spell_count + 1
				average_draw_count = average_draw_count + action_draw_count
				worlds = worlds + 1
				last_projectile = entity_filename
			end
			
			add_projectile_trigger_death = function( entity_filename, action_draw_count )
				c.extra_entities = c.extra_entities .. entity_filename .. ","
				spell_count = spell_count + 1
				average_draw_count = average_draw_count + action_draw_count
				deaths = deaths + 1
				last_projectile = entity_filename
			end
	
	
			draw_actions(1, true)

	
			average_time = average_time / timers
			average_draw_count = math.ceil(average_draw_count / spell_count)
	
			if(timers > worlds and timers > deaths)then
				is_trigger_timer = true
			elseif(deaths > timers and deaths > worlds)then
				is_trigger_death = true
			elseif(worlds > timers and worlds > deaths)then
				is_trigger_world = true
			else
				if(average_draw_count > 0)then
					is_trigger_world = true
				else
					no_trigger = true
				end
			end
	
	
			add_projectile = old_add_projectile
			
			add_projectile_trigger_timer = old_add_projectile_trigger_timer
	
			add_projectile_trigger_hit_world = old_add_projectile_trigger_hit_world
			
			add_projectile_trigger_death = old_add_projectile_trigger_death
			

			if(last_projectile ~= nil)then
				if(no_trigger)then
					add_projectile(last_projectile)
				elseif(is_trigger_timer)then
					add_projectile_trigger_timer( last_projectile, average_time, average_draw_count )
				elseif(is_trigger_world)then
					add_projectile_trigger_hit_world( last_projectile, average_draw_count )
				elseif(is_trigger_death)then
					add_projectile_trigger_death( last_projectile, average_draw_count )
				end
			end
		end,
	},

	{
		id          = "SPELLBOUND_ACTIVE_HOMING",
		name 		= "Active Homing",
		description = "Homes in on targets within it's FOV.",
		sprite 		= "mods/spellbound_bundle/files/gfx/ui_gfx/force_module.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,4,5,6",
		spawn_probability                 = "1,1,1,1", 
		price = 140,
		mana = 0,
		--max_uses = 100,
		action 		= function()
			c.extra_entities = c.extra_entities .. "mods/spellbound_bundle/files/entities/modifiers/active_homing.xml,"
			draw_actions( 1, true );
		end,
	}, 
	--[[
	{
		id          = "SPELLBOUND_VOLLEY",
		name 		= "Volley",
		description = "Repeats the spell a number of times",
		sprite 		= "mods/spellbound_bundle/files/goki_ports/actions/burst_fire/icon.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,3,4,5",
		spawn_probability                 = "0.7,0.7,0.7,0.7", 
		price = 200,
		mana = 20,
		max_uses = -1,
		custom_xml_file = nil,
		action 		= function()
			for x = 1, 5 do
				draw_actions( 1, true )
				if(x < 5)then
					for i, v in ipairs(hand)do
						if(v.id ~= "SPELLBOUND_VOLLEY")then
							table.insert(deck, 1, v)
						end
					end
					hand = {}
				end
			end
			for i,v in ipairs( hand ) do
				table.insert( discarded, v )
			end
			hand = {}
		end,
	},
	]]
	--[[
	{
		id          = "SPELLBOUND_FULL_STOP",
		name 		= "Full Stop",
		description = "Ends a cast.",
		sprite 		= "mods/spellbound_bundle/files/goki_ports/actions/burst_fire/icon.png",
		type 		= ACTION_TYPE_MODIFIER,
		spawn_level                       = "2,3,4,5",
		spawn_probability                 = "0.7,0.7,0.7,0.7", 
		price = 200,
		mana = 20,
		max_uses = -1,
		custom_xml_file = nil,
		action 		= function()
			for i,v in ipairs( hand ) do
				-- print( "removed " .. v.id .. " from hand" )
				table.insert( discarded, v )
			end
			
			hand = {}
			
			force_stop_draws = true
		end,
	},
	]]
	-- Magic Pen

}

function HasSettingFlag(name)
    return ModSettingGet(name) or false
end

function AddSettingFlag(name)
    ModSettingSet(name, true)
  --  ModSettingSetNextValue(name, true)
end

function RemoveSettingFlag(name)
    ModSettingRemove(name)
end


if(actions ~= nil)then
	for k, v in pairs(spellbound_actions)do
		if(not HasSettingFlag(v.id.."_disabled"))then
			table.insert(actions, v)
		end
	end
end
