#東方弾幕風[Player]
#ScriptVersion[3]	//スクリプトバージョン3が必須です
#ID["Xeno a"]
#Title["Xeno a"]
#Text["Special Ability:[r]Luck of the Draw[r]Occasionally shoots a high[r]damage card. Frequency is based [r]on flash meter."]
#Image["./img/cutin.png"]
#ReplayName["Xeno a"]

let Player = GetPlayerObjectID();
let objSlowShot = ID_INVALID;
let current = GetCurrentScriptDirectory();
let prx;
let pry;
let flash = 0;
let PlayerType = 0;
let shotdamage = 4;
let playercolor = [255,255,255];
let cardrng = 0;

let flashposition = "BPOHC"; //CHANGE THIS IF YOU WANT TO CHANGE FLASHBOMB POSITION, POSITIONS ARE LISTED IN THE "README" FILE

@Initialize
{
	let path = current ~ "Default_Player_RumiaShotData.txt";
	LoadPlayerShotData(path); //自弾画像ロード

	SetPlayerSpeed(4,1.75);
	ObjPlayer_AddIntersectionCircleA1(Player, 0, 0, 1, 20); //当たり判定登録
	SetPlayerRebirthFrame(30);
	SetPlayerDownStateFrame(2);

	SetPlayerSpell(3);
	TImage();//自機描画用タスク起動
	FocusImage();
	TShot();//弾発射用タスク起動
	TMagicCircle();//無敵時間魔法陣タスク起動
	FlashMeter();
	cardrngg;
}

task cardrngg
{
	let n = 1+50+30;
	loop
	{
		cardrng=round(rand(1,n-flash));
		yield;
	}
}

@MainLoop
{
	yield;
}

@Finalize
{
}

@Event
{
	alternative(GetEventType())
	case(EV_REQUEST_SPELL)
	{
		if(IsPermitPlayerSpell&&GetVirtualKeyState(VK_SLOWMOVE)!=KEY_FREE&&GetPlayerSpell >= 1)
		{
			TSpell();
			SetPlayerSpell(GetPlayerSpell-1);
			SetScriptResult(true);
		}
		else if(GetVirtualKeyState(VK_SLOWMOVE)==KEY_FREE && flash==50)
		{
			TPlay(GetCurrentScriptDirectory~"./../se/se_flash.wav");
			FlashBomb;
			flash=0;
			SetScriptResult(false);
		}
		else{SetScriptResult(false);}
	}
	case(EV_HIT)
	{
		TPlay(GetCurrentScriptDirectory~"./../se/se_hit.wav");
		SetForbidPlayerShot(true);
	}
	case(EV_PLAYER_SHOOTDOWN)
	{
		prx = GetPlayerX;
		pry = GetPlayerY;
		TPlay(GetCurrentScriptDirectory~"./../se/se_barrier.wav");
		TExplosion(0.1,[rand(0,255),rand(0,255),rand(0,255)]);
		SetForbidPlayerShot(false);
	}
	case(EV_PLAYER_REBIRTH)
	{
		//復帰
		SetPlayerSpell(3);
		SetPlayerInvincibilityFrame(180);
		ObjMove_SetPosition(Player,prx,pry);
		SetForbidPlayerShot(false);
		ForbidSpells;
	}
	case(EV_GRAZE)
	{
		TPlay(GetCurrentScriptDirectory~"./../se/se_thrill.wav");
	}
}

task ForbidSpells
{
	SetForbidPlayerSpell(true);
	wait(120);
	SetForbidPlayerSpell(false);
}

