// barrier.txt - A magic barrier, dispelled by the Dispel Barrier spell
// Cell 0 - The strength of the spell needed to dispel it
//  (note that the the minimum skill at which 
//   Dispel Barrier can be cast is 12, dispelling level 1-13. A 
//   piercing crystal casts at level 15, disarming 1-16)
// Call 1,2 - The stuff done flag to set to 1 when the barrier gone

beginobjectscript;

variables;

body;

beginstate INIT_STATE;
	if ((get_memory_cell(1) > 0) || (get_memory_cell(2) > 0)) {
		if (get_sdf(get_memory_cell(1),get_memory_cell(2)) > 0)
			kill_object(ME,1);
		}

	break;

beginstate DEAD_STATE;

break;

beginstate START_STATE; 
	if ((get_memory_cell(1) > 0) || (get_memory_cell(2) > 0)) {
		if (get_sdf(get_memory_cell(1),get_memory_cell(2)) > 0)
			kill_object(ME,0);
		}
break;

beginstate DISPEL_STATE;
	if (current_unlock_strength() >= get_memory_cell(0)) {
		if ((get_memory_cell(1) > 0) || (get_memory_cell(2) > 0))
			set_flag(get_memory_cell(1),get_memory_cell(2),1);
		print_str_color("Dispel Barrier: The barrier fades away.",2);
		kill_object(ME,0);
		}
		else if (get_memory_cell(0) >= 90)
			print_str_color("Dispel Barrier: This barrier is too powerful to ever be affected by this spell.",2);
			else print_str_color("Dispel Barrier: The spell is too weak to affect this barrier.",2);
break;

beginstate USE_STATE;
	print_str_color("Use: You can't use this object.",2);
break;