
#Title[フローリア　通常2]
#Text[]
#Player[script\script_Player\PlayerScript.txt]
#ScriptVersion[2]
script_enemy_main{
let BossImage="script\Script-1Boss\Frolir-Dot.png";
let Anime1=0;let Anime2=0;let Anime3=0;let Anime4=0;let Height=0;
let MoveMord1=true; let BossShot=false;let MoveMord2=false;
let Frame1=0;let Frame2=0;let Frame3=0;let Frame4=0;let Frame5=0;
let Cx=GetCenterX; let Cy=GetCenterY; let Htime=0; let Move=true;
let Set1=0; let Set2=0; let Set3=0; let Set4=0;
let Angle1=0; let Angle2=0;	
SetCommonData("OKShot",true);
#include_function "script\Script-System\ThymeGauge2.txt"
#include_function "script\Script-System\Timer.txt"
#include_function "script\Script-System\LifeStar.txt"
#include_function "script\Script-System\LifeCircle.dms"
#include_function "script\Script-System\MagicCircle.txt"
#include_function "script\Script-System\ChargeEffect.txt"
@Initialize{
SetLife(90000);
SetTimer(50);
MoveMord1=true;
SetMovePosition03(GetCenterX,150,10,4);
SetDamageRate(100,100);
ThymeGauge1;
TimerBack;
SetEnemyMarker(true);
SetCommonData("SetStar",0);
SetCommonData("SetStarX",GetCenterX-185);
LifeStar1;
SetCommonData("BossNumber",1);
BossName;
LoadUserShotData("script\Script-System\AllShotData.txt");
SetGraphicRect(0,96,63,191);
LoadGraphic(BossImage);
SetBossLifeCircle(2600,true,20,true);
BossMagicCircle;
}
			
@MainLoop{
yield;
SetCollisionA(GetX,GetY,25);SetCollisionB(GetX,GetY+Height,20);
if(Frame3==1){
Set1=1;
}
if(Frame3==25){
Anime4=1;
Set1=2;
}
if(Frame3==39){
Set1=0;
}
if(Frame3==200){
Set1=1;
}
if(Frame3==215){
if(Cx>GetX){
MoveMord1=true;
SetMovePosition03(rand(Cx,Cx+50),rand(100,200),10,3);
}
if(Cx<GetX){
MoveMord2=true;
SetMovePosition03(rand(Cx,Cx-50),rand(100,200),10,3);
}
}
if(Frame3==225){
Anime4=1;
Set1=2;
}
if(Frame3==239){
Set1=0;
Frame3=40;
}


Frame1++;Frame2++;Frame3++;Frame4++;Frame5++;
if(Frame1==120){
Move=false;
Charge;
}
if(Frame1==160){
PlaySE("script\SE\Kira1.wav");
Set1=GetX-50;
Shot1;
loop(5){
Shot3;
}
}
if(Frame1==170){
PlaySE("script\SE\Kira1.wav");
Set1=GetX+50;
Shot1;
loop(5){
Shot3;
}
}
if(Frame1==179){
Frame1=159;
}
DeleteEnemyShotImmediatelyInCircle(ALL,0,0,1);
}
task Shot3{
let shot1=Obj_Create(OBJ_SHOT);
let count=0;
let frame1=0;
let X1=0;
let X2=0;
let Y1=0;
let Y2=0;
Obj_SetX(shot1,Set1);//x座標設定
Obj_SetY(shot1,GetY-80);//y座標設定;
ObjShot_SetDelay(shot1,10);
Obj_SetSpeed(shot1,3);//速度設定
ObjShot_SetGraphic(shot1,23);//画像設定
Angle2=rand(0,360);
Angle1=Angle2;
Obj_SetAngle(shot1,Angle1);
loop{
frame1++;
SetCommonData("ShotX",Obj_GetX(shot1));
SetCommonData("ShotY",Obj_GetY(shot1));
if(frame1==40){
Obj_SetSpeed(shot1,0);
}
if(frame1==80){
Cold;
Angle1-=10;
Shot4;
Angle1-=5;
Shot4;
Angle1=Angle2;
Shot4;
Angle1+=5;
Shot4;
Angle1+=10;
Shot4;
Obj_Delete(shot1);
}
yield;
}
task Shot4{
let shot1=Obj_Create(OBJ_SHOT);
let count=0;
let frame1=0;
let X1=0;
let X2=0;
let Y1=0;
let Y2=0;
Obj_SetX(shot1,GetCommonData("ShotX"));//x座標設定
Obj_SetY(shot1,GetCommonData("ShotY"));//y座標設定;
ObjShot_SetDelay(shot1,10);
Obj_SetSpeed(shot1,2.5);//速度設定
ObjShot_SetGraphic(shot1,37);//画像設定
Obj_SetAngle(shot1,Angle1);
count=Angle1;
loop{
yield;
}
}

task Cold{
let X=GetCommonData("ShotX");
let Y=GetCommonData("ShotY");
let Img1="script\img-System\EffectSet-1.png";
let rect01=128;
let rect02=0;
let rect03=191;
let rect04=63;
let Layer=5;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let Angle1=0;
let Angle2=40;
let Angle3=40;
let Scale=1;
let Frame1=0;
let Set1=0;
let Set2=0;
let Set3=0;
let Set4=0;
let Set5=0;
let Angle2=rand(0,180)+40;
let Angle3=rand(0,180)+40;
let Alpha=255;
let Obj=Obj_Create(OBJ_EFFECT);
LoadGraphic(Img1);
ObjEffect_SetTexture(Obj,Img1);
ObjEffect_SetRenderState(Obj,ADD);
ObjEffect_SetPrimitiveType(Obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(Obj,4);
ObjEffect_SetLayer(Obj,Layer);
Obj_SetPosition(Obj,X,Y);
ObjEffect_SetAngle(Obj,0,0,0);
ObjEffect_SetScale(Obj,1.0,1.0);
ObjEffect_SetVertexXY(Obj,0,-W,-H);
ObjEffect_SetVertexXY(Obj,1,W,-H);
ObjEffect_SetVertexXY(Obj,2,W,H);
ObjEffect_SetVertexXY(Obj,3,-W,H);
ObjEffect_SetVertexUV(Obj,0,rect01,rect02);
ObjEffect_SetVertexUV(Obj,1,rect03,rect02);
ObjEffect_SetVertexUV(Obj,2,rect03,rect04);
ObjEffect_SetVertexUV(Obj,3,rect01,rect04);
ObjEffect_SetVertexColor(Obj,0,255,255,255,255);
ObjEffect_SetVertexColor(Obj,1,255,255,255,255);
ObjEffect_SetVertexColor(Obj,2,255,255,255,255);
ObjEffect_SetVertexColor(Obj,3,255,255,255,255);
loop{
Frame1++;
Angle1++;
Angle2++;
Angle3++;
ObjEffect_SetScale(Obj,Scale,Scale);
ObjEffect_SetVertexColor(Obj,0,Alpha,255,255,255);
ObjEffect_SetVertexColor(Obj,1,Alpha,255,255,255);
ObjEffect_SetVertexColor(Obj,2,Alpha,255,255,255);
ObjEffect_SetVertexColor(Obj,3,Alpha,255,255,255);
if(Scale>5){	
}else{
Scale+=0.1;
}
if(Alpha<0){
Obj_Delete(Obj);
break;
}else{
Alpha-=8;
}
if(Obj_GetX(Obj)==0){
Obj_Delete(Obj);
break;
}
if(Frame1==60){
Obj_Delete(Obj);
break;	
}
yield;	
}
}
}

task Shot1{
let shot1=Obj_Create(OBJ_SHOT);
let count=0;
let frame1=0;
let X1=0;
let X2=0;
let Y1=0;
let Y2=0;
Obj_SetX(shot1,Set1);//x座標設定
Obj_SetY(shot1,GetY-80);//y座標設定;
ObjShot_SetDelay(shot1,10);
Obj_SetSpeed(shot1,3);//速度設定
ObjShot_SetGraphic(shot1,23);//画像設定
Angle1=atan2(GetPlayerY-5-Obj_GetY(shot1),GetPlayerX-Obj_GetX(shot1));
Obj_SetAngle(shot1,Angle1);
loop{
frame1++;
SetCommonData("ShotX",Obj_GetX(shot1));
SetCommonData("ShotY",Obj_GetY(shot1));
if(frame1==40){
Obj_SetSpeed(shot1,0);
}
if(frame1==80){
Cold;
Angle1=atan2(GetPlayerX-5-Obj_GetY(shot1),GetPlayerX-Obj_GetX(shot1))-10;
Shot2;
Angle1=atan2(GetPlayerX-5-Obj_GetY(shot1),GetPlayerX-Obj_GetX(shot1))-5;
Shot2;
Angle1=atan2(GetPlayerX-5-Obj_GetY(shot1),GetPlayerX-Obj_GetX(shot1));
Shot2;
Angle1=atan2(GetPlayerX-5-Obj_GetY(shot1),GetPlayerX-Obj_GetX(shot1))+10;
Shot2;
Angle1=atan2(GetPlayerX-5-Obj_GetY(shot1),GetPlayerX-Obj_GetX(shot1))+5;
Shot2;
Obj_Delete(shot1);
}
yield;
}
task Shot2{
let shot1=Obj_Create(OBJ_SHOT);
let count=0;
let frame1=0;
let X1=0;
let X2=0;
let Y1=0;
let Y2=0;
Obj_SetX(shot1,GetCommonData("ShotX"));//x座標設定
Obj_SetY(shot1,GetCommonData("ShotY"));//y座標設定;
ObjShot_SetDelay(shot1,10);
Obj_SetSpeed(shot1,2.5);//速度設定
ObjShot_SetGraphic(shot1,37);//画像設定
Obj_SetAngle(shot1,Angle1);
count=Angle1;
loop{
yield;
}
}

task Cold{
let X=GetCommonData("ShotX");
let Y=GetCommonData("ShotY");
let Img1="script\img-System\EffectSet-1.png";
let rect01=128;
let rect02=0;
let rect03=191;
let rect04=63;
let Layer=5;
let W=(rect03-rect01)/2;
let H=(rect04-rect02)/2;
let Angle1=0;
let Angle2=40;
let Angle3=40;
let Scale=1;
let Frame1=0;
let Set1=0;
let Set2=0;
let Set3=0;
let Set4=0;
let Set5=0;
let Angle2=rand(0,180)+40;
let Angle3=rand(0,180)+40;
let Alpha=255;
let Obj=Obj_Create(OBJ_EFFECT);
LoadGraphic(Img1);
ObjEffect_SetTexture(Obj,Img1);
ObjEffect_SetRenderState(Obj,ADD);
ObjEffect_SetPrimitiveType(Obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(Obj,4);
ObjEffect_SetLayer(Obj,Layer);
Obj_SetPosition(Obj,X,Y);
ObjEffect_SetAngle(Obj,0,0,0);
ObjEffect_SetScale(Obj,1.0,1.0);
ObjEffect_SetVertexXY(Obj,0,-W,-H);
ObjEffect_SetVertexXY(Obj,1,W,-H);
ObjEffect_SetVertexXY(Obj,2,W,H);
ObjEffect_SetVertexXY(Obj,3,-W,H);
ObjEffect_SetVertexUV(Obj,0,rect01,rect02);
ObjEffect_SetVertexUV(Obj,1,rect03,rect02);
ObjEffect_SetVertexUV(Obj,2,rect03,rect04);
ObjEffect_SetVertexUV(Obj,3,rect01,rect04);
ObjEffect_SetVertexColor(Obj,0,255,255,255,255);
ObjEffect_SetVertexColor(Obj,1,255,255,255,255);
ObjEffect_SetVertexColor(Obj,2,255,255,255,255);
ObjEffect_SetVertexColor(Obj,3,255,255,255,255);
loop{
Frame1++;
Angle1++;
Angle2++;
Angle3++;
ObjEffect_SetScale(Obj,Scale,Scale);
ObjEffect_SetVertexColor(Obj,0,Alpha,255,255,255);
ObjEffect_SetVertexColor(Obj,1,Alpha,255,255,255);
ObjEffect_SetVertexColor(Obj,2,Alpha,255,255,255);
ObjEffect_SetVertexColor(Obj,3,Alpha,255,255,255);
if(Scale>5){	
}else{
Scale+=0.1;
}
if(Alpha<0){
Obj_Delete(Obj);
break;
}else{
Alpha-=8;
}
if(Obj_GetX(Obj)==0){
Obj_Delete(Obj);
break;
}
if(Frame1==60){
Obj_Delete(Obj);
break;	
}
yield;	
}
}
}
		
@DrawLoop{
SetTexture(BossImage);
DrawGraphic(GetX,GetY+Height);
Anime1++;
Anime2++;
Anime3++;
Anime4++;
if(GetSpeed<0.1){
if(MoveMord2==true){
if(Anime1==1){
SetGraphicRect(192,96,255,191);
} 
if(Anime1==5){
SetGraphicRect(128,96,191,191);
}
if(Anime1==10){
SetGraphicRect(64,96,127,191);
}
if(Anime1==15){
SetGraphicRect(0,96,63,191);
}
if(Anime1==20){
MoveMord2=false;
Anime1=0;
Anime2=0;
Anime4=0;
}
}else if(MoveMord1==true){
if(Anime1==1){
SetGraphicRect(192,192,255,287);
} 
if(Anime1==5){
SetGraphicRect(128,192,191,287);
}
if(Anime1==10){
SetGraphicRect(64,192,127,287);
}
if(Anime1==15){
SetGraphicRect(0,192,63,287);
}
if(Anime1==20){
MoveMord1=false;
Anime1=0;
Anime2=0;
}
}else{
 
if(BossShot==true){
if(Anime4==1){
SetGraphicRect(0,288,63,383);
}
if(Anime4==5){
SetGraphicRect(64,288,127,383);
} 
if(Anime4==10){
SetGraphicRect(128,288,191,383);
}
if(Anime4==15){
SetGraphicRect(192,288,255,383);
}
}else{
Anime2=0;
Anime3=0;
Anime4=0;
if(Anime1==1){
SetGraphicRect(0,0,63,95);
}
if(Anime1==10){
SetGraphicRect(64,0,127,95);
}
if(Anime1==20){
SetGraphicRect(128,0,191,95);
}
if(Anime1==30){
SetGraphicRect(192,0,255,95);
}
if(Anime1==40){
SetGraphicRect(128,0,191,95);
}
if(Anime1==50){
SetGraphicRect(64,0,127,95);
Anime1=0;
}
}
}
}else if(GetSpeedX<0){
Anime1=0;
Anime3=0;
Anime4=0;
if(Anime2==1){
SetGraphicRect(0,96,63,191);
}
if(Anime2==5){
SetGraphicRect(64,96,127,191);
}
if(Anime2==10){
SetGraphicRect(128,96,191,191);
}
if(Anime2==15){
SetGraphicRect(192,96,255,191);
}
}else{
Anime1=0;
Anime2=0;
Anime4=0;
if(Anime3==1){
SetGraphicRect(0,192,63,287);
} 
if(Anime3==5){
SetGraphicRect(64,192,127,287);
}
if(Anime3==10){
SetGraphicRect(128,192,191,287);
}
if(Anime3==15){
SetGraphicRect(192,192,255,287);
}

}
if(Move==false){
Htime++;
}
if(Htime==1){
Height+=1;
}
if(Htime==10){
Height+=1;
}
if(Htime==20){
Height+=1;
}
if(Htime==30){
Height-=1;
}
if(Htime==40){
Height-=1;
}
if(Htime==50){
Height-=1;
Htime=0;
}
}
			
@Finalize{
SetCommonData("EnemyX",GetX);
SetCommonData("EnemyY",GetY);
SetCommonData("SamonPoint",true);
SetCommonData("SamonPower",true);
SetCommonData("SamonBigPower",true);
}
}