task FlashBomb
{
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory~"./../img/circle.png");
	Obj_SetRenderPriority(obj,0.6);
	ObjRender_SetBlendType(obj,BLEND_INV_DESTRGB);
	ObjSprite2D_SetSourceRect(obj,0,0,512,512);
	let r = rand(100,200);
	ObjSprite2D_SetDestRect(obj,-r,-r,r,r);
	let x = rand(0,GetClipMaxX);
	let y = rand(0,GetClipMaxY);
	ObjRender_SetPosition(obj,x,y,0);
	let objS = ObjSpell_Create;
	ObjSpell_SetDamage(objS,0);
	ObjSpell_SetEraseShot(objS,true);
	ObjSpell_Regist(objS);
	SetPlayerInvincibilityFrame(60);
	loop(30)
	{
		ObjSpell_SetIntersectionCircle(objS,x,y,r);
		yield;
	}
	Obj_Delete(obj);
	Obj_Delete(objS);
}

function GetClipMaxX
{
	return GetStgFrameWidth;
}

function GetClipMaxY
{
	return GetStgFrameHeight;
}

task FlashMeter{
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj, GetCurrentScriptDirectory ~ "./../img/gauge_00.png");
	ObjSprite2D_SetSourceRect(obj, 0,0,260,15);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetAngleZ(obj,90);
	Obj_SetRenderPriority(obj, 0.9);
	let x = 537-10;
	let y = 462-130; //currently at BPOHC version
	if(flashposition=="REGULAR"){x=17-10; y=480-130;}
	ObjRender_SetPosition(obj,x,y,0);

	let obj2 = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj2, GetCurrentScriptDirectory ~ "./../img/gauge_01.png");
	ObjSprite2D_SetSourceRect(obj2, 0,0,256,4);
	ObjSprite2D_SetDestCenter(obj2);
	ObjRender_SetAngleZ(obj2,90);
	Obj_SetRenderPriority(obj2, 0.9);
	ObjRender_SetPosition(obj2, x,y,0);
	ObjRender_SetScaleY(obj2,1.5);

	let t = 0;
	let grazusi = GetGraze;
	let flashAc = false;

	while(true){
		grazusi = GetGraze;

		ObjRender_SetY(obj2, y+256/2-256/2/50*flash);
		ObjRender_SetScaleX(obj2,1/50*flash);

		t++;

		yield;

		flash = min(50,flash+(GetGraze-grazusi));

		if(flash == 50){
			ObjRender_SetColor(obj2,255,200+55*cos(t*3),200+55*cos(t*3));
			if(!flashAc){flashAc = true; TPlay(GetCurrentScriptDirectory~"./../se/se_charge.wav");}
		}
		else{
			flashAc = false;
			ObjRender_SetColor(obj2,255,255,255);
		}
	}
}

task FocusImage
{
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory() ~ "./../img/focus.png");
	ObjSprite2D_SetSourceRect(obj,0,0,70,70);
	ObjSprite2D_SetDestCenter(obj);
	Obj_SetRenderPriority(obj,0.6);
	ObjRender_SetAlpha(obj,0);
	let a = 0;
	let sc = 2;
	loop
	{
		ObjRender_SetPosition(obj,GetPlayerX,GetPlayerY,0);
		ObjRender_SetScaleXYZ(obj,sc,sc,0);
		ObjRender_SetAlpha(obj,a);
		ObjRender_SetAngleZ(obj,ObjRender_GetAngleZ(obj)+2);
		if(GetVirtualKeyState(VK_SLOWMOVE)!=KEY_FREE)
		{
			if(sc>1){sc-=1/14; a+=255/14;}
		}
		else
		{
			if(sc<2){sc+=1/14; a-=255/14;}
		}
		yield;
	}
}

task TImage
{
	let path = GetCurrentScriptDirectory() ~ "./img/player.png";
	ObjPrim_SetTexture(Player, path);
	Obj_SetRenderPriority(Player,0.31);
	let x = 0;
	let xx = 30;
	let yy = 49;
	let t = 0;
	loop
	{
		ObjRender_SetColor(Player,playercolor[0],playercolor[1],playercolor[2]);
		if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH || GetVirtualKeyState(VK_LEFT) == KEY_HOLD)
		{
			ObjSprite2D_SetSourceRect(Player, x, yy, x+xx, yy*2);
		}
		else if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH || GetVirtualKeyState(VK_RIGHT) == KEY_HOLD)
		{
			ObjSprite2D_SetSourceRect(Player, x, yy*2, x+xx, yy*3);
		}
		else
		{
			ObjSprite2D_SetSourceRect(Player, x, 0, x+xx, yy);
		}
		ObjSprite2D_SetDestCenter(Player);
		if(t%6==0){x+=xx;}
		t+=1;
		if(x==xx*8){x=0;}
		yield;
	}

}

