script_enemy_main {
	#include_function ".\includeSatori.txt"
	task TMain {
		SetDamageRate(125, 50);
		SetMovePosition03(GetCenterX, GetCenterY-25, 10, 9);
		SetInvincibility(180);
		while(OnPlayerMissed || OnBomb) { SetInvincibility(180); yield; }
		wait(120);
		TCharge(GetX, GetY);
		PlaySE2("charge");
		wait(60);
		attack1;
	}
	task attack1 {
		let a = 0; let sy = 0; let yellow = false;
		task HypnosisLaser {
			SetShotColor(255, 16, 16);
			let obj = Obj_Create(OBJ_LASER);
			Obj_SetPosition(obj, 0, sy);
			Obj_SetAngle(obj, 0);
			ObjShot_SetGraphic(obj, 225);
			ObjShot_SetDelay(obj, 300);
			ObjLaser_SetLength(obj, 384+64);
			ObjLaser_SetWidth(obj, 30);
			SetShotColor(255, 255, 255);
			let down = 6;
			while(a > 0) {
				if((|Obj_GetY(obj)-GetPlayerY|)>2) {
					Obj_SetY(obj, Obj_GetY(obj)+down);
				} else {
					down = 6;
				}
				if(down > 3) { down-=1/10; }
				wait(1);
			}
			wait(20);
			ObjLaser_SetWidth(obj, 10);
			ObjShot_SetDelay(obj, 0);
			wait(35);
			descent(i in 0..10) {
				ObjLaser_SetWidth(obj, 10*i/10);
				wait(1);
			}
			Obj_Delete(obj);
		}
		task CreateLasers {
			a = 220;
			let n = 0;
			let num = [6, 9, 13, 18][GetDifficulty];
			loop(10) {
				PlaySE2("lazer00");
				HypnosisLaser;
				let ang = GetAngleToPlayer+rand(-6,6);
				if(yellow) { ascent(i in 0..num) { 
					CreateShotA(0, GetX, GetY, 10);
					SetShotDataA(0, 0, 4, ang+i*360/num, 1*((-1)^n), -1/10, 2+rand(-1, 2)/5, 3);
					SetShotDataA(0, 90, NULL, NULL, 0, -1/10, 2+rand(-1, 2)/5, NULL);
					FireShot(0);
				} }
				n++; n%=2;
				wait(20);
			}
		}
		task Countdown { loop { a--; yield; } } Countdown;
		loop {
			CreateLasers;
			wait(150);
			TCharge(GetX, GetY);
			PlaySE2("charge");
			wait(90);
			PlaySE2("kira00");
			SetMovePosition03(GetCenterX+rand(-75, 75), GetCenterY-25+rand(-30,30), 10, 9);
			sy = rand(-12, 12);
			wait(90);
			yellow = true;
		}
	}
}