/*-----重力設定--------------------------*/
GSet(global.G,90,0,0,0,0,0,0);
with(objEnemyEdit){ if(Edit_Play) exit; }

/*-----キャラクタとの情報の取得---------------*/
playerDistance = point_distance(x,y,objPlayerDoll.x,objPlayerDoll.y);
playerDirection = point_direction(x,y,objPlayerDoll.x,objPlayerDoll.y);

/*-----モーション毎の処理--------------------*/
if(RECV_DAMAGE) playEnemySound(SOUND_DAMAGE);

frameCount += 1;
/*衝突判定*/
with(RealCollision){
	depth = -100000;
	x = other.RealCollisionID.x;
	y = other.RealCollisionID.y;
	if(global.BOSSID.MotionNum != global.BOSSID.START){
		if(!INV){
			if(RECV_DAMAGE){
				global.BOSSID.HP -= 210;
				with(global.BOSSID){
					if(HP<0 && MotionNum!=DEAD_MOTION){
						sound_play(sndGusha);
						Flash(c_white,2.0,0.05);
						playEnemySound(SOUND_VOICE);
						HitStop(15,null);
						objDisplay.alarm[11] = 60;
						MotionChange(DEAD_MOTION,0,1);
					}
				}

				with(other){ playEnemySound(SOUND_DAMAGE); }
				other.RealCollisionID.Col = c_white;
				other.RealCollisionID.image_index = 1;
				other.RealCollisionID.image_speed = 0.01;

				while(1){
					newTGT = instance_find(objBoss4Eye,irandom(instance_number(objBoss4Eye)-1));
					if(newTGT != noone) break;
				}
				with(newTGT){
					image_index = 1;
					image_speed = 0.1;
					global.BOSSID.RealCollisionID = id;
					Col = c_red;
				}
				Quake(10,10);
				FluidWithScale(x,y,COLOR_BLOOD,30,5,15,0,360,0.5,1.0,depth-1);
			}
		}
	}
}

switch(MotionNum){
	case START :
	case DEAD_MOTION :
		with(objBoss4Eye){ image_index = 1;image_speed = 0; }
		break;
	case CATCH_LEFT_START:
	case CATCH_CENTER_START:
	case CATCH_RIGHT_START:
		DepthSet(objPlayerDoll.depth - 1000);
		with(objController){
			with(CtrlTarget){
				global.BindMax = 30+0.1*(100-global.PlayerHP);
				if( other.BindCounter>30+0.1*(100-global.PlayerHP) ){
					other.BindCounter = 0;
					move_outside_afterBind();
					BINDED = 0;
				}
			}
		}
		break;
	case CATCH_STING:
		DepthSet(objPlayerDoll.depth - 1000);
		Process[ProcessNum[PARTS_TENTACLE3_5  ]].depth = objPlayerDoll.depth + 1002;
		Process[ProcessNum[PARTS_TENTACLE3_TIP]].depth = objPlayerDoll.depth + 1001;
		Process[ProcessNum[PARTS_TENTACLE6_1  ]].depth = objPlayerDoll.depth + 1001;
		Process[ProcessNum[PARTS_TENTACLE6_2  ]].depth = objPlayerDoll.depth + 1002;
		Process[ProcessNum[PARTS_TENTACLE6_3  ]].depth = objPlayerDoll.depth + 1003;
		Process[ProcessNum[PARTS_TENTACLE6_4  ]].depth = objPlayerDoll.depth + 1004;
		Process[ProcessNum[PARTS_TENTACLE6_5  ]].depth = objPlayerDoll.depth + 1005;
		with(objController){
			with(CtrlTarget){
				global.BindMax = 30+0.1*(100-global.PlayerHP);
				if( other.BindCounter>30+0.1*(100-global.PlayerHP) ){
					other.BindCounter = 0;
					move_outside_afterBind();
					BINDED = 0;
				}
			}
		}
		break;
	case CATCH_STRANGLE:
	case CATCH_CAGE:
	case CATCH_HEAD:
	case CATCH_SQUEEZE:
		DepthSet(objPlayerDoll.depth - 1000);
		with(objController){
			with(CtrlTarget){
				global.BindMax = 30+0.1*(100-global.PlayerHP);
				if( other.BindCounter>30+0.1*(100-global.PlayerHP) ){
					other.BindCounter = 0;
					move_outside_afterBind();
					BINDED = 0;
				}
			}
		}
		break;
}