task TShot
{
	let shotCount = 0;//弾を連続で発射するための変数
	let bNextShot = false;//ちょん押しでも自弾を連続発射するための変数(説明しづらい)
	let objShot = ID_INVALID;//誘導弾
	loop
	{
		while(GetVirtualKeyState(VK_SHOT)==KEY_FREE)
		{
			yield;
		}
		shotCount = 0;
		while(GetVirtualKeyState(VK_SHOT)!=KEY_FREE&&GetCommonData("spellactive",false)==false)
		{
			
			if(GetVirtualKeyState(VK_SLOWMOVE)==KEY_FREE)
			{
				let ang = 270;
				let objID = GetIntersectionRegistedEnemyID;
				ascent(i in 0..length(objID))
				{
					if(!Obj_IsDeleted(objID[i])){ang = getDotAngle(GetX(objID[i]),GetY(objID[i]),GetPlayerX,GetPlayerY);}
				}
				if(cardrng==1)
				{
					if(IsForbidPlayerShot==false){TPlay(GetCurrentScriptDirectory~"./../se/se_payout.wav"); CreatePlayerShotA1(GetPlayerX+16*cos(ang),GetPlayerY+16*sin(ang),15,ang,shotdamage*15,1,10); TExplosion(0.015,[255,255,0]);}
				}
				if(shotCount%8==0)
				{
					TPlay(GetCurrentScriptDirectory~"./../se/se_dice.wav");
					CreateDice(rand(0,360));
				}
				if(shotCount%4==0)
				{
					CreateCoin(ang+rand(-5,5));
				}
				if(shotCount%30==0)
				{
					ascent(i in 0..15)
					{
						if(IsForbidPlayerShot==false){TPlay(GetCurrentScriptDirectory~"./../se/se_plst00.wav"); CreatePlayerShotA1(GetPlayerX+16*cos(ang-45+i*90/14),GetPlayerY+16*sin(ang-45+i*90/14),7,ang-45+i*90/14,shotdamage,1,round(rand(1,10)));}
					}
				}
			}
			else
			{
				let ang = 270;
				let objID = GetIntersectionRegistedEnemyID;
				ascent(i in 0..length(objID))
				{
					if(!Obj_IsDeleted(objID[i])){ang = getDotAngle(GetX(objID[i]),GetY(objID[i]),GetPlayerX,GetPlayerY);}
				}
				if(cardrng==1)
				{
					if(IsForbidPlayerShot==false){TPlay(GetCurrentScriptDirectory~"./../se/se_payout.wav"); CreatePlayerShotA1(GetPlayerX+16*cos(ang),GetPlayerY+16*sin(ang),15,ang,shotdamage*15,1,10); TExplosion(0.015,[255,255,0]);}
				}
				if(shotCount%6==0)
				{
					CreateDice(rand(0,360));
				}
				if(shotCount%8==0)
				{
					CreateCoin(ang);
				}
				if(shotCount%30==0)
				{
					ascent(i in 0..15)
					{
						if(IsForbidPlayerShot==false){TPlay(GetCurrentScriptDirectory~"./../se/se_plst00.wav"); CreatePlayerShotA1(GetPlayerX+16*cos(ang-22.5+i*45/14),GetPlayerY+16*sin(ang-22.5+i*45/14),7,ang-22.5+i*45/14,shotdamage,1,round(rand(1,10)));}
					}
				}
			}
			shotCount+=1;
			yield;
		}
		wait(30);
	}
}

