#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Mamizou Futatsuiwa]
#Text[Shot:
"Avian Danmaku Transformation"
"Carnivorous Danmaku Transformation"

Bomb: "Wild Carpet"

Special:
"Escapement of the vulgar thief"
Release the shot button and you will transform to the silly magician, allowing you to reach high speeds.]
#Image[.\Mamizou Select.png]
#ReplayName[Mamizou]

script_player_main
{

#include_function ".\Funciones.txt"

task controlop{
if(GetCommonData("tieneop")==true){
if(GetCommonData("robado")==0){
		Option("LEFT");
		Option("RIGHT");
}
if(GetCommonData("robado")==1){
		Option("RIGHT");
}
}
}

	@Initialize
	{	
		
		LoadPlayerShotData(GetCurrentScriptDirectory()~"Mami Shot.txt");
		SetPlayerLifeImage(img_yui,35, 1, 66, 43);
		SetInitialBombCount(1);
              	focuspocus;
		Option("LEFT");
		Option("RIGHT");
		SetRateScoreSystemEnable(false);
		SetSpeed(4, 1.5);
	}

/////////////////////////////////////////////
	
	@MainLoop
	{	

		if((GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD) && count==-1){
			count = 0;

		}
		if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){

			if(count%4 == 0){	//2 op = 140 main 140 op, 1 op = 2op
if(GetCommonData("robado")==0){
			Mainshotu(7, 10, 25, 270, 3.5,1,1);
			Mainshotu(-7, 10, 25, 270, 3.5,1,1);
}
if(GetCommonData("robado")==1){
			Mainshotu(7, 10, 25, 270, 4.7,1,1);
			Mainshotu(-7, 10, 25, 270, 4.7,1,1);
}
if(GetCommonData("robado")==2){
			Mainshotu(7, 10, 25, 270, 6,1,1);
			Mainshotu(-7, 10, 25, 270, 6,1,1);
}
                        PlaySE(disparo);
           

			}

		}else{	
			if(count%4 == 0){//160 140 120	
if(GetCommonData("robado")==0){
			Mainshotu(7, 10, 25, 270, 3,1,1);
			Mainshotu(-7, 10, 25, 270, 3,1,1);
}

if(GetCommonData("robado")==1){
			Mainshotu(7, 10, 25, 270, 3.6,1,1);
			Mainshotu(-7, 10, 25, 270, 3.6,1,1);
}
if(GetCommonData("robado")==2){
			Mainshotu(7, 10, 25, 270, 4,1,1);
			Mainshotu(-7, 10, 25, 270, 4,1,1);
}
                        PlaySE(disparo);
			}
			
		}		

		if(count >= 0){
			count++;
		}
		if(count >= 6 && (GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)){
			count=-1;
		}
		if(count >= 8){
			count=-1;
		}
		SetIntersectionCircle(GetPlayerX, GetPlayerY, 0);

/////////////////////////////////////////////////////
//Habilidad
/////////////////////////////////////////////////////


		if((GetKeyState(VK_SHOT)==KEY_FREE) && GetKeyState(VK_SLOWMOVE)==KEY_FREE && GetCommonData("notrans")==true){
		SetSpeed(10, 10);
                Estela(GetPlayerX,GetPlayerY+3);
}else{
		SetSpeed(5, 2);}


/////////////////////////////////////////////////////

/////////////////////////////////////////////////////


		yield;
H = false;

	}

/////////////////////////////////////////////

	@Missed{
yield;
if(H==false){
H=true;

}
}

/////////////////////////////////////////////


	@SpellCard{

                                SetCommonData("notrans",false);
				UseSpellCard("carpet", false);
	                        PlaySE(sespell);
                                CutIn(KOUMA,""\""Wild Carpet"\", cut);
		
	}


//////////////////////////////////////////////////////////////////


	@DrawLoop{

		SetTexture(img_yui);
                SetGraphicScale(1,1);
if(GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD || GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD  || GetCommonData("notrans")==false){
		DrawGraphic(GetPlayerX+2, GetPlayerY);
//////////////////////////////////////////////////////////////////////////
                if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD){
//////////////////////////////////////////////////////////////////////////
			SetGraphicRect(3, 2, 24, 44);}
 else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD){
//////////////////////////////////////////////////////////////////////////
                        SetGraphicRect(74, 2, 104, 44);}
else{
			SetGraphicRect(38, 1, 61, 46);
		}

	//}
}
else if(GetKeyState(VK_SHOT)==KEY_FREE ||  GetKeyState(VK_SLOWMOVE)==KEY_FREE && GetCommonData("notrans")==true){
		DrawGraphic(GetPlayerX, GetPlayerY);
               if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD){
//////////////////////////////////////////////////////////////////////////
			SetGraphicRect(0, 52, 36, 97);}
 else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD){
                        SetGraphicRect(80, 52, 119, 97);}
else{
			SetGraphicRect(42, 52, 75, 97);
		}
}

}


}

	@Finalize{
		DeleteGraphic(img_yui);
		DeleteGraphic(cut);
		DeleteGraphic(cut2);
		DeleteSE(disparo);
		DeleteSE(sespell);
	}


}

////////////////
////////////////
////////////////

script_spell carpet {
   let Time = 258;
    @Initialize {
        SetPlayerInvincibility(Time + 60);
	TMain;

    }				

    @Finalize {

                SetCommonData("notrans",true);
       
    }			

    @MainLoop {
        yield;

    }				



 task TMain {
	let gridy=(GetClipMaxY-GetClipMinY)/8;
	let y=0;
	loop(48){yield;}
	loop(15){ 
		//PlaySE(SE);
		y=GetClipMinY-gridy;
		loop(9){       
			birdy(y+rand(0,60));
			doge(y+rand(0,60));
			y+=gridy;
			}
		loop(5){yield;}
		}
	loop(120){yield;}
        End;
    }				//TMain End
	

	task birdy(let y){
		let objShot= Obj_Create(OBJ_SHOT);
		let pcount=0;
		let alp=200;
		Obj_SetX(objShot, GetClipMinX);
		Obj_SetY(objShot, y);
		Obj_SetSpeed(objShot, rand(2,5));
        	ObjShot_SetGraphic(objShot, 5);
		ObjShot_SetDamage(objShot, 0.5);
		Obj_SetAlpha(objShot, alp);     
		ObjShot_SetPenetration(objShot, 100);
		Obj_SetAngle(objShot, 0);
		
		while( !Obj_BeDeleted(objShot) )
		{

	loop(10){yield;}
		Obj_SetAngle(objShot, 0+rand(-20,20));
	loop(200){yield;}
				
			yield;
			}

		Obj_Delete(objShot);

		
		}   

	task doge(let y){
		let objShot= Obj_Create(OBJ_SHOT);
		let pcount=0;
		let alp=200;
		let dy=0;
		Obj_SetX(objShot, GetClipMaxX);
		Obj_SetY(objShot, y);
		Obj_SetSpeed(objShot, rand(2,5));
        	ObjShot_SetGraphic(objShot, 4);
		ObjShot_SetDamage(objShot, 0.5);
		Obj_SetAlpha(objShot, alp);     
		ObjShot_SetPenetration(objShot, 40);
		Obj_SetAngle(objShot, 180);
		
		while( !Obj_BeDeleted(objShot) )
		{
				
			yield;
			}

		Obj_Delete(objShot);

		
		}   


}


/////////////////////////////////////////////////////////////////////