예제 #1
0
    @Override
    public void tick(int tick, J2hGame game, Ringo boss) {
      final Player player = game.getPlayer();

      if (tick == 100) {
        boss.playSpecial(true);

        BossUtil.chargeExplosion(boss, boss.getAuraColor());
      }

      if (tick < 130) {
        return;
      }

      final int COLOR_PERIOD = 400;

      tick -= 130;

      if (tick % 8 == 0) {
        TouhouSounds.Enemy.BULLET_1.play(0.3f);
      }

      if (tick % 6 == 0) {
        int amount = 30;

        for (int i = 0; i < amount; i++) {
          float angle = ((float) i / (float) amount) * 360;

          double mul = RNG.multiplierMirror(1000, tick);

          angle += (Math.sin(RNG.multiplier(200, tick) * Math.PI) * (50 + (200 * mul)));

          Bullet bullet =
              new Bullet(
                  new ThBullet(
                      ThBulletType.BALL_2,
                      RNG.booleanMultiplier(COLOR_PERIOD, tick)
                          ? ThBulletColor.BLUE
                          : ThBulletColor.PURPLE),
                  boss.getX(),
                  boss.getY());

          final float speed = 400f;

          bullet.setDirectionDeg(angle, speed * 2f);
          bullet.setZIndex(bullet.getZIndex() + i);

          bullet.addEffect(
              new Plugin<Bullet>() {
                @Override
                public void update(Bullet object, long tick) {
                  if (object.getTicksAlive() == 15) {
                    object.setDirectionDeg(object.getVelocityRotationDeg(), speed);
                  }

                  object.getCurrentSprite().rotate(2f);

                  float mul = 1f; // Math.min(1, object.getTicksAlive() / 10f);

                  object.setScale(mul);
                }
              });

          bullet.useSpawnAnimation(false);
          bullet.setGlowing();

          game.spawn(bullet);
        }
      }

      if (tick % 10 == 0) {
        int directions = 6;

        for (int i = 0; i < directions; i++) {
          float angle = ((float) i / (float) directions) * 360;

          ArrayList<Bullet> circle = circle(boss.getX(), boss.getY(), 2, 20);

          for (Bullet bullet : circle) {
            bullet.setDirectionDeg((float) (angle + (RNG.multiplier(600, tick)) * 360f), 300f);
            bullet.setBullet(
                ThBullet.make(
                    ThBulletType.DOT_SMALL_MOON,
                    RNG.booleanMultiplier(COLOR_PERIOD, tick)
                        ? ThBulletColor.BLUE
                        : ThBulletColor.PURPLE));
            bullet.setGlowing();
          }
        }
      }
    }