/*-----重力設定--------------------------*/
GSet(global.G,global.Gdir,0.95,1,0,0.95,1,1);

with(objEnemyEdit){ if(Edit_Play) exit; }
/*-----キャラクタとの情報の取得---------------*/
playerDistanceX = abs(x - objPlayerDoll.x);
playerDistance = point_distance(x,y,objPlayerDoll.x,objPlayerDoll.y);
playerDirection = point_direction(x,y,objPlayerDoll.x,objPlayerDoll.y);

/*-----モーション毎の処理--------------------*/
DAMAGE_ACTIVE = 0;

HeadPosX = Process[ProcessNum[PARTS_EYE]].x;
HeadPosY = Process[ProcessNum[PARTS_EYE]].y;
with(HeadCollision){
	if(RECV_DAMAGE){
		if(!INV){
			with(other){ playEnemySound(SOUND_DAMAGE); }
			Fluid(x,y,make_color_rgb(263,73,164),15,5,20,0,360,0.7);
		}
	}
	depth = -100000;
	x = other.HeadPosX;
	y = other.HeadPosY;
	if(place_meeting(other.HeadPosX,other.HeadPosY,objBlock)){
		x = xprevious;
		y = yprevious;
	}

	other.HP = HP + global.BOSSHPMAX;
}

if(HP<0){
	if(!ChangeMotion){
		if(MotionNum!=DEAD_MOTION){
			Quake(35,35);
			MotionChange(DEAD_MOTION,0,1);
		}
	}
}

if(random(100)<3){
	var tmp_parts;
	tmp_parts = Process[ProcessNum[PARTS_BODY]];
	new = instance_create(tmp_parts.x,tmp_parts.y,objSpring);
	new.Points[0,new.ATTACH]    = tmp_parts;
	new.Points[0,new.ATTACHDIS] = 96;
	new.Points[0,new.ATTACHDIR] = 240+random(60);
}

INV = 1;
switch(MotionNum){
	case STAND :
		break;
}

