#TouhouDanmakufu
#Title[TEN_DESIRES_EX_BOSS_NON_6]
#Text[By Shockman2.]
#Player[FREE]
#BGM[.\mu\bgm.mp3]
#ScriptVersion[2]

script_enemy_main {

let frame1 = 0;
let frame2 = 0;
let frame3 = 0;
let frame4 = 0;
let frame5 = 0;
let frame6 = 0;
let frame7 = 0;
let frame8 = 0;
let frame9 = 0;
let frame10 = 0;
let frame11 = 0;
let anim1 = 0;
let anim2 = 0;
let anim3 = 0;
let a1 = 0;
let a2 = 0;
let a3 = 0;
let a4 = 0;
let a5 = 0;
let a6 = 0;
let a7 = 0;
let a8 = 0;
let acc1 = 0;
let acc2 = 0;
let acc3 = 0;
let acc4 = 0;
let acc5 = 0;
let acc6 = 0;
let acc7 = 0;
let acc8 = 0;
let acc9 = 0;
let acc10 = 0;
let acc11 = 0;
let acc12 = 0;
let kospin = 0;

let SP = GetCurrentScriptDirectory~"sp\sp.png";
let Custom = GetCurrentScriptDirectory~"sup\supershot.txt";
let MC = GetCurrentScriptDirectory~"ef\MC.png";
let CBG1 = GetCurrentScriptDirectory~"ef\cbg1.png";
let CBG2 = GetCurrentScriptDirectory~"ef\cbg2.png";
let NBG1 = GetCurrentScriptDirectory~"ef\nbg1.png";
let charge = GetCurrentScriptDirectory~"se\Charge2.wav";
let sh1 = GetCurrentScriptDirectory~"se\Shot1.wav";
let sh2 = GetCurrentScriptDirectory~"se\BulletWave.wav";
let Cut = GetCurrentScriptDirectory~"ef\cut.png";
	#include_function ".\function_cutin.txt";
	#include_function ".\maple.txt";

    @Initialize {

SetMovePosition03(GetCenterX, GetCenterY - 150, 10, 10);

LoadUserShotData(Custom);
LoadGraphic(SP);
LoadGraphic(MC);
LoadGraphic(Cut);
LoadGraphic(CBG1);
LoadGraphic(CBG2);
LoadGraphic(NBG1);
LoadSE(charge);
LoadSE(sh1);
LoadSE(sh2);

SetLife(800);
SetDamageRate(30, 20);
SetTimer(60);
SetInvincibility(120);
SetEnemyMarker(true);
SetShotAutoDeleteClip(128,128,128,128);
    }

    @MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 24);
yield;
task BulletA(x,y,v,angle,graphic,delay) {
     let obj=Obj_Create(OBJ_SHOT);

     Obj_SetPosition(obj, x, y);
     Obj_SetAngle(obj, angle);
     Obj_SetSpeed(obj, v);
     ObjShot_SetGraphic(obj, graphic);
     ObjShot_SetDelay  (obj, delay);
     ObjShot_SetBombResist (obj, true);

     while(Obj_BeDeleted(obj)==false) {

            
		if(Obj_GetX(obj)<GetClipMinX) {
            CreateShot01(GetX,GetY,rand(2.1,7.9),GetAngleToPlayer,11,10);
	Obj_Delete(obj);
             }

             yield;
      }
}
        if (frame1 == 60)
        { 
	StartMapleConcentrate;
	PlaySE(charge);
        }
        if (frame2 == 120)
        { 
SetMovePosition03(GetCenterX + rand(-50,50), GetCenterY - rand(100,150), 10, 6);
	frame2 = 0;
        }
        if (frame1 == 120)
        { 
        loop(3)
        {
            CreateShotA(1,GetX+70*cos(acc11),GetY+70*sin(acc11),0);
	    SetShotDataA(1,0,5,a1+acc11,0,-0.2,0.1,11);
	    SetShotDataA(1,40,3,a1+acc11+a2+rand(-5,5),0,0,0,11);
	    FireShot(1);
            CreateShotA(1,GetX+90*cos(acc11),GetY+90*sin(acc11),0);
	    SetShotDataA(1,0,5,a1+acc11,0,-0.2,0.1,11);
	    SetShotDataA(1,40,3,a1+acc11+a2+rand(-5,5),0,0,0,11);
	    FireShot(1);
            a1 -= 360/3;
        }
	frame1 = 118;
	a1 += 22;
	a2 = 0;
	acc11 -= 14;
	PlaySE(sh2);
        }
        frame1++;
        frame2++;
        frame3++;
        frame4++;
    }

    @DrawLoop {
SetTexture(MC);
SetRenderState(ADD);
SetGraphicAngle(0,0,acc1);
SetGraphicScale(1+acc3,1+acc3);
SetGraphicRect(0, 0, 128, 128);
SetAlpha(255);
DrawGraphic(GetX, GetY);

if (GetSpeedX == 0){
SetTexture(SP);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1+acc10);
SetGraphicRect(0, 0, 52, 86);
SetAlpha(255);
DrawGraphic(GetX + 2, GetY);
}
if (GetSpeedX > 0){
SetTexture(SP);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1+acc10);
SetGraphicRect(52, 0, 103, 86);
SetAlpha(255);
DrawGraphic(GetX + 10, GetY);
}
if (GetSpeedX < 0){
SetTexture(SP);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,0);
SetGraphicScale(-1,1+acc10);
SetGraphicRect(52, 0, 103, 86);
SetAlpha(255);
DrawGraphic(GetX - 10, GetY);
}
acc1 += 8;
acc2++;
anim1++;
anim2++;
anim3++;
if (acc2 <= 40){acc3 += 0.01;}
if (acc2 >= 40){acc3 -= 0.01;}
if (acc2 == 80){acc2 = 0;}

if (acc9 <= 20){acc10 += 0.002;}
if (acc9 >= 20){acc10 -= 0.002;}
if (acc9 == 40){acc9 = 0;}
acc5 += 0.5;
acc6++;
acc7 += 0.2;
acc8 += 1.2;
acc9++;
 }
    @Finalize {
    }
}
