/*-----d͐ݒ--------------------------*/
GSet(global.G/5,global.Gdir,1,1, 0,0,0.5,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(!ChangeMotion){
	switch(MotionNum){
		case MOVE :
			ElecCharge += 0.01;
			if(ElecCharge >= 1){
				for(i=0;i<PARTS_MAX;i+=1) with(Draw[i]){ image_blend = make_color_hsv(0,0,150+random(105)); }
				ElecCharge = 1;
			}else{
				for(i=0;i<PARTS_MAX;i+=1) with(Draw[i]){ image_blend = c_white; }
			}
			/* ̕ */
			if(objPlayerDoll.x > x){
				switch(KeyFrmNum){
					case 4 : if(KEYFRAME) hspeed = 4; break;
				}
			}else{
				switch(KeyFrmNum){
					case 4 : if(KEYFRAME) hspeed =-4; break;
				}
			}
			if(objPlayerDoll.y > y){
				switch(KeyFrmNum){
					case 4 : if(KEYFRAME) vspeed = -2; break;
				}
			}else{
				switch(KeyFrmNum){
					case 4 : if(KEYFRAME) vspeed = -10; break;
				}
			}

			if(ElecCharge == 1){
				col = collision_circle( x,y, 32,objPlayerDoll,0,1);
				/* v[ɋ */
				if(240<playerDirection && playerDirection<300 && objPlayerDoll.HEAD.image_alpha){
					with( col ){
						if(!INV && !BINDED){
							VoreVoiceRandom_Mid();
							Quake(25,25);
							with(other){
								startBind( col,BIND_CATCH,0,other.BINDED_JELLYFISH_CATCH,0,1 );
								MotionChange(CATCH,0,1);
								sound_play(sndVore02);
							}
							with(other){ ElecCharge=0; }
						}
					}
				/* v[ɋȂ */
				}else{
					with( col ){
						if(!INV && !BINDED){
							DamageVoiceRandom_High();
							effect_create_below(ef_smokeup,x,y,2,c_black);
							Flash_Rect(c_white,1.2,0.05);
							Quake(25,25);
							addDamage(20, DOWN_1, 3, 2, DOWN_1, 3, 2);
							with(other){ ElecCharge=0; playEnemySound(SOUND_ELEC01); }
						}
					}
				}
			}

			break;

		/* ============  ============ */
		case CATCH : 
			gravity = 0;	/* Ƃ肠d͂؂ȂƗ邵 */
			vspeed *= 0.8;	/* ƂČȂƂ܂łオ */

			/* F𔒂 */
			for(i=0;i<PARTS_MAX;i+=1) with(Draw[i]){ image_blend = c_white; }

			/* LO */
			DepthSet(objPlayerDoll.depth - 1000);

			switch(KeyFrmNum){
				/* 0`3ł͏オ */
				case 0 : 
				case 1 : 
				case 2 : 
				case 3 : 
					vspeed = -5;
					break;
				/* 4ȍ~̓L̓ɕύX */
				case 5 :
					if(KEYFRAME){
						with(BindTarget){ MotionChange(BINDED_RAMDA,0,1); }
					}
					break;
			}

			/* S */
			if(BindTarget){
				if(!BindTarget.BINDED){
					ElecCharge = 0;
					MotionChange(MOVE,0,5);
					with(BindTarget){ MotionChange(STAND_0,0,2); }
					endBind();
					break;
				}
			}

			/* [VIɓdֈڍs */
			if(MOTIONEND){
				SpecialVoice(V_GYA,3);
				startBind( BindTarget,BIND_CATCH,0,BindTarget.BINDED_JELLYFISH_ELECTROSHOCK,0,1 );
				MotionChange(ELECTROSHOCK,0,1);
				loopEnemySound(SOUND_ELEC00);
				playEnemySound(SOUND_ELEC01);
				effect_create_below(ef_smokeup,x,y,2,c_black);
				Flash_Rect(c_white,random(1.1),0.02+random(0.5));
				Flash(c_white,random(1.1),0.02+random(0.5));
				Quake(10,10);
			}
			break;

		/* ============ d ============ */
		case ELECTROSHOCK : 
			addDamage(1, -1, -1, -1, -1, -1, -1);
			gravity = 0;	/* Ƃ肠d͂؂ȂƗ邵 */
			vspeed *= 0.8;	/* ƂČȂƂ܂łオ */

			with(BindTarget){ MotionChange(BINDED_JELLYFISH_ELECTROSHOCK,round(random(5)),2); }
			if(random(100)<10) effect_create_below(ef_smokeup,x,y,2,c_black);
			if(random(100)<15) Flash_Rect(c_white,random(1.0),0.1+random(0.5));
			if(random(100)<15) Flash(c_white,random(1.0),0.1+random(0.5));
			if(random(100)<10) Quake(10,10);

			/* F𖾖ł */
			for(i=0;i<PARTS_MAX;i+=1) with(Draw[i]){ image_blend = make_color_hsv(0,0,150+random(105)); }

			/* LO */
			DepthSet(objPlayerDoll.depth - 1000);

			/* S */
			if(BindTarget){
				if(!BindTarget.BINDED){
					ElecCharge = 0;
					MotionChange(MOVE,0,5);
					with(BindTarget){ MotionChange(FLYING_0,0,2); }
					StopAllVoice();
					stopEnemySound(SOUND_ELEC00);
					endBind();
					break;
				}
			}

			/* 傤ˁ[ȂĂ(*eցe *) */
			if(isGameOver()){
				if(random(100)<1) objCommon_Body.FluidBreak = true;
			}

			if(global.PlayerHP<-200){ 
				SpecialVoice(V_MUSE,round(random(2)));
				objCommon_Body.FluidBreak = true;
				with(BindTarget){ MotionChange(BINDED_JELLYFISH_ELECTROSHOCK,5,2); }
				MotionChange(FINISH,0,1);
				stopEnemySound(SOUND_ELEC00);
				sound_play(sndSteam);
			}
			break;
		/* ============ d ============ */
		case FINISH : 
			gravity = 0;	/* Ƃ肠d͂؂ȂƗ邵 */
			vspeed *= 0.8;	/* ƂČȂƂ܂łオ */

			/* F𔒂 */
			for(i=0;i<PARTS_MAX;i+=1) with(Draw[i]){ image_blend = c_white; }

			/* LO */
			DepthSet(objPlayerDoll.depth - 1000);

			if(random(100)<10) effect_create_below(ef_smokeup,x,y,1,c_black);
			if(random(100)<1){
				with(BindTarget){ if(KeyFrmNum>27) MotionChange(BINDED_JELLYFISH_ELECTROSHOCK,25,2); }
			}
			break;

		/* ============ S[V ============ */
		case DEAD_MOTION :
			if(MOTIONEND){
				effect_create_above(ef_explosion,x,y,1,c_white);
				Flash(c_white,0.1,0.05);
				Fluid(x,y,c_white,25,5,20,0,180,0.5);
				Quake(5,5);
				sound_play(sndFluid);
				instance_destroy();
			}
			break;
	}
}