#include "hostAPI.txt"

#include "global.txt"

var count;

var i;

var bx;
var by;
var px;
var py;

var de;

var j;

func init() {
	i=0;
	count=0;
	de = 0;
	
	htMoveBossTo(400, 100, 60);
}

func update() {
	bx = htGetBossX();
	by = htGetBossY();
	px = htGetPlayerX();
	py = htGetPlayerY();
	
	if(count == 60) {
		htPlayBossEnergyAnim(60);
	}
	
	if(count == 90) {
		de = 0;
		var dgrbp;
		dgrbp = GetDegreeBetweenTwoPoints(bx, by, px, py);
		for(j=0; j<12; ++j) {
			for(i=0; i<10; ++i) {
				htInsertBulletVec(5, 1, bx, by, 3+i*0.4, dgrbp+30+de);
				htSetBulletReflectTime(1, false);
			}
			for(i=0; i<10; ++i) {
				htInsertBulletVec(5, 1, bx, by, 3+i*0.4, dgrbp-30-de);
				htSetBulletReflectTime(1, false);
			}
			
			de += 10;
		}
	}
	if(count >= 120 && (count <= 300)) {
		if(count % 30 == 0) {
			for(i=0; i<18; ++i) {
				htInsertBulletVec(3, 3, bx, by, 3, i*20);
				htSetBulletDeflectionEx(1, 0, 0, 120);
			}
			for(i=0; i<18; ++i) {
				htInsertBulletVec(3, 2, bx, by, 2.5, i*20);
				htSetBulletDeflectionEx(-1, 0, 0, 120);
			}
		}
	}
	
	if(count > 330)
		count = 59;
		
	++count;
}
		