const int VAATI_FINAL = 229;//ID for larger than normal boss to accompany final form.
ffc script Vaati{
void run(int enemyID){
npc n= Ghost_InitAutoGhost(this, enemyID);
npc n2 = Screen->CreateNPC(VAATI_FINAL+1);
npc n3 = Screen->CreateNPC(VAATI_FINAL+1);
npc n4 = Screen->CreateNPC(VAATI_FINAL+1);
npc n5 = Screen->CreateNPC(VAATI_FINAL+1);
n->Extend = 3;
int combo = n->Attributes[10];
Ghost_TileWidth = 2;
Ghost_TileHeight = 2;
Ghost_X = 112;
Ghost_Y = 50;
float counter = -1;
int color;
int direction;
int timer = 240;
float angle;
int firing;
n2->X = n->X;
n2->Y = n->Y-16;
n3->X = n->X-16;
n3->Y = n->Y;
n4->X = n->X + 48;
n4->Y = n->Y + 16;
n5->X = n->X +32;
n5->Y = n->Y + 32;
Ghost_Transform(this,n,combo,-1,2,2);
int closed = combo+1;
int angle_offset;
bool shut = false;
while(n->HP>0){
counter = Ghost_HaltingWalk4(counter, n->Step, n->Rate, n->Homing, 2, n->Haltrate, 45);
if(timer <0){
direction = Choose(1,-1);
firing = 60;
angle_offset = Choose(0,90,180,270);
if(direction == 1)angle = 45;
else if(direction == -1)angle = 135;
while(firing>0){
color= (color +1)%60;
if(direction==1)angle = (angle+1)%360;
else angle = (angle-1)%360;
Laser(2, (n->X+16) + 1 * Cos(angle), (n->Y+16) + 1 * Sin(angle), 8, angle+angle_offset, n->WeaponDamage, color);
counter = Ghost_HaltingWalk4(counter, n->Step, n->Rate, n->Homing, 2, n->Haltrate, 45);
firing--;
Ghost_Waitframe(this,n,true,false);
}
timer = 240;
if(!shut){
shut = true;
Ghost_Transform(this,n,closed,-1,2,2);
Ghost_SetAllDefenses(n, NPCDT_IGNORE);
}
else if(shut){
shut = false;
Ghost_Transform(this,n,combo,-1,2,2);
Ghost_SetAllDefenses(n, NPCDT_NONE);
}
}
timer--;
Ghost_Waitframe(this,n,true,false);
}
n2->HP = 0;
n3->HP = 0;
n4->HP = 0;
n5->HP = 0;
this->Data = 0;
}
}
ffc script Vaati_Trans{
void run(int enemyID){
npc n= Ghost_InitAutoGhost(this, enemyID);
n->Extend = 3;
int combo = n->Attributes[10];
Ghost_TileWidth = 3;
Ghost_TileHeight = 3;
Ghost_X = 112;
Ghost_Y = 50;
float counter = -1;
int color;
int direction;
int timer = 180;
float angle;
int firing;
Ghost_Transform(this,n,combo,-1,3,4);
int closed = combo+1;
int angle_offset;
bool shut = false;
while(n->HP>0){
counter = Ghost_HaltingWalk4(counter, n->Step, n->Rate, n->Homing, 2, n->Haltrate, 45);
if(timer <0){
direction = Choose(1,-1);
firing = 120;
angle_offset = Choose(0,90,180,270);
if(direction == 1)angle = 45;
else if(direction == -1)angle = 135;
while(firing>0){
color= (color +1)%60;
if(direction==1)angle = (angle+1)%360;
else angle = (angle-1)%360;
Laser(2, (n->X+16) + 1 * Cos(angle), (n->Y+64) + 1 * Sin(angle), 8, angle+angle_offset, n->WeaponDamage, color);
Laser(2, (n->X+16) + 1 * Cos(angle), n->Y + 1 * Sin(angle), 8, angle+angle_offset+180, n->WeaponDamage, color);
counter = Ghost_HaltingWalk4(counter, n->Step, n->Rate, n->Homing, 2, n->Haltrate, 45);
firing--;
Ghost_Waitframe(this,n,true,true);
}
timer = 180;
if(!shut){
shut = true;
Ghost_Transform(this,n,closed,-1,3,4);
Ghost_SetAllDefenses(n, NPCDT_IGNORE);
}
else if(shut){
shut = false;
Ghost_Transform(this,n,combo,-1,3,4);
Ghost_SetAllDefenses(n, NPCDT_NONE);
}
}
timer--;
Ghost_Waitframe(this,n,true,true);
}
}
}
ffc script Vaati_Final{
void run(int enemyID){
npc n= Ghost_InitAutoGhost(this, enemyID);
npc n2 = Screen->CreateNPC(VAATI_FINAL);
n->Extend = 3;
int combo = n->Attributes[10];
Ghost_TileWidth = 4;
Ghost_TileHeight = 4;
Ghost_X = 112;
Ghost_Y = 50;
float counter = -1;
int color;
int direction;
int timer = 90;
float angle;
float angle2;
int firing;
Ghost_Transform(this,n,combo,-1,4,4);
int angle_offset;
n2->X= Ghost_X-47;
n2->Y= Ghost_Y-15;
n2->Extend = 3;
n2->TileWidth = 10;
n2->TileHeight = 8;
while(n->HP>0){
//This should be aligning the extra enemy to the main boss every frame.
//But it doesn't seem to be working.
n2->X= Ghost_X-47;
n2->Y= Ghost_Y-15;
counter = Ghost_HaltingWalk4(counter, n->Step, n->Rate, n->Homing, 2, n->Haltrate, 45);
if(timer <0){
direction = Choose(1,-1);
firing = 180;
angle_offset = Choose(0,90,180,270);
if(direction == 1){
angle = 45;
angle2 = 135;
}
else if(direction == -1){
angle = 135;
angle2 = 45;
}
while(firing>0){
color= (color +1)%60;
if(direction==1){
angle = (angle+1)%360;
angle2 = (angle2-1)%360;
}
else{
angle = (angle-1)%360;
angle2 = (angle2+1)%360;
}
Laser(2, n2->X + 1 * Cos(angle),(n2->Y+128) + 1 * Sin(angle), 8, angle+angle_offset, n->WeaponDamage, color);
Laser(2, (n2->X+160) + 1 * Cos(angle2),(n2->Y+128) + 1 * Sin(angle2), 8, angle2-angle_offset, n->WeaponDamage, color);
counter = Ghost_HaltingWalk4(counter, n->Step, n->Rate, n->Homing, 2, n->Haltrate, 45);
firing--;
Ghost_Waitframe(this,n,true,false);
}
timer = 90;
}
timer--;
Ghost_Waitframe(this,n,true,false);
}
n2->HP = 0;
}
}