/*-----d͐ݒ--------------------------*/
GSet(global.G,global.Gdir,0.1,1,0,0.95,1,1);

with(objEnemyEdit){ if(Edit_Play) exit; }
/*-----LN^Ƃ̏̎擾---------------*/
playerDistance = point_distance(x,y,objPlayerDoll.x,objPlayerDoll.y);
playerDirection = point_direction(x,y,objPlayerDoll.x,objPlayerDoll.y);

/*-----[V̏--------------------*/
if(RECV_DAMAGE){
	playEnemySound(SOUND_DAMAGE);
	if(!DamageCount) DamageCount = 100;
	else DamageCount += 20;
}
DamageCount -= 1;
AttackCount -= 1;
if(DamageCount<0) DamageCount=0;
ColorR = 200+25*sin(image_index*0.05)-DamageCount;
ColorG = 200+35*sin(image_index*0.04)-DamageCount;
ColorB = 200+55*sin(image_index*0.12)-DamageCount;
if(ColorR>255) ColorR=255;
if(ColorG>255) ColorG=255;
if(ColorB>255) ColorB=255;
if(ColorR< 50) ColorR=50;
if(ColorG< 50) ColorG=50;
if(ColorB< 50) ColorB=50;
Color = make_color_rgb(ColorR,ColorG,ColorB);
for(i=0;i<PartsNumber;i+=1){
	with(Draw[i]){ 
		image_blend = other.Color;
	}
}

switch(MotionNum){
	case STAND :
		break;
}

if(!ChangeMotion){
	switch(MotionNum){
		case WALK :
			if(ARGUMENT[0]!=null){
				Direction = ARGUMENT[0];
				ARGUMENT[0]=null;
			}
			/* ̕ */
			if(Move(-8.0*Direction,0)) Direction = Direction*-1;
			with( collision_circle( x+40*Direction*-1, y,48,objPlayerDoll,0,1) ){
				if(MOT_DOWN(MotionNum)){
					if(other.AttackCount mod 3 == 0){
						PartsDamage(objExtParts,		-10,0);
						PartsBloodDamage(objExtParts,	-10,0);
						var tmp;
						tmp = KeyFrmNum -1;
						if(tmp<0) tmp = 0;
						addDamage(8,MotionNum,tmp,1,-1,-1,-1);
						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);
						DamageVoiceRandom_Low();
						Quake(25,5);
						if(isGameOver()){
							with(other){
								if(Direction != other.Direction) startBind( objPlayerDoll,BIND_CATCH,KeyFrmNum,other.BINDED_HARUKI_FINISH ,KeyFrmNum,1 );
								else							 startBind( objPlayerDoll,BIND_CATCH,KeyFrmNum,other.BINDED_HARUKI_FINISH2,KeyFrmNum,1 );
								MotionChange(WALK_FINISH,KeyFrmNum,1);
								SpecialVoice(V_MUSE,2);
								Quake(35,15);
							}
							break;
						}
					}
				}else if(!INV && !BINDED){
					DamageVoiceRandom_Mid();
					if(Direction!=other.Direction)	addDamage(3,RISE_1_DAMAGE_BACK, 7,1, RISE_1_DAMAGE_BACK, 7,1);
					else							addDamage(3,RISE_1_DAMAGE_FRONT,6,1, RISE_1_DAMAGE_FRONT,6,1);
					hspeed = 5*other.Direction*-1;
					sound_play(sndHit00);
					Quake(15,15);
				}
			}
			break;
		case WALK_FINISH :
			Process[ProcessNum[PARTS_ASIF0]].depth	= objPlayerDoll.depth - 1001;
			Process[ProcessNum[PARTS_ASIF1]].depth	= objPlayerDoll.depth - 1002;
			Process[ProcessNum[PARTS_ASIF2]].depth	= objPlayerDoll.depth - 1003;
			Process[ProcessNum[PARTS_ASIF3]].depth	= objPlayerDoll.depth - 1004;
			Process[ProcessNum[PARTS_ASIF4]].depth	= objPlayerDoll.depth - 1005;

			/* ̕ */
			if(Move(-8.0*Direction,0)){
				Direction = Direction*-1;
				with(BindTarget){Direction = Direction*-1;}
			}
			with(BindTarget){
				FluidWithScale(BODY_TOP.x,BODY_TOP.y,COLOR_BLOOD,irandom(2),0,2,0,360,0.5,1,depth-1);
			}
			if(KEYFRAME){
				switch(KeyFrmNum){
					case 3:
						with(BindTarget){
							FluidWithScale(BODY_TOP.x,BODY_TOP.y,COLOR_BLOOD,5,2,20, 80,20,0.5,1,depth-1);
							FluidWithScale(BODY_TOP.x,BODY_TOP.y,COLOR_BLOOD,5,2,20,260,20,0.5,1,depth-1);
						}
						Flash(c_red,0.2,0.05);
						break;
				}
			}
			break;
		case DEAD_MOTION :
			if(KeyFrmNum==1 && KEYFRAME){
				sound_play(sndHit02);
				Fluid(x,y,make_color_rgb(ColorR,ColorG,ColorB),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(ColorR,ColorG,ColorB),35,5,20,0,180,0.5);
				Quake(5,5);
				sound_play(sndFluid);
				instance_destroy();
			}
			break;
	}
}