task CreateCoin(angle)
{
	let x = 0;
	let y = 0;
	if(IsForbidPlayerShot==false){TPlay(GetCurrentScriptDirectory~"./../se/se_coin.wav"); let obj = CreatePlayerShotA1(GetPlayerX,GetPlayerY,15,angle,shotdamage/1.5,1,12); ObjRender_SetAngleZ(obj,-45);
	while(!Obj_IsDeleted(obj)){x=GetX(obj); y=GetY(obj); yield;}}
	let s = rand(3,7);
	if(IsForbidPlayerShot==false){let objS = CreatePlayerShotA1(x,y,s,angle+180+rand(-15,15),shotdamage/1.5,5,12); ObjRender_SetAngleZ(objS,-45);
	descent(i in 0..60)
	{
		ObjMove_SetSpeed(objS,s*i/59);
		yield;
	}
	ObjMove_SetSpeed(objS,rand(5,15));
	ObjMove_SetAngle(objS,angle+rand(-15,15));
	}
}

task CreateDice(angle)
{
	if(IsForbidPlayerShot==false){TPlay(GetCurrentScriptDirectory~"./../se/se_dice.wav"); let obj = CreatePlayerShotA1(GetPlayerX,GetPlayerY,0,rand(0,360),shotdamage*5,1,11);
	let s = rand(1,7);
	let xspeed = s*cos(angle);
	let yspeed = s*sin(angle);
	while(!Obj_IsDeleted(obj))
	{
		ObjMove_SetPosition(obj,GetX(obj)+xspeed,GetY(obj)+yspeed);
		yspeed-=3/60;
		if(GetX(obj)<0||GetX(obj)>GetStgFrameWidth){xspeed=-xspeed; ObjMove_SetX(obj,GetX(obj)+xspeed);}
		if(GetY(obj)<0){yspeed=-yspeed; ObjMove_SetY(obj,GetY(obj)+yspeed); break;}
		if(GetY(obj)>GetStgFrameHeight){yspeed=-yspeed; ObjMove_SetY(obj,GetY(obj)+yspeed);}
		yield;
	}
	while(!Obj_IsDeleted(obj))
	{
		ObjMove_SetPosition(obj,GetX(obj)+xspeed,GetY(obj)+yspeed);
		yspeed-=3/60;
		if(GetX(obj)<0||GetX(obj)>GetStgFrameWidth){xspeed=-xspeed; ObjMove_SetX(obj,GetX(obj)+xspeed);}
		if(GetY(obj)>GetStgFrameHeight){yspeed=-yspeed; ObjMove_SetY(obj,GetY(obj)+yspeed);}
		yield;
	}
	}
}

function GetRX(obj)
{
	return ObjRender_GetX(obj);
}

function GetRY(obj)
{
	return ObjRender_GetY(obj);
}

function GetX(obj)
{
	return ObjMove_GetX(obj);
}

function GetY(obj)
{
	return ObjMove_GetY(obj);
}

function Horming(toAngle, angle, dAngle){
	toAngle %= 360;
	angle %= 360;

	let ret = toAngle-angle;
	if(ret >= 180){ret -= 360;}//180°以上なら-180～180内に補正
	if(ret < -180){ret += 360;}//-180°未満なら-180～180内に補正

	if((|ret|) < dAngle){
		angle = toAngle;
	}else{
		if(sin(ret) > 0){
			angle += dAngle;
		}else{
			angle -= dAngle;
		}
	}
	if(angle >= 360){angle -= 360;}
	if(angle < 0){angle += 360;}

	return angle;
}

function getDotAngle(x1,y1,x2,y2){
	let angle=atan2(y1-y2,x1-x2);
	return angle;
}

function IsForbidPlayerShot
{
	return !IsPermitPlayerShot;
}

function wait(t){loop(t){yield;}}

