// Beam Shooter
// beamshooter.txt
// by Terror's Martyr (terrorsmartyr@wi.rr.com)
//
// This script causes the monster to be inert- it won't, for example,
// attack, nor will it cast spells.  If you give a monster this script,
// don't expect it to do much of anything that its stats tell you.
// Instead, the boss will shoot out two "beams" at all visible enemies
// each turn.  Dangerous.  The beams are described below:
//
// 1 - Gravity (-100 HP, Slow)
// 2 - Fire (-100 HP, 100 Curse)
// 3 - Lightning (-100 HP, -Prot)
// 4 - Darkness (-200 HP, Negation)
// 5 - Arcane (-100 HP, -50 SP)
// 6 - Cocoon (Poison, Web)


begincreaturescript;

variables;

short attack1,i,any;

body;

beginstate INIT_STATE;
	break;

beginstate DEAD_STATE;
	break;

beginstate START_STATE; 

i = 0;
any = 0;
attack1 = get_ran(1,1,6);

if(enemies_nearby(10) == 0)
	end();

while(i <= 120){
	if(char_ok(i) == TRUE){
	if(can_see_loc(char_loc_x(i),char_loc_y(i)) == TRUE && get_attitude(i) != get_attitude(ME)){

	if(attack1 == 1){
put_jagged_zap(my_loc_x(),my_loc_y(),char_loc_x(i),char_loc_y(i),2);
set_character_pose(ME,1);
	run_animation();
	force_instant_terrain_redraw();
	pause(3);
	set_character_pose(ME,2);
	force_instant_terrain_redraw();
damage_char(i,100,4);
set_char_status(i,3,-100,1,0);
	}

	if(attack1 == 2){
put_jagged_zap(my_loc_x(),my_loc_y(),char_loc_x(i),char_loc_y(i),0);
set_character_pose(ME,1);
	run_animation();
	force_instant_terrain_redraw();
	pause(3);
	set_character_pose(ME,2);
	force_instant_terrain_redraw();
damage_char(i,100,1);
set_char_status(i,1,-100,1,0);
	}

	if(attack1 == 3){
put_jagged_zap(my_loc_x(),my_loc_y(),char_loc_x(i),char_loc_y(i),6);
set_character_pose(ME,1);
	run_animation();
	force_instant_terrain_redraw();
	pause(3);
	set_character_pose(ME,2);
	force_instant_terrain_redraw();
set_char_status(i,5,-250,1,0);
set_char_status(i,2,-250,1,0);
set_char_status(i,4,-250,1,0);
set_char_status(i,17,-250,1,0);
damage_char(i,100,3);
	}

	if(attack1 == 4){
put_jagged_zap(my_loc_x(),my_loc_y(),char_loc_x(i),char_loc_y(i),5);
set_character_pose(ME,1);
	run_animation();
	force_instant_terrain_redraw();
	pause(3);
	set_character_pose(ME,2);
	force_instant_terrain_redraw();
set_char_status(i,30,10,0,0);
set_char_status(i,9,10,0,0);
set_char_status(i,10,5,0,0);
damage_char(i,200,4);
	}

	if(attack1 == 5){
put_jagged_zap(my_loc_x(),my_loc_y(),char_loc_x(i),char_loc_y(i),3);
set_character_pose(ME,1);
	run_animation();
	force_instant_terrain_redraw();
	pause(3);
	set_character_pose(ME,2);
	force_instant_terrain_redraw();
change_char_energy(i,-50);
damage_char(i,100,3);
	}

	if(attack1 == 6){
put_jagged_zap(my_loc_x(),my_loc_y(),char_loc_x(i),char_loc_y(i),4);
set_character_pose(ME,1);
	run_animation();
	force_instant_terrain_redraw();
	pause(3);
	set_character_pose(ME,2);
	force_instant_terrain_redraw();
set_char_status(i,0,100,0,0);
set_char_status(i,6,4,0,0);
	}

		any = 1;
	}
	}
	i = i + 1;
}

if(any >= 1){
	if(attack1 == 1){
		print_str_color("A Gravity Wave strikes the party!",1);
	}
	if(attack1 == 2){
		print_str_color("A Fireblast strikes the party!",1);
	}
	if(attack1 == 3){
		print_str_color("A Lightning Bolt strikes the party!",1);
	}
	if(attack1 == 4){
		print_str_color("A Dark Lance strikes the party!",1);
	}
	if(attack1 == 5){
		print_str_color("An Arcane Blast strikes the party!",1);
	}
	if(attack1 == 6){
		print_str_color("Liquid Poison strikes the party!",1);
	}
}
break;
