script_enemy_main {
	#include_function ".\includeSatori.txt"
	task TMain {
		SetDamageRate(125, 50);
		SetMovePosition03(GetCenterX, GetCenterY-85, 10, 9);
		SetInvincibility(180);
		while(OnPlayerMissed || OnBomb) { SetInvincibility(180); yield; }
		wait(120);
		TCharge(GetX, GetY);
		PlaySE2("charge");
		wait(60);
		attack1;
		attack2;
	}
	task attack1 {
		let g = 0;
		loop {
			loop(10) {
				PlaySE2("lazer00");
				let x = GetX+rand(-70, 70); let ang = rand(-7, 7);
				ascent(i in 0..5) {
					CreateLaser(x+15+i*130, GetClipMinY+64, 0, ang+90, g);
					CreateLaser(x-15-i*130, GetClipMinY+64, 180, ang+90, g);
					CreateLaser(x-15+i*130, GetClipMinY+64, 0, ang-90, g);
					CreateLaser(x-15-i*130, GetClipMinY+64, 180, ang-90, g);
				}
				g+=1; g%=2;
				wait(24);
			}
			wait(30);
			loop(10) {
				PlaySE2("lazer00");
				let y = GetCenterY+rand(-70, 70); let ang = rand(-7, 7);
				ascent(i in 0..5) {
					CreateLaser(GetCenterX-160, y+15+i*130, 90, ang+0, g);
					CreateLaser(GetCenterX-160, y-15-i*130, -90, ang+0, g);
					CreateLaser(GetCenterX-160, y+15+i*130, 90, ang+180, g);
					CreateLaser(GetCenterX-160, y-15-i*130, -90, ang+180, g);
				}
				g+=1; g%=2;
				wait(24);
			}
			wait(30);
			loop(10) {
				PlaySE2("lazer00");
				let y = GetCenterY+rand(-70, 70); let ang = rand(-7, 7);
				ascent(i in 0..5) {
					CreateLaser(GetCenterX+160, y+15+i*130, 90, ang+0, g);
					CreateLaser(GetCenterX+160, y-15-i*130, -90, ang+0, g);
					CreateLaser(GetCenterX+160, y+15+i*130, 90, ang+180, g);
					CreateLaser(GetCenterX+160, y-15-i*130, -90, ang+180, g);
				}
				g+=1; g%=2;
				wait(24);
			}
		}
	}
	task attack2 {
		let s = 1;
		loop {
			wait(60);
			ExMove;
			let a = GetAngleToPlayer+36*s;
			loop(10) {
				PlaySE2("tan00");
				ascent(i in 0..8) { CreateShot01(GetX, GetY, rand(2, 3), a+i*360/8+rand(-8,8), 4, 10); }
				a-=5*s;
				wait(6);
			}
			s*=-1;
		}
	}
	task CreateLaser (let x, let y, let angleaim, let angle, let gra) {
		let obj = Obj_Create(OBJ_LASER);
		Obj_SetPosition(obj, x, y);
		Obj_SetAngle(obj, angleaim);
		ObjShot_SetGraphic(obj, [97, 102][gra]);
		ObjShot_SetDelay(obj, 10);
		ObjLaser_SetLength(obj, 100);
		ObjLaser_SetWidth(obj, 12);
		ObjLaser_SetSource(obj, false);
		let v = 0;
		loop(180) {
			if(v < 3) { v+=1/10; }
			Obj_SetPosition(obj, Obj_GetX(obj)+v*cos(angle), Obj_GetY(obj)+v*sin(angle));
			wait(1);
		}
		Obj_Delete(obj);
	}
}