#東方弾幕風
#Title[磔刑「主の受難」]
#Text[注意！激破時かなり重いです！「聖人は十字架に架けられました。」から妄想した結果がこれ・・・orz   これ旧劇場版エヴァのパクリみたいじゃん!?]

#BackGround[Default]
#BGM[.\BGM\thA07]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
	let count=-360;
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";	
        let eco00=GetCurrentScriptDirectory~"SE\eco00.wav";
	let imgLittle=GetCurrentScriptDirectory~"img\RumiaCutIn.png";
        let flame=0;
        let shot1=GetCurrentScriptDirectory~"SE\shot1.wav";
        let bom36=GetCurrentScriptDirectory~"SE\bom36.wav";
	let imgback04_06=GetCurrentScriptDirectory~"img\back04_06.png";
        SetShotAutoDeleteClip(64,64,64,200);
	let imgAngle=0;
	let imgeffect_magic=GetCurrentScriptDirectory~"img\effect_magic.png";

        @Initialize
	{
		SetScore(30000);//スペルカードボーナスを30000に設定
		SetLife(600);//ライフを500に設定
		SetDamageRate(10,5);//披ダメージを10%に設定
		SetTimer(60);//時間制限を60秒に設定
                SetDurableSpellCard();//耐久スペカにします
		SetGraphicRect(1,1,64,64);//描画元矩形を設定
		SetInvincibility(100);//敵を30フレーム無敵にする		
		LoadGraphic(imgExRumia);//画像「img\ExRumia.png」を読みこむ		
                LoadSE(eco00);
		LoadGraphic(imgback04_06);
		LoadGraphic(imgeffect_magic); 
		CutIn(YOUMU,"磔刑「主の受難」",imgLittle,1,1,350,525);//スペルカード名表示
                SetMovePosition03(GetCenterX,GetCenterY,30,5);
		SetPlayerInvincibility(300);

	}
	
	@MainLoop
	{       


                               
               if(flame==90){CreateEnemyFromScript("bunnsinn01",GetX,GetY(),0,0,0);}
               if(flame==180){CreateEnemyFromScript("bunnsinn01",GetX,GetY(),0,0,0);}
               if(flame==270){CreateEnemyFromScript("bunnsinn01",GetX,GetY(),0,0,0);}
               if(flame==360){CreateEnemyFromScript("bunnsinn01",GetX,GetY(),0,0,0);}
               if(flame==2400){PlaySE(shot1);}

                if(count==260){ 
                               PlaySE(eco00);
                               }

                
		if(count==360)
                          {
                           let RonginusA=atan2(GetPlayerY - GetClipMaxY(), GetPlayerX - GetClipMinX());
                           let RonginusB=atan2(GetPlayerY - GetClipMaxY(), GetPlayerX - GetClipMaxX());
                           CreateLaser01(GetClipMinX(),GetClipMaxY(),4,RonginusA,200,16,PURPLE32,10);
                           CreateLaser01(GetClipMinX(),GetClipMaxY(),4,RonginusA,400,8,PURPLE11,34);
                           CreateLaser01(GetClipMaxX(),GetClipMaxY(),4,RonginusB,200,16,PURPLE32,10);
                           CreateLaser01(GetClipMaxX(),GetClipMaxY(),4,RonginusB,400,8,PURPLE11,34);

                           count=0;
                          }

               if(flame>2400)
                          {
		           if(count==0)		
                                        {
                                          let j=5;
                                          while(j>1)
                                              {
                                               let radius = 100;
                                               let angle = 90;
                                               loop(90) {
                                                         let g = GetX + offsetX(radius, angle);
                                                         let t = GetY + offsetY(radius, angle);
                                                         CreateLaser01(g, t, j, angle, 100,4,YELLOW05, 30);
                                                         angle += 4;
                                                         }
                                               j-=1
                                               }
                                         }
                          }


                let Shita=0;
                let UE=0;
                let HIDARI=0;
                let MIGI=0;
                let BX=GetClipMinX();
                let RY=GetClipMaxY();
                let RX=GetClipMaxX();
                let BY=GetClipMinY();
                let Shibori=flame/16;

                CreateLaserA(Shita,BX-50,RY+30-Shibori/20*19,550,10,GREEN01,0);
                SetLaserDataA(Shita, 0, 0, 0, 0, 0, 0);
                SetLaserDataA(Shita, 10, NULL, 0, 0, 1, -90);
                SetLaserDataA(Shita, 40, NULL, 0, 0, 0, -90);
                SetShotKillTime(Shita,40);
                FireShot(Shita);

                CreateLaserA(UE,BX-50,BY-30+Shibori/20*19,550,10,GREEN01,0);
                SetLaserDataA(UE, 0, 0, 0, 0, 0, 0);
                SetLaserDataA(UE, 10, NULL, 0, 0, 1, 90);
                SetLaserDataA(UE, 40, NULL, 0, 0, 0, 90);
                SetShotKillTime(UE,40);
                FireShot(UE);

                CreateLaserA(HIDARI,BX-30+Shibori/5*4,BY-50,550,10,GREEN01,0);
                SetLaserDataA(HIDARI, 0, 90, 0, 0, 0, 0);
                SetLaserDataA(HIDARI, 010, NULL, 0, 0, 1, 0);
                SetLaserDataA(HIDARI, 040, NULL, 0, 0, 0, 0);
                SetShotKillTime(HIDARI,040);
                FireShot(HIDARI);

                CreateLaserA(MIGI,RX+30-Shibori/5*4,BY-50,550,10,GREEN01,0);
                SetLaserDataA(MIGI, 0, 90, 0, 0, 0, 180);
                SetLaserDataA(MIGI, 010, NULL, 0, 0, 1, 180);
                SetLaserDataA(MIGI, 040, NULL, 0, 0, 0, 180);
                SetShotKillTime(MIGI,040);
                FireShot(MIGI);


                function offsetX(radius, angle) {
                return radius * cos(angle);
                }

                function offsetY(radius, angle) {
                return radius * sin(angle);
                }

                if(flame==3480){Slow(2);}
                if(flame==3510){
                                PlaySE(bom36);
                                MotionBlurEx(ALL,320,100,ALPHA);
                                }
                if(flame==3510){PlaySE(bom36);}
                if(flame==3540){PlaySE(bom36);}
                if(flame==3570){PlaySE(bom36);}
                if(flame==3600){PlaySE(bom36);}


		count++;
                flame++;
	}
	
	@Finalize
	{//読みこんだファイルを削除
	  PlaySE(shot1);
	  PlaySE(bom36);
	  Explosion01(GetX,GetY,3,5,120);
          DeleteGraphic(imgExRumia);  
	  DeleteGraphic(imgback04_06); 
	  DeleteGraphic(imgeffect_magic);                  
          loop(10)
              {
	       CreateItem(ITEM_SCORE,GetX+rand(-100,100),GetY+rand(20,100));
               }
         CollectItems();
         
               
	}
	
	@DrawLoop
	{
		//Exルーミア描画
		
                SetGraphicRect(64,1,127,64);
	       
                              
                             
		SetAlpha(80);
		SetTexture(imgExRumia);
		DrawGraphic(GetX(),GetY());


			SetGraphicRect(0,80,150,230);
			SetAlpha(255);
			SetGraphicAngle(0,0,-imgAngle);
			SetTexture(imgeffect_magic);
			DrawGraphic(GetX(),GetY());
			imgAngle+=0.5;

			SetGraphicRect(300,230,450,380);
			SetAlpha(255);
			SetGraphicAngle(0,0,imgAngle);
			SetTexture(imgeffect_magic);
			DrawGraphic(GetX(),GetY());




	}

	@BackGround
	{
	//スペルカード時の背景部分
	//無くてもよい


		SetTexture(imgback04_06);
		SetGraphicRect(1,1,512,512);
		SetAlpha(100);
		SetGraphicAngle(0,0,0);
		DrawGraphic(GetCenterX,GetCenterY);
		
	}


    function offsetX(radius, angle) {
        return radius * cos(angle);
    }

    function offsetY(radius, angle) {
        return radius * sin(angle);
    }

}


