#e
#Title[Vϒnفul\ӂ̑^v(Omake)]
#Text[͊Ϗܗp̒eł]
#ScriptVersion[2]


script_enemy_main {
    //ʏݒ
    #include_function ".\INCLUDE\BOSS_INI.txt"

    let name        = "Vϒnفul\ӂ̑^v";

    let wIni    = 100;
	let signal = false;
	let sigangle = 0;

    @Initialize {
        SetMovePosition02(GetCenterX, GetClipMinY + 120, wIni);
        SetX(GetCenterX);
        SetY(GetClipMinY + 120);

        thMCutIn(1,name);
        SetLife(2400);		//Ct
        SetTimer(70);		//^C}[
        SetScore(4000000);	//{[iXXRA

        LoadGraphicthM;
        SetTexture(imgBoss);

        SetInvincibility(wIni);
        SetDamageRate(50, 50);

        TMain;
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 24);
        SetCollisionB(GetX, GetY, 24);

        yield; 
    }

    @DrawLoop {
        BossDraw(1);
    }

    @Finalize {
	SpellClear;
        DeleteGraphic(imgBoss);
    }

    @BackGround {
	BgDraw;
    }

//==========================================================================================

    // C^XNiʂ͂ȍ~ҏWĂj
    task TMain {
        yield;
        loop(wIni) { yield; }

	Shot;
    }

    //e
    task Shot{
	let f = 30;	//ˊԊu
	let id = 1001;	//eID
	let tid = 1002;	//ǉeID
	let tk = 60;
	let w = 5;
	let phase = 0;
	
	let nLeft = GetClipMinX + 40;
	let nRight  = GetClipMaxX - 40;
	let nTop = GetClipMinY - 20;
	let nBottom = GetClipMaxY + 20;
	
	let nLeft2 = GetClipMinX - 20;
	let nRight2  = GetClipMaxX + 20;
	let nTop2 = GetClipMinY + 60;
	let nBottom2 = GetClipMaxY - 60;
	
	SubShot;
	yield;
	BossMoveEXloop(20, 120);
	loop{
		alternative(phase)
		case(0){
			CreateShotA(id, nLeft2 + rand(-5, +5), nTop2, 5);
			SetShotDataA(id, 0, 5, 0, 0, 0, 0, US_BALL_L_BLUE);
			ascent(let i in 0..tk){
				ascent(let j in 0..5){
					CreateShotA(tid, 0, 0, 25);
					SetShotDataA(tid, 0, 0, 90, 0, 0, 0, US_LIGHT2_BLUE);
					SetShotDataA(tid, 80+j*5, 0, NULL, 0, +0.1, 8, US_LIGHT2_BLUE);
					AddShot(i*w, id, tid, 0);
					CreateShotA(tid, 0, 0, 25);
					SetShotDataA(tid, 0, 0, 270, 0, 0, 0, US_LIGHT2_BLUE);
					SetShotDataA(tid, 80+j*5, 0, NULL, 0, +0.1, 8, US_LIGHT2_BLUE);
					AddShot(i*w, id, tid, 0);
				}
			}
			FireShot(id);
		}
		case(1){
			CreateShotA(id, nRight2 + rand(-5, +5), nBottom2, 5);
			SetShotDataA(id, 0, 5, 180, 0, 0, 0, US_BALL_L_BLUE);
			ascent(let i in 0..tk){
				ascent(let j in 0..5){
					CreateShotA(tid, 0, 0, 25);
					SetShotDataA(tid, 0, 0, 905, 0, 0, 0, US_LIGHT2_BLUE);
					SetShotDataA(tid, 80+j*5, 0, NULL, 0, +0.1, 8, US_LIGHT2_BLUE);
					AddShot(i*w, id, tid, 0);
					CreateShotA(tid, 0, 0, 25);
					SetShotDataA(tid, 0, 0, 270, 0, 0, 0, US_LIGHT2_BLUE);
					SetShotDataA(tid, 80+j*5, 0, NULL, 0, +0.1, 8, US_LIGHT2_BLUE);
					AddShot(i*w, id, tid, 0);
				}
			}
			FireShot(id);
		}
		case(2){
			CreateShotA(id, nLeft, nTop + rand(-5, +5), 5);
			SetShotDataA(id, 0, 5, 90, 0, 0, 0, US_BALL_L_BLUE);
			ascent(let i in 0..tk){
				ascent(let j in 0..5){
					CreateShotA(tid, 0, 0, 25);
					SetShotDataA(tid, 0, 0, 15, 0, 0, 0, US_LIGHT2_BLUE);
					SetShotDataA(tid, 80+j*5, 0, NULL, 0, +0.1, 8, US_LIGHT2_BLUE);
					AddShot(i*w, id, tid, 0);
					CreateShotA(tid, 0, 0, 25);
					SetShotDataA(tid, 0, 0, 165, 0, 0, 0, US_LIGHT2_BLUE);
					SetShotDataA(tid, 80+j*5, 0, NULL, 0, +0.1, 8, US_LIGHT2_BLUE);
					AddShot(i*w, id, tid, 0);
				}
			}
			FireShot(id);
		}
		case(3){
			CreateShotA(id, nRight, nBottom + rand(-5, +5), 5);
			SetShotDataA(id, 0, 5, 270, 0, 0, 0, US_BALL_L_BLUE);
			ascent(let i in 0..tk){
				ascent(let j in 0..5){
					CreateShotA(tid, 0, 0, 25);
					SetShotDataA(tid, 0, 0, 15, 0, 0, 0, US_LIGHT2_BLUE);
					SetShotDataA(tid, 80+j*5, 0, NULL, 0, +0.1, 8, US_LIGHT2_BLUE);
					AddShot(i*w, id, tid, 0);
					CreateShotA(tid, 0, 0, 25);
					SetShotDataA(tid, 0, 0, 165, 0, 0, 0, US_LIGHT2_BLUE);
					SetShotDataA(tid, 80+j*5, 0, NULL, 0, +0.1, 8, US_LIGHT2_BLUE);
					AddShot(i*w, id, tid, 0);
				}
			}
			FireShot(id);
		}
		phase = (phase + 1) % 4;
		__wait(f);
	}
    }


    //TuVbg
    task SubShot{
	let f = 60;	//ˊԊu
	
	loop{
		CreateShotNway02(GetX, GetY, 5, GetAngleToPlayer, 0, -0.1, 1, US_SCALE_BLUE, 10, 25, 5, 12);
		__wait(f);
	}
    }

//==========================================================================================
    // w t[҂
    function __wait(w) {
        loop(w) { yield; }
    }


}