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

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);
}

switch(MotionNum){
	case 100 :
		with(objController){
			with(CtrlTarget){
				if( other.BindCounter>10+0.1*(100-global.PlayerHP) ){
					other.BindCounter = 0;
					move_outside_afterBind();
					BINDED = 0;
				}
			}
		}
		break;
}

if(!ChangeMotion){
	switch(MotionNum){
		case STAND :
			/* 相手の方を向く */
			if( (objPlayerDoll.x > x && Direction != Right) || 
				(objPlayerDoll.x < x && Direction != Left ) ) MotionChange(TURN,0,1);
			break;
		case TURN :
			if(KeyFrmNum==3){
				if(KEYFRAME) Direction = Direction*-1;
			}
			if(MOTIONEND) MotionChange(STAND,0,1);
			break;
		case 100 : 
			if(BindTarget){
				if(!BindTarget.BINDED){
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(STAND_0,0,2); }
						endBind();
						MotionChange(STAND,0,20);
						break;
				}
			}
			break;
		case DEAD_MOTION :
			if(KeyFrmNum==1 && KEYFRAME){
				sound_play(sndHit02);
				Fluid(x,y,make_color_rgb(163,73,164),35,5,20,0,180,0.5);
				Quake(5,5);
			}
			if(MOTIONEND){
				effect_create_above(ef_explosion,x,y,1,make_color_rgb(163,73,164));
				Flash(c_white,0.1,0.05);
				Fluid(x,y-64,make_color_rgb(163,73,164),35,5,20,0,180,0.5);
				Quake(5,5);
				sound_play(sndFluid);
				instance_destroy();
			}
			break;
	}
}