INV = 1;
if(!ChangeMotion){
	switch(MotionNum){
		case START :
			if(KeyFrmNum>1 && objPlayerDoll.x<2144){ MotionChange(MotionNum,0,10); break }
			if(KeyFrmNum>1){
				if(global.bgm!=-1){
					bGM_stop(global.bgm);
					bGM_close(global.bgm);
					global.bgm = -1;
				}
				with(objBossHealth){visible = true;}
				with(objDisplay){ TARGET = objEnemyDoll; }
			}
			if(MOTIONEND){
				with(objBoss4Eye){image_speed = 1;}

				while(1){
					newTGT = instance_find(objBoss4Eye,irandom(instance_number(objBoss4Eye)-1));
					if(newTGT != noone) break;
				}
				with(newTGT){
					other.RealCollisionID = id;
					Col = c_red;
				}

				if(global.bgm==-1) global.bgm = bGM_play("Sound/BGM/Stage4_Boss.ogg", global.config_BGMVolume, true, 0.0, 1.0);
				MotionChange(STAND,0,1); with(objDisplay){ TARGET = objPlayerDoll; }
			}
			break;
		case STAND :
			if(random(100)<1) MotionChange(INJECTION ,0,5);
			if(x - objPlayerDoll.x > 80){
				if(random(100)<2) MotionChange(CATCH_LEFT  ,0,2);
				if(random(100)<2) MotionChange(ATTACK_LEFT ,0,4);
			}else if(x - objPlayerDoll.x < -80 ){
				if(random(100)<2) MotionChange(CATCH_RIGHT ,0,2);
				if(random(100)<2) MotionChange(ATTACK_RIGHT,0,4);
			}else{
				if(objPlayerDoll.vspeed<-2 || objPlayerDoll.y-y < 250){
					if(random(100)<30) MotionChange(ATTACK_SPEAR2,0,2);
				}else{
					if(random(100)<5) MotionChange(ATTACK_SPEAR ,0,2);
					if(random(100)<4) MotionChange(ATTACK_SWING ,0,5);
					if(random(100)<10) MotionChange(CATCH_CENTER,0,2);
				}
			}
			break;

		case ATTACK_LEFT   :
			switch(KeyFrmNum){
				case 3 : 
					if(KEYFRAME){
						sound_play(sndSwing01);
						with( collision_circle( x-250,y+400, 90,objPlayerDoll,0,1) ){
							if(!INV && !BINDED){
								DamageVoiceRandom_High();
								if(random(100)<50)	addDamage(10,FLYING_0, 0, 1, FLYING_0, 0, 2);
								else				addDamage(10,FLYING_1, 0, 1, FLYING_1, 0, 2);
								PartsDamage(objExtParts,	 -20,0);
								PartsBloodDamage(objExtParts,-20,0);
								Fluid(x-40+random(80),y,COLOR_BLOOD,50,2,20,0,360,0.5);
								Flash(c_red,0.6,0.05);
								sound_play(sndHit02);
								hspeed = -40;
								vspeed = -6; sound_play(sndHit00); Quake(15,15);
							}
						}
					}
					break;
			}
			if(MOTIONEND) MotionChange(STAND,0,3);
			break;
		case ATTACK_RIGHT   :
			switch(KeyFrmNum){
				case 4 : 
					if(KEYFRAME){
						sound_play(sndSwing01);
						with( collision_circle( x+260 ,y+400, 90,objPlayerDoll,0,1) ){
							if(!INV && !BINDED){
								DamageVoiceRandom_High();
								if(random(100)<50)	addDamage(10,FLYING_0, 0, 1, FLYING_0, 0, 2);
								else				addDamage(10,FLYING_1, 0, 1, FLYING_1, 0, 2);
								PartsDamage(objExtParts,	 -20,0);
								PartsBloodDamage(objExtParts,-20,0);
								Fluid(x-40+random(80),y,COLOR_BLOOD,50,2,20,0,360,0.5);
								Flash(c_red,0.6,0.05);
								sound_play(sndHit02);
								hspeed = 40;
								vspeed = -6; sound_play(sndHit00); Quake(15,15);
							}
						}
					}
					break;
			}
			if(MOTIONEND) MotionChange(STAND,0,3);
			break;

		case CATCH_LEFT   :
			if(KeyFrmNum==4 && KEYFRAME){
				col = collision_circle( x-165,y+350, 90,objPlayerDoll,0,1);
				with( col ){
					if(!INV && !BINDED){
						Direction = other.Direction;
						DamageVoiceRandom_Mid();
						with(other){
							startBind( col,BIND_CATCH_START,0,col.BINDED_BOSSPARASITE_CATCH_LEFT_START,0,1 );
							MotionChange(CATCH_LEFT_START,0,1);
						}
						sound_play(sndHit00); Quake(15,15);
					}
				}
			}
			if(MOTIONEND) MotionChange(STAND,0,3);
			break;
		case CATCH_RIGHT  :
			if(KeyFrmNum==4 && KEYFRAME){
				col = collision_circle( x+190 ,y+350, 90,objPlayerDoll,0,1);
				with( col ){
					if(!INV && !BINDED){
						Direction = other.Direction;
						DamageVoiceRandom_Mid();
						with(other){
							startBind( col,BIND_CATCH_START,0,col.BINDED_BOSSPARASITE_CATCH_RIGHT_START,0,1 );
							MotionChange(CATCH_RIGHT_START,0,1);
						}
						sound_play(sndHit00); Quake(15,15);
					}
				}
			}
			if(MOTIONEND) MotionChange(STAND,0,3);
			break;
		case CATCH_CENTER :
			if(KeyFrmNum==5 && KEYFRAME){
				col = collision_circle( x ,y+350, 90,objPlayerDoll,0,1);
				with( col ){
					if(!INV && !BINDED){
						Direction = other.Direction;
						DamageVoiceRandom_Mid();
						with(other){
							startBind( col,BIND_CATCH_START,0,col.BINDED_BOSSPARASITE_CATCH_CENTER_START,0,1 );
							MotionChange(CATCH_CENTER_START,0,1);
						}
						sound_play(sndHit00); Quake(15,15);
					}
				}
			}
			if(MOTIONEND) MotionChange(STAND,0,3);
			break;

		case CATCH_LEFT_START  :
		case CATCH_RIGHT_START :
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(STAND_0,0,2); }
						endBind();
						MotionChange(STAND,0,20);
						break;
				}
			}
			if(MOTIONEND){
				startBind( BindTarget,BIND_CATCH_START,0,BindTarget.BINDED_BOSSPARASITE_CATCH_CENTER_START,0,1 );
				MotionChange(CATCH_CENTER_START,0,1);
			}
			break;
		case CATCH_CENTER_START :
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(STAND_0,0,2); }
						endBind();
						MotionChange(STAND,0,20);
						break;
				}
			}
			if(MOTIONEND){
				StopVoice(V_MUSE,0);
				switch(irandom(5)){
					case  0 : 
						startBind( BindTarget,BIND_CATCH_START,0,BindTarget.BINDED_BOSSPARASITE_CATCH_STRANGLE,0,1 );
						MotionChange(CATCH_STRANGLE,0,1);
						break;
					case  1 :
						startBind( BindTarget,BIND_CATCH_STING,0,BindTarget.BINDED_BOSSPARASITE_CATCH_STING,0,1 );
						MotionChange(CATCH_STING,0,1);
						break;

					case  2 : 
						startBind( BindTarget,BIND_CATCH_CAGE,0,BindTarget.BINDED_BOSSPARASITE_CATCH_CAGE,0,1 );
						MotionChange(CATCH_CAGE,0,1);
						break;
					case  3 :
						startBind( BindTarget,BIND_CATCH_HEAD,0,BindTarget.BINDED_BOSSPARASITE_CATCH_HEAD,0,1 );
						MotionChange(CATCH_HEAD,0,1);
						break;
					case  4 :
						startBind( BindTarget,BIND_CATCH_SQUEEZE,0,BindTarget.BINDED_BOSSPARASITE_CATCH_SQUEEZE,0,1 );
						MotionChange(CATCH_SQUEEZE,0,1);
						break;
				}
			}
			break;
		case CATCH_STING : 
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(STAND_0,0,2); }
						endBind();
						MotionChange(STAND,0,20);
						break;
				}
			}

			switch(KeyFrmNum){
				case  8 : 
				case 14 : 
				case 20 : 
					if(KEYFRAME){
						with(BindTarget){
							Fluid(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,10,2,20, 80,20,0.5);
							Fluid(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,10,2,20,260,20,0.5);
						}
						Flash(c_red,0.2,0.05);
						sound_play(sndHit02);
						Quake(15,15);

						HitStop(5,null);
						addDamage(11,-1,-1,-1,-1,-1,-1);
						if(isGameOver()) SpecialVoice(V_OE,irandom(5));
						else			 DamageVoiceRandom_Mid();
						/* おなかのパーツに大ダメージ！ */
						with(objCommon_Body){
							with(DrawTarget){
							PartsDamage(other.id,-random(100),0);
							PartsBloodDamage(other.id,-random(100),0);
							}
						}
					}
					break;
				case 12 : 
				case 18 : 
				case 24 : 
					if(KEYFRAME){
						if(global.PlayerHP/global.PlayerHPMAX>-1.0){
							switch(irandom(2)){
								case 0: 
									startBind( BindTarget,BIND_CATCH_STING,0,BindTarget.BINDED_BOSSPARASITE_CATCH_STING,6,1 );
									MotionChange(CATCH_STING,6,1);
									break;
								case 1: 
									startBind( BindTarget,BIND_CATCH_STING,0,BindTarget.BINDED_BOSSPARASITE_CATCH_STING,12,1 );
									MotionChange(CATCH_STING,12,1);
									break;
								case 2: 
									startBind( BindTarget,BIND_CATCH_STING,0,BindTarget.BINDED_BOSSPARASITE_CATCH_STING,18,1 );
									MotionChange(CATCH_STING,18,1);
									break;
							}
						}
					}
					break;
				case 31 : 
					with(BindTarget){
						FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,30,5,15, 30,40,0.5,1.0,depth+100);
						FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD, 5,2,10,170,20,0.5,1.5,depth+100);
					}
					if(KEYFRAME){
						Flash(c_red,1.2,0.05);
						sound_play(sndHit02);
						Quake(35,15);

						HitStop(20,null);
						addDamage(150,-1,-1,-1,-1,-1,-1);
						SpecialVoice(V_OE,irandom(5));
						/* おなかのパーツに大ダメージ！ */
						with(objCommon_Body){
							with(DrawTarget){
							PartsDamage(other.id,-100,0);
							PartsBloodDamage(other.id,-100,0);
							}
						}
					}
					break;
				case 36 : 
					if(KEYFRAME){
						sound_play(sndHit02);
						StopVoice(V_MUSE,0);
						SpecialVoice(V_MUSE,0);
						with(BindTarget){
							FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,25,2,10,20,20,0.5,1.5,depth+100);
						}
					}
					break;
				case 37 : 
				case 38 : 
					with(BindTarget){
						FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,3,2,10,20,20,0.5,1.5,depth+100);
					}
					break;
				case 39 : 
					with(BindTarget){ MotionChange(FLYING_1,0,2); }
					endBind();
					MotionChange(STAND,0,20);
					break;
			}
			break;

		case CATCH_STRANGLE : 
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(STAND_0,0,2); }
						endBind();
						MotionChange(STAND,0,20);
						break;
				}
			}
			switch(KeyFrmNum){
				case 6 : 
					if(KEYFRAME){
						HitStop(5,null);
						addDamage(8,-1,-1,-1,-1,-1,-1);
						sound_play(sndBone00);
						sound_play(sndGishi00);
						DamageVoiceRandom_Mid();
					}
					break;
				case 17 : 
					if(KEYFRAME){
						HitStop(5,null);
						addDamage(15,-1,-1,-1,-1,-1,-1);
						Quake(10,10);
						Flash(c_red,0.5,0.01);
						sound_play(sndGishi00);
						sound_play(sndBone00);
						DamageVoiceRandom_High();
					}
					break;
				case 31 : 
					if(KEYFRAME){
						HitStop(15,null);
						with(BindTarget){ FluidWithScale(HEAD.x,HEAD.y-8,COLOR_BLOOD,35,5,10,70,40,0.3,0.3,HEAD.depth-1000); }
						addDamage(200,-1,-1,-1,-1,-1,-1);
						Quake(30,30);
						Flash(c_red,1.0,0.01);
						sound_play(sndGishi00);
						sound_play(sndBone00);
						SpecialVoice(V_OE,irandom(5));
						if(isGameOver()){
							StopVoice(V_MUSE,2);
							SpecialVoice(V_MUSE,1);
						}
					}
					break;
				case 13 :
				case 27 :
					if(KEYFRAME){
						if(global.PlayerHP/global.PlayerHPMAX>0.2){
							switch(irandom(1)){
								case 0: 
									startBind( BindTarget,BIND_CATCH_START,0,BindTarget.BINDED_BOSSPARASITE_CATCH_STRANGLE,4,2 );
									MotionChange(CATCH_STRANGLE,4,2);
									break;
								case 1: 
									startBind( BindTarget,BIND_CATCH_START,0,BindTarget.BINDED_BOSSPARASITE_CATCH_STRANGLE,14,2 );
									MotionChange(CATCH_STRANGLE,14,2);
									break;
							}
						}
					}
					break;
			}
			if(MOTIONEND){
				with(BindTarget){ MotionChange(FLYING_0,0,2); }
				endBind();
				MotionChange(STAND,0,20);
				with(objPlayerDoll){ y -= 70; }
				break;
			}
			break;

		case CATCH_SQUEEZE :
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(STAND_0,0,2); }
						endBind();
						MotionChange(STAND,0,20);
						break;
				}
			}
			switch(KeyFrmNum){
				case 11 : 
					if(KEYFRAME){
						addDamage(10,-1,-1,-1,-1,-1,-1);
						sound_play(sndGishi00);
						DamageVoiceRandom_Mid();
						Quake(15,10);
						if(random(100)<30) sound_play(sndBone00);
					}
					break;
				case 20 : 
					if(KEYFRAME){
						if(global.PlayerHP/global.PlayerHPMAX > 0.3){
							var intv;
							intv = 4+random(10);
							MotionChange(CATCH_SQUEEZE,8,intv);
							with(BindTarget){ MotionChange(BINDED_BOSSPARASITE_CATCH_SQUEEZE,8,intv); }
						}
					}
					break;
				case 23 : 
					with(BindTarget){
						FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,5,5,5, 20,5,0.5,1.0,depth+100);
						FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,5,7,5,135,5,0.5,1.0,depth+100);
						FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,5,8,5,100,5,0.5,1.0,depth+100);
					}
					if(KEYFRAME){
						with(BindTarget){ FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,45,5,15, 0,360,0.5,1.0,depth+100); }
						sound_play(sndBone00);
						sound_play(sndGishi00);
						sound_play(sndGusha);
						Flash(c_red,2.0,0.05);
						
						Quake(25,15);
						addDamage(1000,-1,-1,-1,-1,-1,-1);
						SpecialVoice(V_OE,irandom(5));
						with(objPlayerDoll){visible=false;}
						with(objExtParts){visible=false;}
					}
					break;
				case 24 : 
					with(BindTarget){
						FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,5,12,5, 20,5,0.5,1.0,depth+100);
						FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,5,16,5,135,5,0.5,1.0,depth+100);
						FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,5,7,5,100,5,0.5,1.0,depth+100);
					}
					break;
				case 25 : 
					with(BindTarget){
						FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,2,10,5, 20,5,0.5,1.0,depth+100);
						FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,2,13,5,135,5,0.5,1.0,depth+100);
						FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,2,6,5,100,5,0.5,1.0,depth+100);
					}
					break;
				case 26 : 
				case 27 : 
				case 28 : 
				case 29 : 
					BloodAmount -= 0.5;
					if(BloodAmount){
						with(BindTarget){
							FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,1,6*other.BloodAmount/100,5*other.BloodAmount/100, 20,5,0.5,1.0,depth+100);
							FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,1,8*other.BloodAmount/100,5*other.BloodAmount/100,135,5,0.5,1.0,depth+100);
							FluidWithScale(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,1,5*other.BloodAmount/100,5*other.BloodAmount/100,100,5,0.5,1.0,depth+100);
						}
					}
					break;
			}
			if(MOTIONEND){
				MotionChange(CATCH_SQUEEZE,26,10);
				with(BindTarget){ MotionChange(BINDED_BOSSPARASITE_CATCH_SQUEEZE,26,10); }
			}
			break;

		case CATCH_CAGE :
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(STAND_0,0,2); }
						endBind();
						MotionChange(STAND,0,20);
						break;
				}
			}
			switch(KeyFrmNum){
				case 14 : 
				case 18 : 
				case 25 : 
					if(global.PlayerHP/global.PlayerHPMAX>-1.0){
						switch(irandom(2)){
							case 0: 
								startBind( BindTarget,BIND_CATCH_CAGE,0,BindTarget.BINDED_BOSSPARASITE_CATCH_CAGE,4,6 );
								MotionChange(CATCH_CAGE,4,6);
								break;
							case 1: 
								startBind( BindTarget,BIND_CATCH_CAGE,0,BindTarget.BINDED_BOSSPARASITE_CATCH_CAGE,11,6 );
								MotionChange(CATCH_CAGE,11,6);
								break;
							case 2: 
								startBind( BindTarget,BIND_CATCH_CAGE,0,BindTarget.BINDED_BOSSPARASITE_CATCH_CAGE,18,6 );
								MotionChange(CATCH_CAGE,18,6);
								break;
						}
					}
					break;

				case  5 : 
				case 12 : 
				case 19 : 
					if(KEYFRAME){
						with(BindTarget){
							Fluid(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,10,2,20, 80,20,0.5);
							Fluid(BODY_BOTTOM.x,BODY_BOTTOM.y,COLOR_BLOOD,10,2,20,260,20,0.5);
						}
						Flash(c_red,0.2,0.05);
						sound_play(sndHit02);
						Quake(15,15);
						addDamage(11,-1,-1,-1,-1,-1,-1);
						if(isGameOver()) SpecialVoice(V_OE,irandom(5));
						else			 DamageVoiceRandom_Mid();
						/* おなかのパーツに大ダメージ！ */
						with(objCommon_Body){
							with(DrawTarget){
							PartsDamage(other.id,-random(100),0);
							PartsBloodDamage(other.id,-random(100),0);
							}
						}
					}
					break;
				case 32 : 
					if(KEYFRAME){
						with(BindTarget){ MotionChange(FLYING_1,0,2); }
						endBind();
						MotionChange(STAND,0,20);
					}
					break;
			}
			break;
		case CATCH_HEAD :
			with(BindTarget){
				if(KeyFrmNum>48) MotionChange(BINDED_BOSSPARASITE_CATCH_HEAD,48,1);
			}
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(STAND_0,0,2); }
						endBind();
						MotionChange(STAND,0,20);
						break;
				}
			}
			if(!isGameOver()){
				if(random(100)<7){
					with(BindTarget){
						switch(irandom(3)){
							case 0 : MotionChange(BINDED_BOSSPARASITE_CATCH_HEAD, 3,1); break;
							case 1 : MotionChange(BINDED_BOSSPARASITE_CATCH_HEAD, 7,1); break;
							case 2 : MotionChange(BINDED_BOSSPARASITE_CATCH_HEAD,15,1); break;
							case 3 : MotionChange(BINDED_BOSSPARASITE_CATCH_HEAD,21,1); break;
						}
					}
				}
			}else{
				with(BindTarget){
					if(KeyFrmNum>46){
						if(random(100)<5) MotionChange(BINDED_BOSSPARASITE_CATCH_HEAD,46,1);
					}else if(KeyFrmNum<28){
						Flash(c_red,1.2,0.05);
						MotionChange(BINDED_BOSSPARASITE_CATCH_HEAD,28,1);
					}
				}
			}
			switch(KeyFrmNum){
				case 3 :
					if(KEYFRAME) VoreVoiceRandom_High();
					break;
				case 4 :
					if(KEYFRAME) sound_play(sndLotion);
				case 5 :
				case 6 :
				case 7 :
					if(random(100)<3) VoreVoiceRandom_Mid();
					with(BindTarget){ 
						FluidWithScale(HEAD.x,HEAD.y,make_color_rgb(163,73,164),5,0,6,0,360,0.5,0.5,BODY_BOTTOM.depth);
						effect_create_above(ef_smokeup,HEAD.x+random(2),HEAD.y+random(2),irandom(1),make_color_rgb(163,73,164));
						effect_create_below(ef_smokeup,HEAD.x+random(2),HEAD.y+random(2),irandom(1),make_color_rgb(163,73,164));
					}
					Quake(2,2);
					addDamage(0.5,-1,-1,-1,-1,-1,-1);
					break;
				case 8 :
					if(KEYFRAME){
						if(global.PlayerHP>-100){
							startBind( BindTarget,BIND_CATCH_HEAD,2,-1,-1,-1 );
							MotionChange(CATCH_HEAD,4,1);
						}
					}
					break;
				case 9 :
					if(KEYFRAME){
						with(BindTarget){ MotionChange(FLYING_1,0,2); }
						endBind();
						MotionChange(STAND,0,20);
					}
					break;
			}
			break;

		case INJECTION :
			if(KEYFRAME){
				col = noone;
				switch(KeyFrmNum){
					case 3 :
						Quake(10,5);
						break
					case 10 :
						Quake(5,5);
						effect_create_below(ef_smokeup,x    ,y+430,2,make_color_rgb(163,73,164));
						effect_create_below(ef_smokeup,x+160,y+430,2,make_color_rgb(163,73,164));
						effect_create_below(ef_smokeup,x+320,y+430,2,make_color_rgb(163,73,164));
						effect_create_below(ef_smokeup,x-160,y+430,2,make_color_rgb(163,73,164));
						effect_create_below(ef_smokeup,x-320,y+430,2,make_color_rgb(163,73,164));
						effect_create_below(ef_smokeup,x    ,y+430,2,make_color_rgb(163,73,164));
						effect_create_below(ef_smokeup,x+160,y+440,2,make_color_rgb(163,73,164));
						effect_create_below(ef_smokeup,x+320,y+440,2,make_color_rgb(163,73,164));
						effect_create_below(ef_smokeup,x-160,y+440,2,make_color_rgb(163,73,164));
						effect_create_below(ef_smokeup,x-320,y+440,2,make_color_rgb(163,73,164));

						effect_create_above(ef_smokeup,x    ,y+400,1,make_color_rgb(163,73,164));
						effect_create_above(ef_smokeup,x+160,y+400,1,make_color_rgb(163,73,164));
						effect_create_above(ef_smokeup,x+320,y+400,1,make_color_rgb(163,73,164));
						effect_create_above(ef_smokeup,x-160,y+400,1,make_color_rgb(163,73,164));
						effect_create_above(ef_smokeup,x-320,y+400,1,make_color_rgb(163,73,164));
						effect_create_above(ef_smokeup,x    ,y+410,1,make_color_rgb(163,73,164));
						effect_create_above(ef_smokeup,x+160,y+410,1,make_color_rgb(163,73,164));
						effect_create_above(ef_smokeup,x+320,y+410,1,make_color_rgb(163,73,164));
						effect_create_above(ef_smokeup,x-160,y+410,1,make_color_rgb(163,73,164));
						effect_create_above(ef_smokeup,x-320,y+410,1,make_color_rgb(163,73,164));
						if(col == noone) col = collision_circle( x    ,y+360, 20,objPlayerDoll,0,1); 
						if(col == noone) col = collision_circle( x+160,y+360, 20,objPlayerDoll,0,1); 
						if(col == noone) col = collision_circle( x+320,y+360, 20,objPlayerDoll,0,1); 
						if(col == noone) col = collision_circle( x-160,y+360, 20,objPlayerDoll,0,1); 
						if(col == noone) col = collision_circle( x-320,y+360, 20,objPlayerDoll,0,1); 
						break;
				}
				with( col ){
					if(!INV && !BINDED){
						DamageVoiceRandom_Low();
						addSTDamage(5,60,RISE_1_DAMAGE2, 0, 5, DOWN_1, 0, 5);
					}
				}
				if(MOTIONEND) MotionChange(STAND,0,3);
			}
			break;

		case ATTACK_SPEAR :
			if(KEYFRAME){
				col = noone;
				switch(KeyFrmNum){
					case 4 : col = collision_circle( x- 64,y+416, 64,objPlayerDoll,0,1); sound_play(sndSwing01); break;
					case 5 : col = collision_circle( x- 64,y+356, 64,objPlayerDoll,0,1); sound_play(sndSwing03); break;
					case 6 : col = collision_circle( x+128,y+416, 64,objPlayerDoll,0,1); sound_play(sndSwing02); break;
					case 7 : col = collision_circle( x    ,y+356, 64,objPlayerDoll,0,1); sound_play(sndSwing01); break;
					case 7 : col = collision_circle( x    ,y+416, 64,objPlayerDoll,0,1); sound_play(sndSwing02); break;
					case 8 : col = collision_circle( x+ 96,y+316, 64,objPlayerDoll,0,1); sound_play(sndSwing03); break;
				}
				with( col ){
					if(!INV && !BINDED){
						DamageVoiceRandom_Mid();
						if(random(100)<50)	addDamage(10,FLYING_0, 0, 1, FLYING_0, 0, 2);
						else				addDamage(10,FLYING_1, 0, 1, FLYING_1, 0, 2);
						PartsDamage(objExtParts,	  -50,0);
						PartsBloodDamage(objExtParts,-100,0);
						Fluid(x-40+random(80),y,COLOR_BLOOD,10,2,20,85,10,0.5);
						Flash(c_red,0.2,0.05);
						sound_play(sndHit02);
						vspeed = 6; sound_play(sndHit00); Quake(15,15);
					}
				}
			}

			if(MOTIONEND) MotionChange(STAND,0,3);
			break;
		case ATTACK_SPEAR2 :
			switch(KeyFrmNum){
				case 3 : 
					if(KEYFRAME){
						sound_play(sndSwing01);
						sound_play(sndSwing03);
						sound_play(sndSwing02);
						with( collision_circle( x,y+180, 128,objPlayerDoll,0,1) ){
							if(!INV && !BINDED){
								DamageVoiceRandom_High();
								if(random(100)<50)	addDamage(40,FLYING_0, 0, 1, FLYING_0, 0, 2);
								else				addDamage(40,FLYING_1, 0, 1, FLYING_1, 0, 2);
								PartsDamage(objExtParts,	 -150,0);
								PartsBloodDamage(objExtParts,-150,0);
								Fluid(x-40+random(80),y,COLOR_BLOOD,50,2,20,0,360,0.5);
								Flash(c_red,0.6,0.05);
								sound_play(sndHit02);
								hspeed =  0;
								vspeed = -6; sound_play(sndHit00); Quake(15,15);
							}
						}
					}
					break;
			}
			if(MOTIONEND) MotionChange(STAND,0,3);
			break;
		case ATTACK_SWING :
			switch(KeyFrmNum){
				case 4 : 
					if(KEYFRAME){
						sound_play(sndSwing00);
						with( collision_circle( x,y+400, 96,objPlayerDoll,0,1) ){
							if(!INV && !BINDED){
								DamageVoiceRandom_Mid();
								if(Direction!=-1)	addDamage(30,FLYING_0, 0, 1, FLYING_0, 0, 2);
								else				addDamage(30,FLYING_1, 0, 1, FLYING_1, 0, 2);
								hspeed = 60;
								vspeed = -6;
								sound_play(sndHit00);
								Quake(15,15);
							}
						}
					}
					break;
			}
			if(MOTIONEND) MotionChange(STAND,0,3);
			break;
		/* ------------------------------------------------------------ */
		case DEAD_MOTION :
			FluidWithScale(x,y,COLOR_BLOOD,5,0,5,0,360,0.5,2.0,depth-1);
			if(MOTIONEND){
				MotionChange(DEAD_MOTION,8,30);
			}
			break;
	}
}
