#e
#Title[ԕuԂ̐w-Lunaticv]
#Text[]
#Image[.]
#BackGround[User]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
    let name    = "ԕuԂ̐w-Lunaticv";
let csd = GetCurrentScriptDirectory;
    let imgBoss =csd ~ "..\lib/dot_yuka.png"; 
    let imgFam  = csd ~ "img\familiar.png";
    let imgBG  = csd ~ "..\img\st4bg1.png";
    let imgBG2  = csd ~ "..\img\st4bg2.png";
SetRateScoreSystemEnable(false);
    // ʒu
    let xIni    = GetCenterX;
    let yIni    = GetClipMinY + 128;
	let wIni=60;
	let DrawY=330;
	let count=-wIni;

	#include_function ".\..\txt\SpellCardBonusDefine.txt"
	let SpellTimer=50;

	let bgy=0;
	let BGangle=0;
    @Initialize {

       LoadUserShotData(GetCurrentScriptDirectory~".\..\img\shot_All.txt");
	StartSpellHistory(50);

        SetLife(800);
        SetDamageRate(1, 1);
        LoadGraphic(imgBoss);
        LoadGraphic(imgBG);
        LoadGraphic(imgBG2);
	InitializeAction();
        TMain;
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
	Bonus=GetSpellCardBonusScore-(SpellBonus*3)/(SpellTimer*60);
        yield;
    }

    @DrawLoop {
	DrawBossShadow( imgBoss,150,0,255,255);
	SetGraphicAngle(0,0,0);
	DrawBoss( imgBoss );
	DrawSpellHistory;
    }

    @Finalize {
		DeleteGraphic(imgBoss);
		EndSpellHistory(50);
	loop(25)
	{
		ItemSet(GetX+rand(-40,40),GetY+rand(-40,40),1);
		ItemSet(GetX+rand(-40,40),GetY+rand(-40,40),2);
	}
    }
	@BackGround
	{
		SetTexture(imgBG);
		SetGraphicRect(0,0,1280,1920+bgy);
		SetGraphicAngle(0,0,0);
		SetColor(150,150,150);
		SetAlpha(100);
		DrawGraphic(224, 240);	
		SetTexture(imgBG2);
		SetGraphicRect(0,0,640,640);
		SetGraphicAngle(0,0,BGangle);
		SetColor(150,150,150);
		SetAlpha(50);
		DrawGraphic(224, 240);	
		bgy+=2;
		BGangle+=0.2;
	}
    // C^XN
task TMain 
{
	standBy;
	spell;
	Trate;
	Shot;
}

task Trate
{
	while(OnBomb==true){yield;}
	wait(180);
        SetDamageRate(25, 25);
}




sub standBy//ʒu
{
	SetAction(ACT_MOVE, wIni);
	SetMovePosition02(xIni, yIni, wIni);
	SetInvincibility(wIni);
	wait(wIni);
}

sub spell//[V
{
        CutIn(YOUMU, name, "", 0, 0, 0, 0);
        SetTimer(SpellTimer);
        SetScore(SpellBonus);
	SetAction(ACT_SPELL,90);
	wait(90);
}


task Shot
{
let dir=rand_int(0,1)*2-1;
let w=300;
	loop
	{
	let pangle=0;
		ascent(let i in 0..12)
		{
			flower(i*30+15,pangle,dir);
		}
		wait(w);
	dir=dir*-1;
	}
}



task flower(angle,pangle,sdir)
{
let dir=1;
	ascent(let i in 0..20)
	{
		ascent(let j in 0..5)
		{
			CreateShotA(0,GetX+i*20*cos(angle),GetY+i*20*sin(angle),10);
			//SetShotColor(200,200,200);
			SetShotDataA(0,0,1.6,angle+j*72+pangle,0,-0.2,0,191);
			SetShotColor(255,255,255);
			SetShotDataA(0,120,0,NULL,0,0.01,0.8+0.1*(i%5),47);
			FireShot(0);
		}
		wait(3);
		dir=dir*-1;
pangle+=10*sdir;
	}
}



#include_function ".\..\txt\data.txt"
#include_function ".\..\txt\Spelldata.txt"
#include_function ".\..\lib/lib_anime_Yuka.txt"
}
