dofile("script/layouts/room2_defaults.lua")
dofile("script/shifts/shift2_1_animations.lua")

levelDesc.name = "Shift 2.1"
levelDesc.levelId = 21
levelDesc.musicMood = "2"
levelDesc.trigger =
{
	class = "TriggerSystem",
	triggers =
	{
		{ trigger = "spawn", delay=1000, hearts=3, diseaseDesc = { class="Disease", steps={"PILLS2", } } },
		{ trigger = "startEvent", delay = 14000, },
		{ trigger = "spawn", delay=8000, hearts=2, diseaseDesc = { class="Disease", steps={"PILLS1", "XRAY_MINIGAME", } } },
		{ trigger = "spawn", delay=10000, hearts=3, diseaseDesc = { class="Disease", steps={"GIVE_BLOOD", } } },
		{ trigger = "spawn", delay=25000, hearts=2, diseaseDesc = { class="Disease", steps={"PILLS3", "PUT_ON_CREAM", } } },
		{ trigger = "spawn", delay=10000, hearts=2, diseaseDesc = { class="Disease", steps={"XRAY", "PUT_ON_CREAM", } } },
		{ trigger = "spawn", delay=8000, hearts=3, diseaseDesc = { class="Disease", steps={"XRAY_MINIGAME", "GIVE_BLOOD" } } },
		{ trigger = "spawn", delay=28000, hearts=3, diseaseDesc = { class="Disease", steps={"PILLS2", "GIVE_BLOOD", } } },
		{ trigger = "spawn", delay=16000, hearts=1, diseaseDesc = { class="Disease", steps={"PILLS1", "XRAY", } } },
		{ trigger = "spawn", delay=25000, hearts=3, diseaseDesc = { class="Disease", steps={"PILLS3" } } },
		{ trigger = "spawn", delay=8000, hearts=2, diseaseDesc = { class="Disease", steps={"PILLS2", "PUT_ON_CREAM" } } },
		{ trigger = "spawn", delay=15000, hearts=2, diseaseDesc = { class="Disease", steps={"XRAY_MINIGAME", "GIVE_BLOOD" } } },
		{ trigger = "spawn", delay=10000, hearts=2, diseaseDesc = { class="Disease", steps={"PILLS1", "XRAY_MINIGAME", } } },
		{ trigger = "spawn", delay=8000, hearts=3, diseaseDesc = { class="Disease", steps={"PILLS3", "GIVE_BLOOD" } } },
	}
}
levelDesc.patientList =
{
	p0 = { weight = 50,
		base = "axel",
	},
	p1 = { weight = 50,
		base = "lady",
	},
	p2 = { weight = 25,
		base = "mother",
	},
	p5 = { weight = 25,
		base = "local_male",
	},
}

local onStartEvent = function(self)
	GestureEvent.onStart(self) -- This is right
	local oldMan = level:getCharacter("oldman")
	assert(oldMan)
	local position = level.currentRoom.queueIn:getQueuePosition(0, 2)
	assert(position)
	if (position) then
		oldMan:setQueueSpot(position)
	end
end

levelDesc.eventDesc =
{
	class="GestureEvent",
	onStart = onStartEvent,
	eventBarImage = "EVENTBAR_ICON_GESTURE:icons",
	doGestureObject = "event_pills",
	gestureLocation = {x=500, y=500},
	gestures = {
		{desc=3, objectId="hero", animation="ADDSCOOPX", gestureLocation={x=840, y=90}},
		{desc=19, drainSpeed = 30, growSpeed=20, objectId="hero", animation="SHAKE", gestureLocation={x=840, y=90}},
--[[
		{desc=19, drainSpeed = 30, growSpeed=20, objectId="hero", animation="SHAKE", gestureLocation={x=840, y=90}},
		{desc=20, drainSpeed = 30, growSpeed=20, objectId="hero", animation="SHAKE", gestureLocation={x=840, y=90}},
		{desc=20, drainSpeed = 30, growSpeed=20, objectId="hero", animation="SHAKE", gestureLocation={x=840, y=90}},
		{desc=17, drainSpeed = 30, growSpeed=20, objectId="hero", animation="SHAKE", gestureLocation={x=840, y=90}},
		{desc=17, drainSpeed = 30, growSpeed=20, objectId="hero", animation="SHAKE", gestureLocation={x=840, y=90}},
		{desc=18, drainSpeed = 30, growSpeed=20, objectId="hero", animation="SHAKE", gestureLocation={x=840, y=90}},
		{desc=18, drainSpeed = 30, growSpeed=20, objectId="hero", animation="SHAKE", gestureLocation={x=840, y=90}},
]]
		{desc=6, objectId="hero", animation="TURNON", gestureLocation={x=840, y=90}},
		{desc=5, objectId="hero", animation="TURNOFF", gestureLocation={x=840, y=90}, timeBeforeStart=20000},
		{desc=4, objectId="hero", animation="ADDSCOOPY", gestureLocation={x=840, y=90}},
		{desc=15, drainSpeed = 30, growSpeed=20, objectId="hero", animation="TAP", gestureLocation={x=840, y=90}},
		{desc=4, objectId="hero", animation="POOR", gestureLocation={x=840, y=90}},
		{desc=10, objectId="hero", animation="PILLMACHINE1", gestureLocation={x=840, y=90}},
		{desc=8, objectId="hero", animation="PILLMACHINE2", gestureLocation={x=840, y=160}},
	},
	scoreOneDone=1,
	scoreAllDone=1,
	hintTip = "bottomleft",
}

function levelDesc:onInitialized(desc)
	PigRace.initShift(self)
end
