#東方弾幕風
#Title[雪星「リリィスタークリスマス-Lunatic-」]
#Text[敵機推奨キャラ「チルノ」]
#ScriptVersion[2]
#PlayLevel[Lunatic]
#Player[FREE]

script_enemy_main {
 let img = "script\img\ExRumia.png";
 let name = "雪星「リリィスタークリスマス」";

 @Initialize {
  CutIn(KOUMA, name, "", 0, 0, 0, 0);
  SetX(GetCenterX);
  SetY(GetCenterY - 120);
  SetLife(2500);
  SetScore(1000000);
  boss_magic_circle;
  LoadGraphic(img);
  SetTexture(img);
  SetGraphicRect(64, 0, 128, 64);
  PlaySE(spellSE);
  LoadUserShotData(GetCurrentScriptDirectory~"shot_All.txt");
  SetInvincibility(180);
  PlaySE(powerSE);
  Concentration01(180);
  TMain;
 }

 @MainLoop {
  SetCollisionA(GetX, GetY, 24);
  SetCollisionB(GetX, GetY, 24);

  yield;
 }

 @DrawLoop {
  DrawGraphic(GetX, GetY);
 }

 @Finalize {
  DeleteGraphic(img);
  loop(20) {
   CreateItem(ITEM_SCORE, rand(GetX - 50, GetX + 50), rand(GetY - 50, GetY + 50));
  }
 }

 task TMain {
  yield;
  wait(180);
  TStar;
  TMove;
  TSstar
 }

 task TStar {
  yield;

  loop {
   loop(3) { yield; }
   CreateShot01(rand(GetClipMinX, GetClipMaxX), GetClipMinY, 1, rand(45, 135), 123, 0);
  }
 }

 task TMove {
  yield;

  loop {
   loop(10) { yield; }
   moveX(rand(-100, 100), 120);
   loop(120) { yield; }
  }
 }

 task TSstar {
  let y = rand(GetClipMinY, GetCenterY);
  let y2 = rand(GetClipMinY, GetCenterY);
  let y3 = rand(GetClipMinY, GetCenterY);
  let angle = 45;
  let angle2 = 75;
  let angle3 = 105;
  let angle4 = rand(135, 160);
  let angle5 = rand(135, 160);
  let angle6 = rand(135, 160);
  yield;

  loop {
   loop(120) { yield; }
   CreateShot01(GetX, GetY, 1.5, angle, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle, BLUE03, 15);
   CreateShot01(GetX, GetY, 1.5, angle + 1.5, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle - 1.5, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle + 1.5, BLUE05, 15);
   CreateShot01(GetX, GetY, 1.5, angle - 1.5, BLUE05, 15);
   angle = rand(45, 70);
   CreateShot01(GetX, GetY, 1.5, angle2, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle2, BLUE03, 15);
   CreateShot01(GetX, GetY, 1.5, angle2 + 1.5, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle2 - 1.5, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle2 + 1.5, BLUE05, 15);
   CreateShot01(GetX, GetY, 1.5, angle2 - 1.5, BLUE05, 15);
   angle2 = rand(75, 100);
   CreateShot01(GetX, GetY, 1.5, angle3, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle3, BLUE03, 15);
   CreateShot01(GetX, GetY, 1.5, angle3 + 1.5, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle3 - 1.5, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle3 + 1.5, BLUE05, 15);
   CreateShot01(GetX, GetY, 1.5, angle3 - 1.5, BLUE05, 15);
   angle3 = rand(105, 135);
   loop(20) { yield; }
   PlaySE(laserSE);
   CreateLaser01(GetClipMaxX, y, 2.5, angle4, 200, 10, WHITE11, 0);
   CreateShot01(GetClipMaxX, y, 2.5, angle4, 131, 0);
   CreateLaser01(GetClipMaxX, y2, 3, angle5, 200, 10, WHITE11, 0);
   CreateShot01(GetClipMaxX, y2, 3, angle5, 131, 0);
   CreateLaser01(GetClipMaxX, y3, 3.5, angle6, 200, 10, WHITE11, 0);
   CreateShot01(GetClipMaxX, y3, 3.5, angle6, 131, 0);
   y = rand(GetClipMinY, GetCenterY);
   y2 = rand(GetClipMinY, GetCenterY);
   y3 = rand(GetClipMinY, GetCenterY);
   angle4 = rand(135, 160);
   angle5 = rand(135, 160);
   angle6 = rand(135, 160);
  }
 }

 function moveX(xMove, frame) {
  let x;

  x = GetX + xMove;
  if(x < GetClipMinX + 20) {
   x = GetClipMinX + 40;
  }
  else if(x > GetClipMaxX - 20) {
   x = GetClipMaxX - 40;
  }

  SetMovePosition02(x, GetY, frame);
 }
#include_function ".\変数集.txt"
#include_function ".\functions.txt"
}