--	Kerberos-Armee:
--	
--	CU_BlackKnight_LeaderMace1
--	CU_BlackKnight_LeaderMace2
--	
--	Beigemischt:
--	CU_BanditLeaderSword1
--	CU_BanditLeaderSword2
--	
--	Ab Folklung-Karte:
--	CU_Barbarian_LeaderClub1
--	CU_Barbarian_LeaderClub2

-- sowie normale Soldaten und Kanonen


-- East iron and sulfur mines

SPAWN_TIME_RESOURCE2	= 20

createArmyResources2 = function()

	--	set up

		armyResources2						= {}
	
		armyResources2.player 				= 5
		armyResources2.id					= 4
		armyResources2.strength				= 8
		armyResources2.position				= GetPosition("defend2")
		armyResources2.rodeLength			= 4000
		armyResources2.beAgressive			= true
		armyResources2.control				= {}
		armyResources2.control.timer		= 0
		
		SetupArmy(armyResources2)
	
	--	create

		local troopDescription = {
		
			maxNumberOfSoldiers	= 8,
			minNumberOfSoldiers	= 0,
			experiencePoints 	= LOW_EXPERIENCE,
		}				
	
--		troopDescription.leaderType = Entities.PU_LeaderSword1				
--		EnlargeArmy(armyResources2,troopDescription)

		troopDescription.leaderType = Entities.CU_BanditLeaderSword1				
		EnlargeArmy(armyResources2,troopDescription)
		EnlargeArmy(armyResources2,troopDescription)
		EnlargeArmy(armyResources2,troopDescription)
		EnlargeArmy(armyResources2,troopDescription)

		troopDescription.leaderType = Entities.PU_LeaderBow2
		EnlargeArmy(armyResources2,troopDescription)
		EnlargeArmy(armyResources2,troopDescription)
		EnlargeArmy(armyResources2,troopDescription)
		EnlargeArmy(armyResources2,troopDescription)
	
	--	job		
		
		StartJob("ControlArmyResources2")

	end

-----------------------------------------------------------------------------------------------------------------------	
--
--	JOB: "ControlArmyResources2"
--
-----------------------------------------------------------------------------------------------------------------------	
	-------------------------------------------------------------------------------------------------------------------
	Condition_ControlArmyResources2 = function()
	-------------------------------------------------------------------------------------------------------------------

		if armyResources2.control.timer > 0 then
		
			armyResources2.control.timer = armyResources2.control.timer -1

			return false

			end
		
		return Counter.Tick2("ControlArmyResources2",3)	
		
		end
		
	-------------------------------------------------------------------------------------------------------------------
	Action_ControlArmyResources2 = function()
	-------------------------------------------------------------------------------------------------------------------
		
		if IsDead("tower2a") and IsDead("tower2b") then
		return true
		end
		
		if GetNumberOfLeaders(armyResources2) <= 4 then

				armyResources2.control.timer = armyResources2.control.timer - 1
				
				if armyResources2.control.timer <=0 then
				
				local troopDescription = {
		
				maxNumberOfSoldiers	= 8,
				minNumberOfSoldiers	= 0,
				experiencePoints 	= LOW_EXPERIENCE,
				}			
				
				for zaehler = 1, armyResources2.strength - GetNumberOfLeaders(armyResources2), 1 do
					local randomzahl = math.random(99)
					if randomzahl >= 50 then
					troopDescription.leaderType = Entities.CU_BanditLeaderSword1		
					EnlargeArmy(armyResources2,troopDescription)
					else
					troopDescription.leaderType = Entities.PU_LeaderBow2
					EnlargeArmy(armyResources2,troopDescription)
					end
				end
				
			
			end
		
		
		
		
		end
		Defend(armyResources2)
		return false
		end