function AngleTo(obj1,obj2)
{
	let dir = atan2(ObjMove_GetY(obj1)-ObjMove_GetY(obj2),ObjMove_GetX(obj1)-ObjMove_GetX(obj2));
	return dir;
}

task TMagicCircle
{
	//無敵時間の魔法陣
	//頂点奇数：偶数：円の外側、円の内側
	let countVertex = 64;
	let listRadius = [];
	loop(countVertex)
	{
		listRadius = listRadius ~ [0];
	}

	let path = current ~ "./../img/Default_Player_MagicCircle.png";
	let obj = ObjPrim_Create(OBJ_PRIMITIVE_2D);
	ObjPrim_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetVertexCount(obj, countVertex);
	ObjRender_SetBlendType(obj, BLEND_ADD_RGB);
	Obj_SetRenderPriority(obj, 0.60);
	ObjPrim_SetTexture(obj, path);
	ascent(iVert in 0..countVertex / 2)
	{
		let left = iVert * 128;
		let indexVert = iVert * 2;
		ObjPrim_SetVertexUVT(obj, indexVert + 0, left, 0);
		ObjPrim_SetVertexUVT(obj, indexVert + 1, left, 64);		
	}

	let cx = 0;
	let cy = 0;
	let maxRadius = 128;
	let alpha = 0;
	let frame = 0;
	let angleRender = 0;
	let frameInvOld = 0;

	while(true)
	{
		let frameInv = GetPlayerInvincibilityFrame();

		if(frameInv <= 0)
		{
			Obj_SetVisible(obj, false);
			frameInvOld = 0;
		}
		else
		{
			if(frameInvOld == 0)
			{
				//初期化
				ascent(iVert in 0..countVertex)
				{
					listRadius[iVert] = 0;
				}
				alpha = 0;
				frame = 0;
			}
			frameInvOld = frameInv;

			let px = GetPlayerX();
			let py = GetPlayerY();

			alpha += 1 / 120;
			alpha = min(alpha, 1);
			angleRender += 360 / countVertex / 2;
			Obj_SetVisible(obj, true);

			frameInv = min(100, frameInv);
			let rRate = frameInv / 100;

			ascent(iVert in 0..countVertex / 2)
			{
				let indexVert = iVert * 2;
				let angle = 360 / (countVertex / 2 - 1) * iVert;

				let vx1 = listRadius[indexVert] * cos(angle);
				let vy1 = listRadius[indexVert] * sin(angle);
				ObjPrim_SetVertexPosition(obj, indexVert + 0, vx1, vy1, 0);

				let vx2 = listRadius[indexVert+1] * cos(angle);
				let vy2 = listRadius[indexVert+1] * sin(angle);
				ObjPrim_SetVertexPosition(obj, indexVert + 1, vx2, vy2, 0);

				//魔方陣拡大
				if(frame >= 0)
				{//外側
					let dr = (maxRadius * rRate - listRadius[indexVert]) / 8;
					listRadius[indexVert] = listRadius[indexVert] + dr;
				}
				if(frame > 10)
				{//内側
					let rRateIn = rRate - 0.12;
					if(rRateIn < 0){rRateIn=0;}
					let dr= (maxRadius * rRateIn - listRadius[indexVert + 1]) / 16;
					listRadius[indexVert + 1] = listRadius[indexVert + 1] + dr;
				}

			}

			ObjRender_SetColor(obj, 192 * alpha, 192 * alpha, 255 * alpha);
			ObjRender_SetPosition(obj, px, py, 0);
			ObjRender_SetAngleZ(obj, angleRender);

			frame++;
		}

		yield;
	}
}

task TPlay(path)
{
	let obj = ObjSound_Create();
	ObjSound_Load(obj, path);
	ObjSound_SetSoundDivision(obj,SOUND_SE);
	ObjSound_SetVolumeRate(obj,75);
	ObjSound_Play(obj);
}

