#TouhouDanmakufu
#Title[Full_Korbe : "Brown and Red : Nose punch"]
#Text[Un deck pre-construit et jouable contenant 40 cartes. Batissez une defense solide et attaquez a distance avec ce deck base sur des cartes marron et rouges ! ...Mais c'est Kor qui a fait ce deck ! (Aussi, il y a plus que 40 cartes.)]
#Image[]
#BGM[script\DanMUku\Stage5\fully.mp3]
#Player[script\DanMUku\Joueur\KorA\KorHosik.txt, script\DanMUku\Joueur\KorB\KorB.txt, script\DanMUku\Joueur\KorC\KorC.txt]
#ScriptVersion[2]

script_enemy_main
{    
    let imgEnemy ="script\DanMUku\Stage5\Image\fully.png";
    let bg = "script\DanMUku\Stage5\Image\abstrait.png";
    let fg = "script\DanMUku\Stage5\Image\rond.png";
    let count=-60;
    let munch ="script\DanMUku\Stage1\Son\muncher.wav";
    let z = 0;
    let w = 0.5;
    let q=0;
    let spin =0;
	let vitesse = 5;
	let rythme = 100;
	let type = 1;

   @Initialize
   {
            LoadUserShotData("script\DanMUku\MUtir\MUtir.txt");
            LoadGraphic(imgEnemy);
	    LoadGraphic(bg);
	    LoadGraphic(fg);
            SetLife(6000);
            SetTimer(40);
	    SetScore(1300000);
            SetInvincibility(160);
            SetEnemyMarker(true);
            SetMovePosition02(GetCenterX, GetCenterY-100, 120);  
	    CutIn(YOUMU, "Brown and Red"\""Nose punch"\", "script\DanMUku\Stage5\Image\fullycutin.png" , 0,0,99,200);      
   }
   
   @MainLoop
   {
          SetCollisionA(GetX, GetY, 16);
        SetCollisionB(GetX, GetY, 16);

	if (count%240==0){
		SetMovePositionRandom01(rand(50,100), rand(50,100), 2, GetClipMinX+10, GetClipMinY+10, GetClipMaxX-10, GetCenterY);
	}

	if (count%rythme==0 && count>0) {
		Explosion(rand(GetClipMinX, GetClipMaxX), rand(GetClipMinY, GetCenterY), vitesse+2*type, type);
		type = 1-type;
	}
	if (count>=720) {
		count-=720;
		rythme-=20;
	}

	count++;
   }
   @Finalize
   {
      DeleteGraphic(imgEnemy);
   }
   
   @DrawLoop
   {
	SetColor(200,100,0);
	SetRenderState(ALPHA);
            SetAlpha(255);
            SetTexture(bg);
	    SetGraphicAngle(0, 0, 0);
            SetGraphicRect(q, q, 640+q, 480+q);
            DrawGraphic(GetCenterX,GetCenterY);

	SetColor(255,0,0);
	SetRenderState(ALPHA);
            SetAlpha(100);
            SetTexture(fg);
	    SetGraphicAngle(0, 0, spin);
            SetGraphicRect(0, 0, 544, 416);
	    SetGraphicScale(2,2);
            DrawGraphic(GetCenterX,GetCenterY);


            SetColor(255,255,255);
            SetRenderState(ALPHA);
            SetAlpha(255);
            SetTexture(imgEnemy);
	    SetGraphicAngle(0, 0, 0);
	    SetGraphicScale(1,1);
            SetGraphicRect(0, 0, 35, 46);
            DrawGraphic(GetX,GetY+z);
     if(z==10){w=-0.5;}
     if(z==-10){w=0.5;}
z+=w;
spin+=0.5;
q+=1;
	DrawText("Full_Korbe", GetClipMinX+10, GetClipMinY+15, 12, 255);
   }

	task Ligne(x, y, angle, v, type) {
		let d=0;
		loop(11) {
			if (type==1) {
				Carte_Rouge(x, y, v, angle, d);
			}
			else {
				Carte_Marron(x, y, v, angle, d);
			}
			d+=5;
		}
		PlaySE(munch);
	}

	task Explosion(x, y, v, type) {
		let angle = atan2(GetPlayerY-y, GetPlayerX-x);
		loop(48) {
			Ligne(x, y, angle, v, type);
			angle+=7.5;
		}

	}

   task Carte_Rouge(x, y, v, angle, delay)
   {
	CreateShot02(x, y, 0, angle, 0.05, v, 140, delay);
   }

   task Carte_Marron(x, y, v, angle, delay)
   {
	CreateShot02(x, y, v, angle, -0.05, v/10, 145, delay);
   }

}