DepthSet(objPlayerDoll.depth + 1000);
if(!ChangeMotion){
	switch(MotionNum){
		/*-----------------------------------------------*/
		case STAND :
			/*MotionChange( FINGERPRESS,0,1);*/
			/* 相手の方を向く */
			if(objPlayerDoll.x > x) Direction = Right;
			else Direction = Left;

			switch(irandom(6)){
				case 0: if( searchPlayer(300,200,50, 10) ) MotionChange(SPEAR,0,2);       break;
				case 1: if( searchPlayer(400,220,50,  5) ) MotionChange(MULTSPEAR,0,2);   break;
				case 2: if( searchPlayer(360,235,50,  5) ) MotionChange(MULTSPEAR,0,2);   break;
				case 3: if( searchPlayer(450,210,50, 10) ) MotionChange(HATCHETS,0,2);    break;
				case 4: if( searchPlayer(400,225,150, 5) ) MotionChange(DOUBLESLICE,0,2); break;
				case 5: if( searchPlayer(400,230,150, 5) ) MotionChange(STAMP,0,2);       break;
				case 6: if( searchPlayer(330,245,50, 10) ) MotionChange(WALKSPEAR,0,2);   break;
			}
			if( searchPlayer(150, 90,150, 2) ){ MotionChange(FINGERPRESS,0,2); break; }
			if( searchPlayer(300,270, 50, 0) ){ MotionChange(NECKCUT,0,2); break; }

			/* 近づいたら歩く */
			if( random(100)<15 && !air && 10<playerDistanceX){ MotionChange(WALK,0,2); break; }

			break;
		/*-----------------------------------------------*/
		case WALK :
			/* 相手の方を向く */
			if(objPlayerDoll.x > x) Direction = Right;
			else Direction = Left;

			switch(irandom(6)){
				case 0: if( searchPlayer(300,200,50, 10) ) MotionChange(SPEAR,0,2);       break;
				case 1: if( searchPlayer(400,220,50,  5) ) MotionChange(MULTSPEAR,0,2);   break;
				case 2: if( searchPlayer(360,235,50,  5) ) MotionChange(MULTSPEAR,0,2);   break;
				case 3: if( searchPlayer(450,210,50, 10) ) MotionChange(HATCHETS,0,2);    break;
				case 4: if( searchPlayer(400,225,150, 5) ) MotionChange(DOUBLESLICE,0,2); break;
				case 5: if( searchPlayer(400,230,150, 5) ) MotionChange(STAMP,0,2);       break;
				case 6: if( searchPlayer(330,245,50, 10) ) MotionChange(WALKSPEAR,0,2);   break;
			}
			if( searchPlayer(150, 90,150, 2) ){ MotionChange(FINGERPRESS,0,2); break; }
			if( searchPlayer(300,270, 50, 0) ){ MotionChange(NECKCUT,0,2); break; }

			switch(KeyFrmNum){
				case 2 : 
				case 6 : Move(-5*Direction,0); if(KEYFRAME){ Quake(2,2); playEnemySound(SOUND_TAKEON); } break;
				default: Move(-12*Direction,0); break;
			}
			/* 近づきすぎたり離れたりしたら止まる */
			if( 10>playerDistanceX ) MotionChange(STAND,0,3);
			break;
		/*-----------------------------------------------*/
		case NECKCUT :
			DepthSet(objPlayerDoll.depth + 1000);
			with(PartsParam(PARTS_BODY)){ depth = objPlayerDoll.depth - 2000; }
			with(PartsParam(PARTS_EYE)){  depth = objPlayerDoll.depth - 1000; }
			/* 相手の方を向く */
			switch(KeyFrmNum){
				case 5 : 
					if(KEYFRAME){
						col = collision_circle( x,y+300, 64,objPlayerDoll,0,1);
						with(col){
							if(HEAD.image_alpha){
								with(other){playEnemySound(SOUND_NIKU);}
								Fluid(x,y,COLOR_BLOOD,30,2,10,180,0,0.5);
								Fluid(x,y-32,COLOR_BLOOD,30,5,20,  0, 10,0.5);
								Fluid(x,y-32,COLOR_BLOOD,30,5,20,180,-10,0.5);
								Flash(c_red,1,0.05);
								Quake(30,30);
								HEAD.image_alpha = 0;
								with(objCommon_Head){ image_alpha = 0; }
								with(objCommon_Body){ if(random(100)<50) FluidBreak = true; }
								addDamage(500, -1, -1, -1, -1, -1, -1);
								MotionChange(DOWN_1,0,5);
							}
						}
					}
					break;
			}

			if( MOTIONEND ){ MotionChange(STAND,0,3); break; }
			break;
		/*-----------------------------------------------*/
		case DOUBLESLICE :
			switch(KeyFrmNum){
				case  1 : 
				case  9 : 
					HitFlag = 0;
					break;
				case  6 : 
					if(KEYFRAME){ sound_play(sndSwing00); }
				case  7 : 
					if(KEYFRAME && !HitFlag){
						col = collision_line(     x-100,y+300,x-400,y+250, objPlayerDoll,0,1);
						if(!col){
							col = collision_line( x+100,y+300,x+400,y+250, objPlayerDoll,0,1);
						}
						with( col ){
							if(!INV && !BINDED){
								other.HitFlag = true;
								sound_play(sndHit02);
								Quake(15,15);
								with(other){
									switch(irandom(3)){
										case 0 : playEnemySound(SOUND_SLASH0); break;
										case 1 : playEnemySound(SOUND_SLASH1); break;
										case 2 : playEnemySound(SOUND_SLASH2); break;
										case 3 : playEnemySound(SOUND_SLASH3); break;
									}
								}

								if(global.PlayerHP<30 && objPlayerDoll.HEAD.image_alpha){
									addDamage(50,DOWN_1, 0, 1, DOWN_1, 0, 2);
									head = Macro_CutHead();
									if(head){
										head.speed = 40;
										if( other.x > x ){
											head.direction = 135;
											Fluid(objPlayerDoll.HEAD.x,objPlayerDoll.HEAD.y,COLOR_BLOOD,30,15,5,90, 90,1.0);
										}else{
											head.direction =  45;
											Fluid(objPlayerDoll.HEAD.x,objPlayerDoll.HEAD.y,COLOR_BLOOD,30,15,5,90,-90,1.0);
										}
									}
									with(other){ playEnemySound(SOUND_HEAD); }
								}else{
									DamageVoiceRandom_Mid();
									if(Direction){
										if( other.x > x ) addDamage(30,FLYING_1, 0, 1, FLYING_1, 0, 2);
										else              addDamage(30,FLYING_0, 0, 1, FLYING_0, 0, 2);
									}else{
										if( other.x > x ) addDamage(30,FLYING_0, 0, 1, FLYING_0, 0, 2);
										else              addDamage(30,FLYING_1, 0, 1, FLYING_1, 0, 2);
									}
									if( other.x > x ){
										hspeed = -40;
										with(other){ Fluid(x-300,y+200,COLOR_BLOOD,25,5,25,90, 180,1.0); }
									}else{
										hspeed =  40;
										with(other){ Fluid(x+300,y+200,COLOR_BLOOD,25,5,25,90,-180,1.0); }
									}
									PartsDamage(objExtParts,		-30,0);
									PartsBloodDamage(objExtParts,	-30,0);
									vspeed = -20;
								}
							}
						}
					}
					break;
			}
			if( MOTIONEND ){ MotionChange(STAND,0,3); break; }
			break;
		/*-----------------------------------------------*/
		case HATCHETS :
			switch(KeyFrmNum){
				case  1 : 
				case  9 : 
					HitFlag = 0;
					break;
				case  6 : 
					if(KEYFRAME){ Quake(10,5); sound_play(sndSwing00); playEnemySound(SOUND_TAKEON); }
				case  7 : 
					if(KEYFRAME && !HitFlag){
						         col = collision_line(x+Direction*-350,y,x+Direction*-450,y+300, objPlayerDoll,0,1);
						if(!col) col = collision_line(x+Direction*-300,y,x+Direction*-400,y+300, objPlayerDoll,0,1);
						if(!col) col = collision_line(x+Direction*-250,y,x+Direction*-350,y+300, objPlayerDoll,0,1);
						with( col ){
							if(!INV && !BINDED){
								if(!INV && !BINDED){
									other.HitFlag = true;
									with(other){ playEnemySound(SOUND_SMASH); }
									if( Direction ) addDamage(50,DOWN_0, 0, 1, DEATHPRESS_DOWN_0, 0, 2);
									else		    addDamage(50,DOWN_1_FRONT, 2, 1, DEATHPRESS_DOWN_1, 2, 2);
									vspeed = 40;
									PartsDamage(objExtParts,		-30,0);
									PartsBloodDamage(objExtParts,	-30,0);
									DamageVoiceRandom_High();
									if(isGameOver()){
										Direction = -1*other.Direction;
										with(other){
											startBind( objPlayerDoll,BIND_HATCHETS,0,other.FINISHED_BOSSHITOANG_HATCHETS ,0,1 );
											MotionChange(HATCHETS_FINISH,0,1);
										}
										StopVoice(V_MUSE,0);
										SpecialVoice(V_MUSE,0);
									}
								}
							}
						}
					}
					break;
			}
			if( MOTIONEND ){ MotionChange(STAND,0,3); break; }
			break;
		/*-----------------------------------------------*/
		case SPEAR :
			switch(KeyFrmNum){
				case  1 : 
				case  9 : 
					HitFlag = 0;
					break;
				case  3 : 
					if(KEYFRAME){ sound_play(sndSwing03); }
				case  4 : 
					if(KEYFRAME && !HitFlag){
						Line = drawLine(x+Direction*-150,y+150,x+Direction*-450,y+50);
						Line.Color = c_red; Line.Width = 3; Line.depth = -1000000;

						col = collision_line(x+Direction*-150,y+150,x+Direction*-450,y+50, objPlayerDoll,0,1);
						with( col ){
							if(!INV && !BINDED){
								other.HitFlag = true;
								if(Direction){
									if( other.x > x ) addDamage(30,FLYING_1, 0, 1, FLYING_1, 0, 2);
									else              addDamage(30,FLYING_0, 0, 1, FLYING_0, 0, 2);
								}else{
									if( other.x > x ) addDamage(30,FLYING_0, 0, 1, FLYING_0, 0, 2);
									else              addDamage(30,FLYING_1, 0, 1, FLYING_1, 0, 2);
								}
								if( other.x > x ){
									with(other){ Fluid(x-300,y+50,COLOR_BLOOD,25,5,25,90, 180,1.0); }
								}else{
									with(other){ Fluid(x+300,y+50,COLOR_BLOOD,25,5,25,90,-180,1.0); }
								}

								with(other){
									switch(irandom(3)){
										case 0 : playEnemySound(SOUND_SLASH0); break;
										case 1 : playEnemySound(SOUND_SLASH1); break;
										case 2 : playEnemySound(SOUND_SLASH2); break;
										case 3 : playEnemySound(SOUND_SLASH3); break;
									}
								}

								PartsDamage(objExtParts,		-30,0);
								PartsBloodDamage(objExtParts,	-30,0);
								hspeed = other.Direction*-50;
								vspeed = -10;
								DamageVoiceRandom_High();
								if(isGameOver()){
									if(Direction){
										with(other){
											if(Direction) startBind( objPlayerDoll,BIND_SPEAR,0,other.FINISHED_BOSSHITOANG_SPEAR2,0,1 );
											else          startBind( objPlayerDoll,BIND_SPEAR,0,other.FINISHED_BOSSHITOANG_SPEAR ,0,1 );
											MotionChange(SPEAR_FINISH,0,1);
										}
									}else{
										with(other){
											if(Direction) startBind( objPlayerDoll,BIND_SPEAR,0,other.FINISHED_BOSSHITOANG_SPEAR ,0,1 );
											else          startBind( objPlayerDoll,BIND_SPEAR,0,other.FINISHED_BOSSHITOANG_SPEAR2,0,1 );
											MotionChange(SPEAR_FINISH,0,1);
										}
									}
									StopVoice(V_MUSE,0);
									SpecialVoice(V_MUSE,0);
								}
							}
							
						}
					}
					break;
			}
			if( MOTIONEND ){ MotionChange(STAND,0,3); break; }
			break;
		/*-----------------------------------------------*/
		case WALKSPEAR :
			switch(KeyFrmNum){
				case  1 : 
				case  9 : 
					HitFlag = 0;
					break;
				case  3 : 
					if(KEYFRAME){ sound_play(sndSwing03); }
				case  4 : 
					if(KEYFRAME && !HitFlag){
						Line = drawLine(x+Direction*50,y+200,x+Direction*-200,y+300);
						Line.Color = c_red; Line.Width = 3; Line.depth = -1000000;

						col = collision_line(x+Direction*50,y+200,x+Direction*-200,y+300, objPlayerDoll,0,1);
						with( col ){
							if(!INV && !BINDED){
								other.HitFlag = true;
								if(Direction){
									if( other.x > x ) addDamage(30,FLYING_1, 0, 1, FLYING_1, 0, 2);
									else              addDamage(30,FLYING_0, 0, 1, FLYING_0, 0, 2);
								}else{
									if( other.x > x ) addDamage(30,FLYING_0, 0, 1, FLYING_0, 0, 2);
									else              addDamage(30,FLYING_1, 0, 1, FLYING_1, 0, 2);
								}
								if( other.x > x ){
									Fluid(x,y,COLOR_BLOOD,25,5,25,90, 180,1.0);
								}else{
									Fluid(x,y,COLOR_BLOOD,25,5,25,90,-180,1.0);
								}

								with(other){
									switch(irandom(3)){
										case 0 : playEnemySound(SOUND_SLASH0); break;
										case 1 : playEnemySound(SOUND_SLASH1); break;
										case 2 : playEnemySound(SOUND_SLASH2); break;
										case 3 : playEnemySound(SOUND_SLASH3); break;
									}
								}

								PartsDamage(objExtParts,		-30,0);
								PartsBloodDamage(objExtParts,	-30,0);
								hspeed = other.Direction*-50;
								vspeed = -10;
								DamageVoiceRandom_High();
								if(isGameOver()){
									Direction = -1*other.Direction;
									with(other){
										startBind( objPlayerDoll,BIND_WALKSPEAR,0,other.FINISHED_BOSSHITOANG_WALKSPEAR ,0,1 );
										MotionChange(WALKSPEAR_FINISH,0,1);
									}
									StopVoice(V_MUSE,0);
									SpecialVoice(V_MUSE,0);
								}
							}
							
						}
					}
					break;
			}
			if( MOTIONEND ){ MotionChange(STAND,0,3); break; }
			break;
		/*-----------------------------------------------*/
		case MULTSPEAR :
			switch(KeyFrmNum){
				case  3 : 
				case  7 : 
				case 10 : 
					if(KEYFRAME){ sound_play(sndSwing03); }
					if(KEYFRAME){
						switch(KeyFrmNum){
							case  3:
							col = collision_line(x,y+180,x+Direction*-220,y+280, objPlayerDoll,0,1); break;
							case  7:
							col = collision_line(x,y+180,x+Direction*-270,y+200, objPlayerDoll,0,1); break;
							case 10:
							col = collision_line(x,y+180,x+Direction*-220,y+380, objPlayerDoll,0,1); break;
						}
						with( col ){
							if(!INV && !BINDED){
								other.HitFlag = true;
								if(Direction){
									if( other.x > x ) addDamage(10,FLYING_1, 0, 1, FLYING_1, 0, 2);
									else              addDamage(10,FLYING_0, 0, 1, FLYING_0, 0, 2);
								}else{
									if( other.x > x ) addDamage(10,FLYING_0, 0, 1, FLYING_0, 0, 2);
									else              addDamage(10,FLYING_1, 0, 1, FLYING_1, 0, 2);
								}
								if( other.x > x ){
									Fluid(x,y,COLOR_BLOOD,25,5,25,90, 180,1.0);
								}else{
									Fluid(x,y,COLOR_BLOOD,25,5,25,90,-180,1.0);
								}
								with(other){
									switch(irandom(3)){
										case 0 : playEnemySound(SOUND_SLASH0); break;
										case 1 : playEnemySound(SOUND_SLASH1); break;
										case 2 : playEnemySound(SOUND_SLASH2); break;
										case 3 : playEnemySound(SOUND_SLASH3); break;
									}
								}
								PartsDamage(objExtParts,		-30,0);
								PartsBloodDamage(objExtParts,	-30,0);
								hspeed = other.Direction*-10;
								vspeed = -10;
								DamageVoiceRandom_High();
								if(isGameOver()){
									Direction = -1*other.Direction;
									with(other){
										startBind( objPlayerDoll,BIND_MULTSPEAR2,0,other.FINISHED_BOSSHITOANG_MULTSPEAR2 ,0,1 );
										MotionChange(MULTSPEAR_FINISH2,0,1);
									}
									StopVoice(V_MUSE,0);
									SpecialVoice(V_MUSE,0);
								}
							}
						}
						/*--------------------------------------*/
						col = noone;
						switch(KeyFrmNum){
							case  3:
							col = collision_line(x+Direction*-250,y+160,x+Direction*-500,y+280, objPlayerDoll,0,1); break;
							case  7:
							col = collision_line(x+Direction*-250,y+200,x+Direction*-400,y+320, objPlayerDoll,0,1); break;
							case 10:
							col = collision_line(x+Direction*-300,y+160,x+Direction*-500,y+80, objPlayerDoll,0,1); break;
						}
						with( col ){
							if(!INV && !BINDED){
								other.HitFlag = true;
								if(Direction){
									if( other.x > x ) addDamage(10,FLYING_1, 0, 1, FLYING_1, 0, 2);
									else              addDamage(10,FLYING_0, 0, 1, FLYING_0, 0, 2);
								}else{
									if( other.x > x ) addDamage(10,FLYING_0, 0, 1, FLYING_0, 0, 2);
									else              addDamage(10,FLYING_1, 0, 1, FLYING_1, 0, 2);
								}
								if( other.x > x ){
									Fluid(x,y,COLOR_BLOOD,25,5,25,90, 180,1.0);
								}else{
									Fluid(x,y,COLOR_BLOOD,25,5,25,90,-180,1.0);
								}
								with(other){
									switch(irandom(3)){
										case 0 : playEnemySound(SOUND_SLASH0); break;
										case 1 : playEnemySound(SOUND_SLASH1); break;
										case 2 : playEnemySound(SOUND_SLASH2); break;
										case 3 : playEnemySound(SOUND_SLASH3); break;
									}
								}
								PartsDamage(objExtParts,		-30,0);
								PartsBloodDamage(objExtParts,	-30,0);
								hspeed = other.Direction*-10;
								vspeed = -10;
								DamageVoiceRandom_High();
								if(isGameOver()){
									Direction = -1*other.Direction;
									with(other){
										startBind( objPlayerDoll,BIND_MULTSPEAR,0,other.FINISHED_BOSSHITOANG_MULTSPEAR ,0,1 );
										MotionChange(MULTSPEAR_FINISH,0,1);
									}
									StopVoice(V_MUSE,0);
									SpecialVoice(V_MUSE,0);
								}
							}
						}
					}
					break;
			}
			if( MOTIONEND ){ MotionChange(STAND,0,3); break; }
			break;
		/*-----------------------------------------------*/
		case FINGERPRESS :
			switch(KeyFrmNum){
				case  3 : 
					if(KEYFRAME){
						Quake(10,5); sound_play(sndSwing00); playEnemySound(SOUND_TAKEON);
						col = collision_circle(x,y-140,64, objPlayerDoll,0,1);
						with( col ){
							if(!INV && !BINDED){
								with(other){ playEnemySound(SOUND_SMASH); }
								if( Direction ) addDamage(50,DOWN_0, 0, 1, FINISHED_BOSSHITOANG_FINGERPRESS, 0, 2);
								else		    addDamage(50,DOWN_1_FRONT, 2, 1, FINISHED_BOSSHITOANG_FINGERPRESS, 2, 2);
								PartsBloodDamage(objExtParts,	-30,0);
								DamageVoiceRandom_High();
								if(isGameOver()){
									StopVoice(V_MUSE,0);
									SpecialVoice(V_MUSE,0);
								}
							}
						}
					}
					break;
			}
			if( MOTIONEND ){ MotionChange(STAND,0,3); break; }
			break;
		/*-----------------------------------------------*/
		case STAMP :
			switch(KeyFrmNum){
				case  3 : 
				case  6 : 
				case  9 : 
					if(KEYFRAME){
						switch(KeyFrmNum){
							case  3 : col = collision_circle(x+Direction*-150,y+320,64, objPlayerDoll,0,1); break;
							case  6 : col = collision_circle(x+Direction*-320,y+320,64, objPlayerDoll,0,1); break;
							case  9 : col = collision_circle(x+Direction*-200,y+320,64, objPlayerDoll,0,1); break;
							break;
						}
						Quake(10,5); sound_play(sndSwing00); playEnemySound(SOUND_TAKEON);
						with( col ){
							if(!INV && !BINDED){
								if( Direction ){
									with(other){ playEnemySound(SOUND_SMASH); }
									addDamage(50,DOWN_0, 0, 1, DEATHPRESS_DOWN_0, 0, 2);
									if(!isGameOver()) DamageVoiceRandom_High();
									PartsBloodDamage(objExtParts,	-30,0);
									if(isGameOver()){
										StopVoice(V_MUSE,0);
										SpecialVoice(V_MUSE,0);
									}
								}else{
									if(global.PlayerHP>0){
										Flash(COLOR_BLOOD,1.0,0.001);
										with(other){ playEnemySound(SOUND_SMASH);playEnemySound(SOUND_HEAD); }
										addDamage(50,DOWN_1_FRONT, 2, 1, FINISHED_BOSSHITOANG_STAMP, 2, 2);
										if(!isGameOver()) DamageVoiceRandom_High();
										PartsBloodDamage(objExtParts,	-50,0);
										if(isGameOver()){
											FluidWithScale(HEAD.x,HEAD.y,COLOR_BLOOD,25,2,20,  0, 20,0.5,1,depth-1);
											FluidWithScale(HEAD.x,HEAD.y,COLOR_BLOOD,25,2,20,180,-20,0.5,1,depth-1);
											StopAllVoice();
										}
									}
								}

							}
						}
					}
					break;
			}
			if( MOTIONEND ){ MotionChange(STAND,0,3); break; }
			break;
		case SPEAR_FINISH :
			switch(KeyFrmNum){
				case 8:
					if(KEYFRAME){
						with(BindTarget){ MotionChange(FLYING_0,0,2); hspeed = 40*other.Direction;  }
						endBind();
						sound_play(sndSwing00);
					}
					break;
			}
			if( MOTIONEND ){ MotionChange(STAND,0,3); break; }
			break;
		case WALKSPEAR_FINISH :
			switch(KeyFrmNum){
				case  4 : 
				case  7 : 
				case 10 : 
				case 13 : 
				case 16 : 
					if(KEYFRAME){
						Flash(COLOR_BLOOD,1.0,0.1);
						with(objPlayerDoll){
							FluidWithScale(x-Direction*128,y,COLOR_BLOOD,25,2,20, 90-Direction*30, 30,0.75,1,depth-1000);
							FluidWithScale(x-Direction*128,y,COLOR_BLOOD,25,2,20,270-Direction*30,-30,0.75,1,depth-1000);
						}
						StopAllVoice();
						Quake(10,5);

						switch(irandom(3)){
							case 0 : playEnemySound(SOUND_SLASH0); break;
							case 1 : playEnemySound(SOUND_SLASH1); break;
							case 2 : playEnemySound(SOUND_SLASH2); break;
							case 3 : playEnemySound(SOUND_SLASH3); break;
						}
						PartsDamage(objExtParts,		-30,0);
						PartsBloodDamage(objExtParts,	-30,0);
					}
					break;
				case  6 : 
				case  9 : 
				case 12 : 
				case 15 : 
				case 18 : 
					switch(irandom(5)){
						case 0 : MotionChange(WALKSPEAR_FINISH, 3,2); with(objPlayerDoll){ MotionChange(FINISHED_BOSSHITOANG_WALKSPEAR, 3,2); } break;
						case 1 : MotionChange(WALKSPEAR_FINISH, 6,2); with(objPlayerDoll){ MotionChange(FINISHED_BOSSHITOANG_WALKSPEAR, 6,2); } break;
						case 2 : MotionChange(WALKSPEAR_FINISH, 9,2); with(objPlayerDoll){ MotionChange(FINISHED_BOSSHITOANG_WALKSPEAR, 9,2); } break;
						case 3 : MotionChange(WALKSPEAR_FINISH,12,2); with(objPlayerDoll){ MotionChange(FINISHED_BOSSHITOANG_WALKSPEAR,12,2); } break;
						case 4 : MotionChange(WALKSPEAR_FINISH,15,2); with(objPlayerDoll){ MotionChange(FINISHED_BOSSHITOANG_WALKSPEAR,15,2); } break;
					}
					
					break;
			}
			break;
		case MULTSPEAR_FINISH :
			switch(KeyFrmNum){
				case  9  : 
					if(KEYFRAME){
						SpecialVoice(V_OE,irandom(5));
						Quake(10,5);
						sound_play(sndSwing00);
						playEnemySound(SOUND_SMASH);
					}
					break;
				case  14 : 
					if(KEYFRAME){
						Flash(COLOR_BLOOD,1.0,0.01);
						with(objPlayerDoll){
							FluidWithScale(HEAD.x,HEAD.y,COLOR_BLOOD,25,2,20,  0, 30,0.75,1,depth-1);
							FluidWithScale(HEAD.x,HEAD.y,COLOR_BLOOD,25,2,20,180,-30,0.75,1,depth-1);
						}
						StopAllVoice();
						Quake(10,5);
						sound_play(sndSwing00);
						playEnemySound(SOUND_TAKEON);
						playEnemySound(SOUND_HEAD);
						endBind();
					}
					break;
			}
			if( MOTIONEND ){ MotionChange(STAND,0,3); break; }
			break;
		case MULTSPEAR_FINISH2:
			switch(KeyFrmNum){
				case  6 : 
					if(KEYFRAME){
						PartsBloodDamage(objExtParts,	-300,0);
						Flash(COLOR_BLOOD,1.0,0.01);
						with(objPlayerDoll){
							FluidWithScale(HEAD.x,HEAD.y,COLOR_BLOOD,25,2,20,  0, 20,0.5,1,depth-1);
							FluidWithScale(HEAD.x,HEAD.y,COLOR_BLOOD,25,2,20,180,-20,0.5,1,depth-1);
						}
						StopAllVoice();
						Quake(10,5);
						sound_play(sndSwing00);
						playEnemySound(SOUND_TAKEON);
						playEnemySound(SOUND_HEAD);
					}
					break;
				case  7 : 
				case  8 : 
				case  9 : 
					with(objPlayerDoll){ FluidWithScale(HEAD.x+Direction*16,HEAD.y,COLOR_BLOOD,5,2,20, 80, 20,0.5,1,depth-1000); }
			}
			if( MOTIONEND ){
				endBind();
				MotionChange(STAND,0,3);
				break;
			}
			break;
		case HATCHETS_FINISH :
			with(objPlayerDoll){ FluidWithScale(HEAD.x,HEAD.y,COLOR_BLOOD,5,2,20,  90-Direction*20, 20,0.5,1,depth-1); }
			switch(KeyFrmNum){
				case  7 : 
					if(KEYFRAME){
						with(BindTarget){ MotionChange(FLYING_0,0,2); }
						endBind();
						Flash(COLOR_BLOOD,1.0,0.01);
						StopAllVoice();
						Quake(10,5);
						playEnemySound(SOUND_TAKEON);
						sound_play(sndSwing00);
					}
					break;
			}
			if( MOTIONEND ){ MotionChange(STAND,0,3); break; }
			break;

			break;
	}
}

switch(MotionNum){
	case SPEAR_FINISH :
	case WALKSPEAR_FINISH :
	case MULTSPEAR_FINISH :
	case MULTSPEAR_FINISH2:
	case HATCHETS_FINISH :
		DepthSet(objPlayerDoll.depth + 1000);
		break;
}
/*
	case HATCHETS_FINISH :
		with(PartsParam(PARTS_BODY)){ depth = objPlayerDoll.depth + 1001; }
		break;
	Line = drawLine(x,y+180,x+Direction*-200,y+280);
	Line.Color = c_red; Line.Width = 3; Line.depth = -1000000;
*/