//・ｽ・ｽ・ｽ・ｽ・ｲ・ｽ`
#TouhouDanmakufu[Player]
#ScriptVersion[3]	//・ｽX・ｽN・ｽ・ｽ・ｽv・ｽg・ｽo・ｽ[・ｽW・ｽ・ｽ・ｽ・ｽ3・ｽ・ｽ・ｽK・ｽ{・ｽﾅゑｿｽ
#ID["ReimuB_DT35"]
#Title["Reimu Hakurei"]
#Image["./../../Common/img/playerscutin/title_pl00b.png"]
#Text["DDC Reimu B"]
#ReplayName["ReimuB"]

let objPlayer = GetPlayerObjectID();
let PlayerPower=400;
let PlayerPower_Int=PlayerPower/100;
let objOption =[];
let OptionX=[GetStgFrameWidth/2,GetStgFrameWidth/2,GetStgFrameWidth/2,GetStgFrameWidth/2];
let OptionY=[416,416,416,416];
let RodFlag=false;
let RodX;
let RodY;
let SpellMove=0;
let RebirthFlag=false;

let OnSpell=false;
let InvincibleSystem=true;
let AutoBombFlag=false;
let InvincibleFlag=false;
let InvincibleCount=0;

let current = GetCurrentScriptDirectory();

#include "./Option.txt"
#include "./Shot.txt"
#include "./Spell.txt"
//#include "./file.txt"

#include "./../../Common/lib/Player.txt"
#include "./../../Common/lib/Effect.txt"
#include "./../../Common/lib/Invincible.txt"
#include "./../../Common/lib/Library.txt"
#include "./../../Common/lib/Load.txt"
#include "./../../Common/lib/Config.txt"
#include "./../../Common/lib/file.txt"

IMG_PLAYER=IMG_REIMU2;
IMG_OPTION=IMG_REIMU_OPTION;

@Initialize
{
	let path = current ~ "../../Common/lib/ShotData.txt";
	LoadPlayerShotData(path); //・ｽ・ｽ・ｽe・ｽ鞫懶ｿｽ・ｽ・ｽ[・ｽh

	ObjPlayer_AddIntersectionCircleA1(objPlayer, 0, 0, 0.1, 30); //・ｽ・ｽ・ｽ・ｽ・ｽ阡ｻ・ｽ・ｽo・ｽ^
	SetPlayerClip(104, 11, GetScreenWidth()-104, GetScreenHeight()-11);
	SetPlayerSpeed(4.5,2.0);

	TImage();//・ｽ・ｽ・ｽ@・ｽ`・ｽ・ｽp・ｽ^・ｽX・ｽN・ｽN・ｽ・ｽ
	OptionMove;//・ｽI・ｽv・ｽV・ｽ・ｽ・ｽ・ｽ・ｽﾚ難ｿｽ・ｽp・ｽ^・ｽX・ｽN
	TRenderOption;//・ｽI・ｽv・ｽV・ｽ・ｽ・ｽ・ｽ・ｽ`・ｽ・ｽp・ｽ^・ｽX・ｽN
	TShot();//・ｽe・ｽ・ｽ・ｽﾋ用・ｽ^・ｽX・ｽN・ｽN・ｽ・ｽ
	TShot2();//・ｽe・ｽ・ｽ・ｽﾋ用・ｽ^・ｽX・ｽN・ｽN・ｽ・ｽ
	SlowEffect;//・ｽ瘻ｬ・ｽ・ｽ・ｽ・ｽ・ｽw・ｽG・ｽt・ｽF・ｽN・ｽg・ｽp・ｽ^・ｽX・ｽN
	InvincibleSystemTask;//・ｽ・ｽ・ｽ齧ｳ・ｽG・ｽp・ｽ^・ｽX・ｽN
	SetPlayerRebirthFrame(12);
	SetPlayerRebirthLossFrame(0);
	SetPlayerDownStateFrame(40);
	SoundLoad;
}

@MainLoop
{
	yield;
}

@Finalize
{
}

@Event
{
	alternative(GetEventType())
	case(EV_REQUEST_SPELL)
	{
		//・ｽX・ｽy・ｽ・ｽ・ｽJ・ｽ[・ｽh・ｽv・ｽ・ｽ
		let spell = GetPlayerSpell();//・ｽc・ｽ・ｽX・ｽy・ｽ・ｽ・ｽ・ｽ
		if((spell >= 1 && !RebirthFlag) || AutoBombFlag)
		{
			SetScriptResult(true);//・ｽX・ｽy・ｽ・ｽ・ｽ・ｽ・ｽ・ｽ・ｽﾂ能
			if(!AutoBombFlag || GetVirtualKeyState(VK_BOMB)==KEY_PUSH && !OnSpell)
			{
			SetPlayerSpell(spell-1);//・ｽX・ｽy・ｽ・ｽ・ｽ・ｽ・ｽ・ｽ1・ｽ・ｽ・ｽ轤ｷ
			TSpell();//・ｽX・ｽy・ｽ・ｽ・ｽ^・ｽX・ｽN・ｽN・ｽ・ｽ
			}
			else
			{
			DummySpell();//・ｽX・ｽy・ｽ・ｽ・ｽ^・ｽX・ｽN・ｽN・ｽ・ｽ
			}
		}
		else
		{
			SetScriptResult(false);//・ｽX・ｽy・ｽ・ｽ・ｽ・ｽ・ｽ・ｽ・ｽs・ｽ・ｽ
		}
		AutoBombFlag=false;
	}
	case(EV_HIT)
	{
		//・ｽ・ｽe
		if(InvincibleCount>0)
		{
		AutoBombFlag=true;
		CallSpell;
		}
		else
		{
		PlayVol(SE_PLAYERDOWN, 60);
		TExplosion();
		}
	}
	case(EV_PLAYER_REBIRTH)
	{
		//・ｽ・ｽ・ｽA
		SetPlayerSpell(2);
		SetPlayerInvincibilityFrame_Special(240);
	}
	case(EV_GET_ITEM)
	{
		//・ｽA・ｽC・ｽe・ｽ・ｽ・ｽ謫ｾ・ｽﾊ知
		let itemType = GetEventArgument(0);
		alternative(itemType)
		case(ITEM_SPELL)
		{
			WriteLog("ITEM_SPELL");
		}
		case(ITEM_SPELL_S)
		{
			WriteLog("ITEM_SPELL_S");
		}
		case(ITEM_POWER)
		{
			WriteLog("ITEM_POWER");
		}
		case(ITEM_POWER_S)
		{
			WriteLog("ITEM_POWER_S");
		}
		others{
			PlayVol(SE_ITEM, 85);
		}
	}
	case(EV_GRAZE)
	{
		//・ｽO・ｽ・ｽ・ｽC・ｽY・ｽﾊ知
		GrazeEffect(GetEventArgument(1));
		PlayVol(SE_GRAZE, 60);
	}
}

