//����얲�`
#TouhouDanmakufu[Player]
#ScriptVersion[3]	//�X�N���v�g�o�[�W����3���K�{�ł�
#ID["ReimuA_DT35"]
#Title["DDC Reimu A"]
#Image["./../../Common/img/playerscutin/title_pl00.png"]
#Text["DDC Reimu A"]
#ReplayName["ReimuA"]

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 "./../../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_REIMU;
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���˗p�^�X�N�N��
	TShot2();//�e���˗p�^�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���擾�ʒm
		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�ʒm
		GrazeEffect(GetEventArgument(1));
		PlayVol(SE_GRAZE, 60);
	}
}

