script_enemy_main {
	#include_function ".\includeSatori.txt"
	task TMain {
		SetDamageRate(225, 125);
		SetMovePosition03(GetX+rand(-50, 50), GetY+rand(-30, 30), 10, 9);
		SetInvincibility(180);
		wait(60);
		SetMovePosition03(GetCenterX, GetCenterY-100, 10, 9);
		wait(60);
		TCharge(GetCenterX, GetCenterY-100);
		PlaySE2("charge");
		wait(60);
		attack1;
	}
	task attack1 {
		let side = 1;
		loop {
			let a = -37;
			let b = 73;
			let c = -29;
			let time = 3;
			ascent(n in 0..[60, 60, 90, 90][GetDifficulty]) {
				PlaySE2("tan00");
				if(n%[6, 4, 5, 4][GetDifficulty] == 0) {
					ascent(i in 0..2) {
						CreateShotA(0, GetX, GetY, 20);
						SetShotDataA(0, 0, 5, -90+a+i*360/2, 0, -5/45, 0, 199);
						SetShotDataA(0, 45, 0, NULL, -2, 1/10, 2, NULL);
						SetShotDataA(0, 90, 2, NULL, 0, 0, 0, NULL);
						FireShot(0);
						CreateShotA(0, GetX, GetY, 20);
						SetShotDataA(0, 0, 5, -90-a+i*360/2, 0, -5/45, 0, 199);
						SetShotDataA(0, 45, 0, NULL, 2, 1/10, 2, NULL);
						SetShotDataA(0, 90, 2, NULL, 0, 0, 0, NULL);
						FireShot(0);
					}
					a+=[41, 34, 27, 17][GetDifficulty]*side;
					a%=360;
				}
				ascent(i in 0..2) {
					let b2 = b+i*360/2;
					let c2 = c+i*360/2;
					let x1 = GetX; let y1 = GetY;
					let x = 100*cos(b2); let y = 35*sin(b2);
					local {
						CreateShotA(0, x1+x*cos(c)-y*sin(c), y1+y*cos(c)+x*sin(c), 20);
						SetShotDataA(0, 0, 2, 90-c2, 0, -2/45, 0, 41+i*5);
						SetShotDataA(0, 45, 0, NULL, 0, 2/45, 2, NULL);
						FireShot(0);
					}
					local {
						CreateShotA(0, x1-(x*cos(c)-y*sin(c)), y1+(y*cos(c)+x*sin(c)), 20);
						SetShotDataA(0, 0, 2, c2+90, 0, -2/45, 0, 41+i*5);
						SetShotDataA(0, 45, 0, NULL, 0, 2/45, 2, NULL);
						FireShot(0);
					}
				}
				b-=[27, 19, 23, 12][GetDifficulty]*side;
				b%=360;
				c+=[7, 6, 8, -6][GetDifficulty]*side;
				c%=360;
				wait([3, 3, 2, 2][GetDifficulty]);
			}
			TCharge(GetX, GetY);
			PlaySE2("charge");
			SetMovePosition03(GetCenterX+rand(-35, 35), GetCenterY-100+rand(-20, 20), 10, 9);
			wait(60);
			side*=-1;
		}
	}
}