//�E�\�E�Z�E��E��E��E�
#TouhouDanmakufu[Player]
#ScriptVersion[3]	//�E�X�E�N�E��E��E�v�E�g�E�o�E�[�E�W�E��E��E��E�3�E��E��E�K�E�{�E�ł�
#ID["SakuyaA_DT35"]
#Title["DDC Sakuya A"]
#Image["./../../Common/img/playerscutin/title_pl02.png"]
#Text["DDC Sakuya A"]
#ReplayName["SakuyaA"]

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 DimensionFlag=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_SAKUYA;
IMG_OPTION=IMG_SAKUYA_OPTION;

@Initialize
{
	let path = current ~ "../../Common/lib/ShotData.txt";
	LoadPlayerShotData(path); //�E��E��E�e�E�摜��E��E�[�E�h

	ObjPlayer_AddIntersectionCircleA1(objPlayer, 0, 0, 0.2, 35); //�E��E��E��E��E�蔻�E��E�o�E�^
	SetPlayerClip(104, 11, GetScreenWidth()-104, GetScreenHeight()-11);
	SetPlayerSpeed(4.5,2.0);

	TImage();//�E��E��E�@�E�`�E��E�p�E�^�E�X�E�N�E�N�E��E�
	OptionMove;//�E�I�E�v�E�V�E��E��E��E��E�ړ��E�p�E�^�E�X�E�N
	TRenderOption;//�E�I�E�v�E�V�E��E��E��E��E�`�E��E�p�E�^�E�X�E�N
	TShot();//�E�e�E��E��E�˗p�E�^�E�X�E�N�E�N�E��E�
	TShot2();//�E�e�E��E��E�˗p�E�^�E�X�E�N�E�N�E��E�
	SlowEffect;//�E�ᑬ�E��E��E��E��E�w�E�G�E�t�E�F�E�N�E�g�E�p�E�^�E�X�E�N
	InvincibleSystemTask;//�E��E��E�ꖳ�E�G�E�p�E�^�E�X�E�N
	SetPlayerRebirthFrame(8);
	SetPlayerRebirthLossFrame(0);
	SetPlayerDownStateFrame(40);
	SoundLoad;
}

@MainLoop
{
	yield;
}

@Finalize
{
}

@Event
{
	alternative(GetEventType())
	case(EV_REQUEST_SPELL)
	{
		//�E�X�E�y�E��E��E�J�E�[�E�h�E�v�E��E�
		let spell = GetPlayerSpell();//�E�c�E��E�X�E�y�E��E��E��E�
		if((spell >= 1 && !RebirthFlag) || AutoBombFlag)
		{
			SetScriptResult(true);//�E�X�E�y�E��E��E��E��E��E��E�\
			if(!AutoBombFlag || GetVirtualKeyState(VK_BOMB)==KEY_PUSH && !OnSpell)
			{
			SetPlayerSpell(spell-1);//�E�X�E�y�E��E��E��E��E��E�1�E��E��E�炷
			TSpell();//�E�X�E�y�E��E��E�^�E�X�E�N�E�N�E��E�
			}
			else
			{
			DummySpell();//�E�X�E�y�E��E��E�^�E�X�E�N�E�N�E��E�
			}
		}
		else
		{
			SetScriptResult(false);//�E�X�E�y�E��E��E��E��E��E��E�s�E��E�
		}
		AutoBombFlag=false;
	}
	case(EV_HIT)
	{
		//�E��E�e
		if(InvincibleCount>0)
		{
		AutoBombFlag=true;
		CallSpell;
		}
		else if(DimensionFlag)
		{
		PlayVol(SE_PLAYERDOWN2,60);
		AutoBombFlag=true;
		CallSpell;
		}
		else
		{
		PlayVol(SE_PLAYERDOWN, 60);
		TExplosion();
		}
	}
	case(EV_PLAYER_REBIRTH)
	{
		//�E��E��E�A
		SetPlayerSpell(2);
		SetPlayerInvincibilityFrame_Special(240);
	}
	case(EV_GET_ITEM)
	{
		//�E�A�E�C�E�e�E��E��E�擾�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)
	{
		//�E�O�E��E��E�C�E�Y�E�ʒm
		GrazeEffect(GetEventArgument(1));
		PlayVol(SE_GRAZE, 60);
	}
}

