#TouhouDanmakufu
#Title [Spell 4]
#ScriptVersion[2]


script_enemy_main {

     #include_function "lib\SHOT_REPLACE\shot_replace.dnh"

     let frame = 0;
     let frame2 = 0;
     let angle = 60;
     let angle2 = 40;
     let angle3 = 64;
    @Initialize {
        SetX(GetCenterX);
        SetY(GetClipMinY + 120);
        SetLife(1000);
        SetDamageRate(25, 15);
        SetEnemyMarker(true);
        CutIn(KOUMA, " Hallucination "\""Mind Of Regeneration"\", "script\img\Reisen.png", 0, 0, 200, 500);
        SetScore(123456);
        SetTimer(50);
        SetDurableSpellCard;
        MagicCircle(true);
        shotinit;

        LoadGraphic("script\img\Reisen.png");
        SetTexture("script\img\Reisen.png");
        SetGraphicRect(0, 0, 400, 533);
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 24);
        SetCollisionB(GetX, GetY, 24);
        let a = 0;

        if(frame==90){

		loop(6){
			CreateShot02(GetX, GetY, 0.5, angle, 0.05, 2, BLUEI54, 0);
			angle += 60; 
		}

		loop(6){
			CreateShot02(GetX, GetY, 1, angle-10, 0.05, 2, REDI54, 0);
			angle += 60; 
		}

		loop(4){
			CreateShot02(GetX, GetY, 2, angle-30, 0.05, 3, WHITEI54, 0);
			angle += 90; 
		}

		loop(8){
			CreateShot02(GetX, GetY, 2, angle2+120, 0.05, 3, WHITE54, 0);
			angle2 += 45; 
		}

		loop(3){
			CreateShot02(GetX, GetY, 0.5, angle2, 0.05, 2, PURPLE54, 0);
			angle2 += 120; 
		}

		loop(3){
			CreateShot02(GetX, GetY, 1, angle2-65, 0.05, 2, PURPLEI54, 0);
			angle2 += 120; 
		}

		frame = 88;	
		angle += rand(3, 7);
		angle2 -= rand(3, 7);

        }

	if(frame2==120){
		frame = 30;
		frame2 = 45;
	}

       
         frame++;
         frame2++;
 }
     
     

    @DrawLoop {
        DrawGraphic(GetX, GetY);
	SetGraphicScale(0.25, 0.25);
    }

    @Finalize{
        DeleteGraphic("script\img\ExRumia.png");
     }
}