task TExplosion(sc,col)
{
	let path = GetCurrentScriptDirectory() ~ "./../img/explosion.png";
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetBlendType(obj, BLEND_ADD_ARGB);
	Obj_SetRenderPriority(obj, 0.60);
	ObjPrim_SetTexture(obj, path);
	ObjSprite2D_SetSourceRect(obj, 0, 0, 128, 128);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetColor(obj,col[0],col[1],col[2]);

	let alpha = 255;
	let scale = 0;
	loop(30)
	{
		scale += sc;
		alpha -= 8;
		ObjRender_SetAlpha(obj,alpha);
		ObjRender_SetPosition(obj, GetPlayerX, GetPlayerY, 0);
		ObjRender_SetScaleXYZ(obj, scale, scale, 1);
		yield;
	}
	Obj_Delete(obj);
}

task TSpell
{
	SetForbidPlayerShot(false);
	SetCommonData("spellactive",true);
	TPlay(GetCurrentScriptDirectory~"./../se/se_spell.wav");
	SetPlayerInvincibilityFrame(360);
	let objManage = GetSpellManageObject();

	loop(15)
	{
		CreateCard(rand(0,GetStgFrameWidth),rand(0,GetStgFrameHeight));
		wait(300/15);
	}
	wait(60);
	Obj_Delete(objManage);
	SetCommonData("spellactive",false);

	task CreateCard(x,y)
	{
		let n = round(rand(1,10));
		TPlay(GetCurrentScriptDirectory~"./../se/se_shot1.wav");
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj,GetCurrentScriptDirectory~"./img/card.png");
		ObjSprite2D_SetSourceRect(obj,50*(n-1),0,50*n,64);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetPosition(obj,x,y,0);
		Obj_SetRenderPriority(obj,0.39);
		ascent(i in 0..60)
		{
			ObjRender_SetAngleY(obj,-90+i*90/59);
			yield;
		}
		let ang = rand(0,360);
		let objID = GetIntersectionRegistedEnemyID;
		ascent(i in 0..length(objID))
		{
			if(!Obj_IsDeleted(objID[i])){ang = getDotAngle(GetX(objID[i]),GetY(objID[i]),x,y);}
		}
		if(IsForbidPlayerShot==false)
		{
			if(n==1){ShotType1(x,y,ang);}
			if(n==2){ShotType2(x,y,ang);}
			if(n==3){ShotType3(x,y,ang);}
			if(n==4){ShotType4(x,y,ang);}
			if(n==5){ShotType5(x,y,ang);}
			if(n==6){ShotType6;}
			if(n==7){ShotType7(x,y,ang);}
			if(n==8){ShotType8(x,y,ang);}
			if(n==9){ShotType9(x,y,ang);}
			if(n==10){ShotType10(x,y,ang);}
		}
		descent(i in 0..60)
		{
			ObjRender_SetAngleY(obj,-90+i*90/59);
			yield;
		}
		Obj_Delete(obj);
	}
}

task ShotType1(x,y,ang)
{
	ascent(i in 0..10)
	{
		CreateYagoLaser(x,y,(i*360/10)+ang);
	}

	task CreateYagoLaser(x,y,ang)
	{
		TPlay(GetCurrentScriptDirectory~"./../se/se_shortlaser.wav");
		let obj = ObjShot_Create(OBJ_STRAIGHT_LASER);
		ObjShot_Regist(obj);
		ObjShot_SetDamage(obj,1);
		ObjShot_SetPenetration(obj,999999999);
		ObjShot_SetGraphic(obj,18);
		ObjMove_SetPosition(obj,x,y);
		ObjStLaser_SetAngle(obj,ang);
		ObjLaser_SetLength(obj,640);
		let w = 50;
		ObjLaser_SetRenderWidth(obj,w);
		ObjLaser_SetIntersectionWidth(obj,w);
		ObjShot_SetAutoDelete(obj,false);
		ObjShot_SetDelay(obj,0);
		ObjShot_SetEraseShot(obj,true);
		wait(30);
		descent(i in 0..15)
		{
			ObjLaser_SetRenderWidth(obj,w*i/14);
			yield;
		}
		Obj_Delete(obj);
	}
}