script_enemy bunnsinn01
{//分身を定義
	let count=-360;
        let flame=0;
	let ExRumiabunnsinn01=GetCurrentScriptDirectory~"img\ExRumiabunnsinn01.png";	
	let imgLittle=GetCurrentScriptDirectory~"img\8082537_m.bmp";

        @Initialize
	{

		SetLife(1000);//ライフを300に設定
		SetDamageRate(10,5);//披ダメージを10%に設定
		SetGraphicRect(1,1,64,64);//描画元矩形を設定
		SetInvincibility(100);//敵を30フレーム無敵にする		
		LoadGraphic(ExRumiabunnsinn01);//画像「img\ExRumiabunnsinn01.png」を読みこむ		
		
	}
	
	@MainLoop
	{       
         
               let radius =150;
               let angle =count;
               let x = GetPlayerX() + offsetX(radius, angle);
               let y = GetPlayerY() + offsetY(radius, angle);
               SetMovePosition03(x,y,30,5);

            if(flame<2400)
                {                
                 if(count>0&&count%18==4)		
                         {
                         let ang=90;                     
                         loop(4) {
                                  CreateLaser01(GetX, GetY,3, ang,100, 10, BLUE01, 0);
                                  ang += 90;
                                  }
                         }

		 if(count==360){count=0;};
                }
            if(flame>=2400)
                {                
                 if(count>0&&count%9==4)		
                         {
                         let ang=90;                     
                         loop(4) {
                                  CreateLaser01(GetX, GetY,3, ang,100, 10, BLUE01, 0);
                                  ang += 90;
                                  }
                         }

		 if(count==360){count=0;};
                }
           
               

		SetCollisionA(GetX(),GetY(),32);//当たり判定(自弾)登録
		SetCollisionB(GetX(),GetY(),12);//当たり判定(体当たり)登録
		count++;
                flame++;
	}
	
	@Finalize
	{//読みこんだファイルを削除
		DeleteGraphic(ExRumiabunnsinn01);	

		loop(5)
		{
			CreateItem(ITEM_SCORE,GetX+rand(-100,100),GetY+rand(20,100));
		}
	}
	
	@DrawLoop
	{
		//Exルーミア描画
		
                SetGraphicRect(64,1,127,64);

		SetAlpha(255);
		SetTexture(ExRumiabunnsinn01);
		DrawGraphic(GetX(),GetY());
	}

    function offsetX(radius, angle) {
        return radius * cos(angle);
    }

    function offsetY(radius, angle) {
        return radius * sin(angle);
    }


}