#e
#Title[ᕄuXmEtH[-Easyv]
#Text[]
#Image[.]
#BackGround[User]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
    let name    = "ᕄuXmEtH[-Easyv";
let csd = GetCurrentScriptDirectory;
    let imgBoss =csd ~ "..\lib/dot_cirno.png"; 
    let imgFam  = csd ~ "img\familiar.png";
SetRateScoreSystemEnable(false);
    // ʒu
    let xIni    = GetCenterX;
    let yIni    = GetClipMinY + 128;
	let imgeffect = csd ~ "\img\shot_all.png";

	let wIni=60;
	let DrawY=330;
	let count=-wIni;
	let Bonus;
	let DBonusItem;
	alternative(GetCommonDataDefault("SELECTEDDIFFICULT","Normal"))
	case("Easy")
	{
		DBonusItem=1;
	}
	case("Normal")
	{
		DBonusItem=2;
	}
	case("Hard")
	{
		DBonusItem=3;
	}
	case("Lunatic")
	{
		DBonusItem=4;
	}
	let StandardSpellBonus=GetCommonDataDefault("BONUSPOINT",10000)*(20*DBonusItem+20*GetCommonDataDefault("STAGEPROGRESS",2));
	let SpellTimer=50;
	let SpellBonus=StandardSpellBonus/3;
    @Initialize {
	StartSpellHistory(7);
        SetLife(800);
        SetDamageRate(5, 5);
        LoadGraphic(imgBoss);
        LoadGraphic(imgFam);
	LoadGraphic(imgeffect);
        SetTexture(imgBoss);
	InitializeAction();
        TMain;
    }

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

    @DrawLoop {
        DrawGraphic(GetX, GetY);
	DrawBoss( imgBoss );
	DrawSpellHistory;
    }

    @Finalize {
        DeleteGraphic(imgBoss);
	EndSpellHistory(7);
	loop(10)
	{
		ItemSet(GetX+rand(-40,40),GetY+rand(-40,40),1);
		ItemSet(GetX+rand(-40,40),GetY+rand(-40,40),2);
	}
    }

    // C^XN
task TMain 
{
	yield;
	standBy;
	spell;
	Trate;
	Mainshot;
	SubShot;
}

task Trate
{
	wait(120);
        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 Mainshot
{
loop
{
let angle=0;
		loop(12)
		{
			CreateShotA(0,GetX,GetY,30);
			SetShotDataA(0,0,5,angle,0,0.0,0,BLUE12);
			SetShotDataA(0,10,0,angle,0,0.0,0,BLUE12);
			SetShotDirectionType(PLAYER);
			SetShotDataA(0,60,2,0,0,0.0,0,BLUE12);
			SetShotDirectionType(ABSOLUTE);
			FireShot(0);
		angle+=30;
		}

wait(120);
}

}


task SubShot
{
let angle=0;
	wait(30);
	loop
	{
		let dir=rand_int(0,1)*2-1;
		shot(rand(GetClipMinX-60,GetClipMaxX+60),GetClipMinY,rand(1.5,2.5),rand(60,120),BLUE05,30,dir);
		wait(8);

	}
}

task shot(let x, let y,let speed,let angle, let graphic,let delay,let dir)//oya
{
	let count=0;
	let count1=0;
	let r=4;
	let w=0;
	let obj = Obj_Create(OBJ_SHOT);
	Obj_SetPosition(obj, x, y,);
	Obj_SetSpeed(obj, speed);
	Obj_SetAngle(obj, angle);
	Obj_SetAlpha(obj, 0);
	Obj_SetCollisionToPlayer(obj,false);
	ObjShot_SetBombResist(obj,true);
	ObjShot_SetGraphic(obj, graphic);
	ObjShot_SetDelay(obj, delay);

		ascent(let i in 0..6)
		{
	shot2(obj,r,w+i*60,i*60,graphic,30,dir);
		}

}


task shot2(let parent,let r,let w,let angle,let graphic,let delay,let dir)//ko
{
	let count=0;
	let count1=0;
	let obj = Obj_Create(OBJ_SHOT);
	Obj_SetPosition(obj, Obj_GetX(parent)+r*cos(w), Obj_GetY(parent)+r*sin(w));
	Obj_SetSpeed(obj, 0);
	Obj_SetAngle(obj, angle);
	ObjShot_SetGraphic(obj, graphic);
	ObjShot_SetDelay(obj, delay);
	while(!Obj_BeDeleted(obj))
	{
	Obj_SetPosition(obj, Obj_GetX(parent)+r*cos(w), Obj_GetY(parent)+r*sin(w));
	r+=0.025;
	w+=1*dir;
	yield;
    	}

}


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