task ShotType2(x,y,ang)
{
	loop(15)
	{
		if(IsForbidPlayerShot==false){TPlay(GetCurrentScriptDirectory~"./../se/se_shot1.wav"); let obj = CreatePlayerShotA1(x,y,7,ang,1,999999999,16); ObjShot_SetEraseShot(obj,true); ObjShot_SetSpellFactor(obj,true);}
		wait(4);
	}
}

task ShotType3(x,y,ang)
{
	loop(15)
	{
		let s = rand(1,5);
		if(IsForbidPlayerShot==false){let obj = CreatePlayerShotA1(x,y,s,ang+rand(-30,30),s/3,999999999,round(rand(1,9))); ObjShot_SetEraseShot(obj,true); ObjShot_SetSpellFactor(obj,true);}
		wait(4);
	}
}

task ShotType4(x,y,ang)
{
	let angle = rand(0,360);
	loop(10)
	{
		ascent(i in 0..5)
		{
			if(IsForbidPlayerShot==false){let obj = CreatePlayerShotA1(x,y,3,(i*360/5)+angle,1,999999999,17); ObjShot_SetEraseShot(obj,true); ObjShot_SetSpellFactor(obj,true);}
		}
		angle+=15.5;
		wait(3);
	}
}

task ShotType5(x,y,ang)
{
	ascent(i in 0..5)
	{
		if(IsForbidPlayerShot==false){TPlay(GetCurrentScriptDirectory~"./../se/se_shot1.wav"); let obj = CreatePlayerShotA1(x,y,15,ang-5+i*10/4,8,999999999,13); ObjShot_SetEraseShot(obj,true); ObjShot_SetSpellFactor(obj,true);}
	}
}

task ShotType6
{
	TPlay(GetCurrentScriptDirectory~"./../se/se_payout.wav");
}

task ShotType7(x,y,ang)
{
	ascent(i in 0..30)
	{
		if(IsForbidPlayerShot==false){TPlay(GetCurrentScriptDirectory~"./../se/se_coin.wav"); let obj = CreatePlayerShotA1(x,y,3,(i*360/30)+ang,1.25,999999999,12); ObjRender_SetAngleZ(obj,-45); ObjShot_SetEraseShot(obj,true); ObjShot_SetSpellFactor(obj,true);}
	}
}

task ShotType8(x,y,ang)
{
	ascent(i in 0..30)
	{
		if(IsForbidPlayerShot==false){TPlay(GetCurrentScriptDirectory~"./../se/se_shot1.wav"); let obj = CreatePlayerShotA1(x,y,3,ang+rand(-i*45/29,i*45/29),0.4,999999999,14); ObjShot_SetEraseShot(obj,true); ObjShot_SetSpellFactor(obj,true);}
		yield;
	}
}

task ShotType9(x,y,ang)
{
	ascent(i in 0..30)
	{
		if(IsForbidPlayerShot==false){TPlay(GetCurrentScriptDirectory~"./../se/se_dice.wav"); let obj = CreatePlayerShotA1(x,y,rand(1,6),(i*360/30)+ang,1.5,999999999,11); ObjShot_SetEraseShot(obj,true); ObjShot_SetSpellFactor(obj,true);}
	}
}

task ShotType10(x,y,ang)
{
	let D = 0;
	loop(30)
	{
		ascent(i in 0..3)
		{
			if(IsForbidPlayerShot==false){let obj = CreatePlayerShotA1(x,y,5,(i*360/3)+ang,1.25,999999999,16); ObjRender_SetColor(obj,0,0,0); ObjShot_SetEraseShot(obj,true); ObjShot_SetSpellFactor(obj,true);}
		}
		ang+=D;
		D+=0.5;
		yield;
	}
}