<?xml version="1.0" encoding="shift-jis"?>
<exbulletml>

<!-- ********************************************************************* -->
<!-- *** ボス戦                                                        *** -->
<!-- ***                                                               *** -->
<action label="stage_main_boss_action">

	<!-- *** 第 N 形態 *** -->
	<global name="boss_state">1</global>
	
	<!-- *** ボスの初期ライフ *** -->
	<global name="boss_life">3</global>

	<!-- *** 会話終了ロックをかける *** -->
	<setLock><num>11</num></setLock>

	<!-- *** stageI用global *** -->
	<global name="temp_counter">0</global>
	
	<!-- *** 最初のボスオブジェクト作成 *** -->
	<global name="temp_grank">$__grank</global>
	<createRef label="enemy_create_main_boss">
		<p>320</p>
		<p>-12</p>
		<p>29999999</p>
		<p>0</p>
		<p>0</p>
		<p>$__main_boss_prate</p>
	</createRef>

	<wait>60</wait>

</action>

<!-- ********************************************************************* -->
<!-- *** ボス戦開始                                                    *** -->
<!-- ***                                                               *** -->
<action label="stage_main_boss_start">

	<!-- *** 会話終了ロック解除 *** -->
	<releaseLock><num>11</num></releaseLock>

	<!-- *** ボスの名称表示オブジェクト作成 *** -->
	<!--
	<createRef label="boss_name_stage_main"></createRef>	
	-->
<!--
	<sound type="bgm" label="bgm">
		<track><file type="ogg">09_bossC1_loop</file></track>
		<play><flag>1</flag><loop>44100*2*2*3</loop></play>
	</sound>
	<actionRef label="stageC_2_bgm_title_action"/>
-->

	<!-- *** ボスのライフ表示オブジェクト作成 *** -->
	<createRef label="boss_life_create2"></createRef>

	<!-- *** ボス戦が終わるまで待機                  *** -->	
	<!-- *** 最終形態が終わると Lock 10 が開放される *** -->
	<setLock><num>10</num></setLock>
	<waitLock><num>10</num></waitLock>
</action>


<!-- ********************************************************************* -->
<!-- *** ボスオブジェクト作成                                        *** -->
<!-- ***                                                               *** -->
<create label="enemy_create_main_boss">
	<speed>0</speed><dir>0</dir>
	<cx>$1</cx><cy>$2</cy>
	<vital>$3</vital>
	<inv>$4</inv>
	<score>$5</score>
	<prate>$6</prate>
<!--	<flag>16</flag> -->
	<enemyRef label="enemy_main_boss"></enemyRef>
</create>

<!-- ********************************************************************* -->
<!-- *** ボスオブジェクト                                            *** -->
<enemy label="enemy_main_boss">

	<!-- *** 初期設定では衝突判定無し *** -->
	<collision type="circle"><cx>-1</cx><cy>-1</cy><radius>0</radius></collision>
	<presentRef label="stage_main_boss_present_01"></presentRef>

	<!-- タイマー差分初期化 -->
	<global name="end_offset">0</global>

	<!-- stageI のみ、以下のフラグは、倒したどうかの判定に用いる -->
	<global name="end_flag">0</global>

	<!-- *** 第 N 形態ごとのアクション *** -->
	<repeat><times>$__boss_state-eq1</times>
		<eval name="cross_over">110</eval>
		<revengeRef label="stage_main_boss_01_revenge"><p>$cross_over</p></revengeRef>
		<actionRef  label="stage_main_boss_01_action"><p>$cross_over</p></actionRef> 
	</repeat>


</enemy>


<!-- ********************************************************************* -->
<!-- *** ボスのアクション　第１形態　                                *** -->
<!-- ***                                                               *** -->

<action  label="stage_main_boss_01_action">
	<changeSpeed>
		<speed>3.4</speed><tm>0</tm>
	</changeSpeed>
	<changeDirection>
		<dir type="abs">180</dir><tm>0</tm>
	</changeDirection>
	<wait>30</wait>

	<changeSpeed>
		<speed>0</speed><tm>30</tm>
	</changeSpeed>
	<wait>30</wait>
	<createRef label="enemy_magic_back"></createRef>

	<!-- 双子１人戦闘判定 0:2人または直線 1:成実 2:瑠璃香 3:シズカ -->
	<eval name="twins">($_twinstype-eq1)*($__twins_set-eq0)+($_twinstype-eq2)*($__twins_set-eq1)*2+($_twinstype-eq3)*($__twins_set-eq1)*3</eval>

	<!-- debug -->
<!--
	<eval name="twins">1</eval>
-->
	<eval name="vital_1">17600+($__grank*220)-(($twins-eq1)*(11400+($__grank*160)))-($_twinstype-eq2)*2900+($_twinstype-eq3)*1600</eval>
	<eval name="vital_2">17500+($__grank*220)-(($twins-eq1)*(11400+($__grank*160)))-($_twinstype-eq2)*2900+($_twinstype-eq3)*1600+$vital_1</eval>
	<eval name="vital_3">18500+($__grank*220)-(($twins-eq1)*(12200+($__grank*160)))-($_twinstype-eq2)*2900+($_twinstype-eq3)*1800+$vital_2</eval>
	<eval name="vital_4">25500+($__grank*340)-(($twins-eq1)*(17200+($__grank*270)))-($_twinstype-eq2)*5000+($_twinstype-eq3)*3800+$vital_3</eval>

	<eval name="vital_1">$vital_1*(1-($_weapontype-eq2)*(0.05+($_twinstype-eq1)*0.05+($_twinstype-eq2)*0.1))</eval>
	<eval name="vital_2">$vital_2*(1-($_weapontype-eq2)*(0.05+($_twinstype-eq1)*0.05+($_twinstype-eq2)*0.1))</eval>
	<eval name="vital_3">$vital_3*(1-($_weapontype-eq2)*(0.05+($_twinstype-eq1)*0.05+($_twinstype-eq2)*0.1))</eval>
	<eval name="vital_4">$vital_4*(1-($_weapontype-eq2)*(0.05+($_twinstype-eq1)*0.05+($_twinstype-eq2)*0.1))</eval>


	<!-- *** 会話終了待ち *** -->
	<waitLock><num>11</num></waitLock>

	<!-- *** ゲージ類をここで作成 *** -->
	<createRef label="boss_underbar_create"></createRef>
	<global name="timer">1</global>
	<global name="timerwait">4940+40</global>
<!--		<actionRef  label="create_timer"></actionRef> -->

	<w>5</w>
	<!-- 場所、体力、時間、タイマー上のチェックポイント、１つ前の体力 -->
	<createRef label="boss_vital_create2_0"><p>240</p><p>$vital_1</p><p>1185+30</p><p>403</p><p>0</p></createRef>
	<createRef label="boss_vital_create2_1"><p>170</p><p>$vital_2</p><p>2370+30</p><p>346</p><p>$vital_1</p></createRef>
	<createRef label="boss_vital_create2_2"><p>100</p><p>$vital_3</p><p>3555+30</p><p>290</p><p>$vital_2</p></createRef>
	<createRef label="boss_vital_create2_3"><p>30</p><p>$vital_4</p><p>4940+30</p><p>220</p><p>$vital_3</p></createRef>

	<create>
		<cx>220</cx><cy>27</cy><speed>0</speed><dir>0</dir><child>1</child>
		<object>	
			<img type="normal">
				<file type="dds">bosstimer</file>
				<left>31</left><top>8</top><right>32</right><bottom>16</bottom>
				<width>1</width><height>8</height>
				<alpha>255</alpha><red>255</red><green>255</green><blue>255</blue>
			</img>
			<setDrawLevel><num>7</num></setDrawLevel>
		</object>
	</create>

	<w>30</w>
	<!-- *** 実際の戦闘開始 *** -->
<!--	<collision type="circle"><cx>-1</cx><cy>-1</cy><radius>20</radius></collision>-->
	<collision type="rect"><left>-150</left><top>-44</top><right>150</right><bottom>4</bottom></collision>
<!--	<createRef l="barrer"/> -->

<!-- 弾幕開始 -->
	<actionRef label="start_boss_bullet2"/>
	<w>1</w>
	<!-- タイマーチェック -->
	<eval name="time_check1">$_stageplayframe</eval>

<!-- debugするときは、不要なcreate を消す。 -->
<!-- その上で、createの中にあるboss_life判定をけす。 -->
<!-- 第４形態をやるときは、eval name = i を 0 にする -->

	<createRef label="mahoujin_create_b_01"><p>$1</p></createRef>
	<createRef label="mahoujin_create_b_02"><p>$1</p></createRef>
	<createRef label="mahoujin_create_b_03"><p>$1</p></createRef>
	<createRef label="mahoujin_create_b_04"><p>$1</p></createRef>

	<eval name="i">1</eval>


	<chD><dir type="abs">90</dir><tm>1</tm></chD>
	<chS><sp>0.1*$i</sp><tm>1</tm></chS>
	<w>150</w>

<repeat><times>20</times>

	<!-- 難易度調整用 -->
<!--
	<global name="temp_grank">$__grank</global>
-->
	<chD><dir type="rel">180</dir><tm>1</tm></chD>
	<chS><sp>0.1*$i</sp><tm>1</tm></chS>
	<repeat><times>300</times>
		<w>1</w>
		<repeat><times>$i*($__boss_life-eq0)</times>
			<chS><sp>0</sp><tm>1</tm></chS>
			<eval name="i">0</eval>
		</repeat>
	</repeat>
	<!-- タイマーチェック -->
<!--
	<eval name="time_check2">$_stageplayframe</eval>
	<debugstr><string>midboss2</string></debugstr>
	<debugval><num>$time_check2-$time_check1</num></debugval>
-->
</repeat>
	<w>1</w>
	<chS><sp>0</sp><tm>1</tm></chS>


</action>

<!-- 第１形態用 １面第３形態オマージュ -->
<create label="mahoujin_create_b_01">
	<speed>0</speed>
	<direction type="abs">0</direction>
	<cx>$_self_cx</cx><cy>$_self_cy</cy>
	<vital>1</vital>
	<child>1</child>
	<enemy l="b01_action">
		<score>0</score>
		<inv>0</inv>
		<prate>0</prate>
		<collision type="circle"><cx>-1</cx><cy>-1</cy><radius>0</radius></collision>
		<revengeRef l="b_01_rev"><p>$1</p></revengeRef>

		<definedAction type="synctoparentx"></definedAction>
		<definedAction type="synctoparenty"></definedAction>
		<action>
		
		<actionRef label="enemy_twilight_r_action2"><p>4</p><p>50</p><param>4</param><param>35</param><param>185</param></actionRef>
	
		<eval name="temp">-1</eval>
		<eval name="ch_vital">50</eval> <!-- 元は74 -->
		<eval name="ad_count">0</eval>
		<eval name="item">0</eval>

		<global name="temp_counter">$_counter</global>
		<w>1</w>
		<createRef l="boss_ring"><p>$1</p></createRef>

		<repeat><times>-1</times>
		<!-- 難易度調整用 -->
		<global name="temp_grank">$__grank</global>

		<w>5</w>
		<eval name="temp">-1*$temp</eval>
		<eval name="offset">$temp*(0.5+($__temp_grank-gt0)*0.2+($__temp_grank-gt1)*0.2+($__temp_grank-gt2)*0.6+($__temp_grank-gt3)*0.6+($__temp_grank-gt4)*0.3)</eval>
		<eval name="offset2">0</eval>
		<eval name="sp">2.2+($__temp_grank*0.2)</eval>
		<w>5</w>

		<repeat><times>3</times>
		<aRef l="enemy_bullet_action8"><p>64</p></aRef>
		<repeat><times>6</times>
		<evaladd name="offset2">$offset</evaladd>
		<fireRef l="enemy_fire_b1_02ab"><p>$offset2</p><p>$sp</p></fireRef>
			<repeat><times>5</times>
				<fireRef l="enemy_fire_b1_02s"><p>30</p><p>$sp</p></fireRef>
			</repeat>
			<wait>1</wait>
			<repeat><times>6</times>
				<fireRef l="enemy_fire_b1_02s"><p>30</p><p>$sp</p></fireRef>
			</repeat>
			<wait>4</wait>
		</repeat>
		</repeat>

			<evaladd name="offset2">$offset</evaladd>
			<fireRef l="enemy_fire_b1_02ab"><p>$offset2+15</p><p>$sp</p></fireRef>
			<repeat><times>5</times>
				<fireRef l="enemy_fire_b1_02s"><p>30</p><p>$sp</p></fireRef>
			</repeat>
			<wait>1</wait>
			<repeat><times>6</times>
				<fireRef l="enemy_fire_b1_02s"><p>30</p><p>$sp</p></fireRef>
			</repeat>
			<wait>4</wait>

		<w>10</w>

			<aRef l="enemy_bullet_action8"><p>64</p></aRef>
			<repeat><times>6</times>
			<evaladd name="offset2">$offset*2</evaladd>
			<fireRef l="enemy_fire_b1_02ab"><p>$offset2</p><p>$sp</p></fireRef>
				<repeat><times>5</times>
					<fireRef l="enemy_fire_b1_02s"><p>30</p><p>$sp</p></fireRef>
				</repeat>
				<wait>1</wait>
				<repeat><times>6</times>
					<fireRef l="enemy_fire_b1_02s"><p>30</p><p>$sp</p></fireRef>
				</repeat>
				<wait>4</wait>
			</repeat>

		<w>18</w>

		<eval name="sp">2.0+($__temp_grank*0.2)</eval>
		<eval name="rad">18-($__temp_grank-gt0)*3-($__temp_grank-gt1)*3-($__temp_grank-gt2)*2-($__temp_grank-gt3)-($__temp_grank-gt4)</eval>
		<eval name="rp_tm">10+($__temp_grank-gt0)*2+($__temp_grank-gt1)*3+($__temp_grank-gt2)*3+($__temp_grank-gt3)*2+($__temp_grank-gt4)*2-10</eval>

		<eval name="off">0</eval>
		<repeat><times>3</times>
		<w>2</w>
		<aRef l="enemy_bullet_action8"><p>64</p></aRef>
		<fRef l="enemy_fire_b1_03"><p>-90+$off</p><p>$sp</p></fRef>
		<repeat><times>10</times>
			<w>1</w>
			<fRef l="enemy_fire_b1_03s"><p>$rad</p><p>$sp</p></fRef>
		</repeat>
		<aRef l="enemy_bullet_action8"><p>64</p></aRef>
		<repeat><times>$rp_tm</times>
			<w>1</w>
			<fRef l="enemy_fire_b1_03s"><p>$rad</p><p>$sp</p></fRef>
		</repeat>
		<w>14-$rp_tm</w>
		<evaladd name="off">2.5</evaladd>
		</repeat>


		<!-- 難易度調整用 -->
		<global name="temp_grank">$__grank</global>

		<createRef l="enemy_create_b01"><p>70</p><p>1</p><p>80</p><p>$ch_vital</p><p>($item%10)</p></createRef>
		<createRef l="enemy_create_b01"><p>-70</p><p>-1</p><p>80</p><p>$ch_vital</p><p>(($item+1)%10)</p></createRef>
		<w>20</w>
		<createRef l="enemy_create_b01"><p>10</p><p>1</p><p>30</p><p>$ch_vital</p><p>(($item+2)%10)</p></createRef>
		<createRef l="enemy_create_b01"><p>-10</p><p>-1</p><p>30</p><p>$ch_vital</p><p>(($item+3)%10)</p></createRef>
		<w>10</w>

		<repeat><times>1-($__temp_grank-gt0)</times>
			<w>30</w>
		</repeat>
		<repeat><times>($__temp_grank-gt0)*(1-($__temp_grank-gt3))</times>
			<w>10</w>
			<createRef l="enemy_create_b01"><p>45</p><p>1</p><p>80</p><p>$ch_vital</p><p>0</p></createRef>
			<createRef l="enemy_create_b01"><p>-45</p><p>-1</p><p>80</p><p>$ch_vital</p><p>0</p></createRef>
			<w>20</w>
		</repeat>
		<repeat><times>$__temp_grank-gt3</times>
			<createRef l="enemy_create_b01"><p>70</p><p>1</p><p>80</p><p>$ch_vital</p><p>0</p></createRef>
			<createRef l="enemy_create_b01"><p>-70</p><p>-1</p><p>80</p><p>$ch_vital</p><p>0</p></createRef>
			<w>20</w>
			<createRef l="enemy_create_b01"><p>20</p><p>1</p><p>30</p><p>$ch_vital</p><p>0</p></createRef>
			<createRef l="enemy_create_b01"><p>-20</p><p>-1</p><p>30</p><p>$ch_vital</p><p>0</p></createRef>
			<w>10</w>
		</repeat>
		<evaladd name="ad_count">1</evaladd>
		<add name="item">3</add>
		<eval name="ch_vital">50+($ad_count*40)</eval>
		<w>10</w>

		</repeat>

		</action>
	</enemy>
</create>

<revenge l="b_01_rev">
	<repeat><times>1-($__end_flag-eq2)</times>
		<eval name="localcounter">$_counter</eval>
		<eval name="ttc_end">$_ttc_frame</eval>

		<!-- ランク変動値、クリスタル基本値、赤クリスタル基本値、４倍タイマー -->
		<eval name="rank_inc">3000*($_difficulty+1)</eval>
		<eval name="crystal">(12+$_difficulty*2)</eval>
		<eval name="multi4">1186</eval>
		<eval name="distance">$1</eval>

		<!-- 爆発アクション -->
		<actionRef label="boss_revenge_present_1"></actionRef>

		<!-- アイテムアクション -->
		<wait>1</wait>
		<changeBulletToItem/>
		<addScore><score>500000+($__grank*2000)</score></addScore>

		<eval name="counter_e">$__temp_counter</eval>
		<actionRef label="item_counter_01_boss_stageI_0">
		<param>$crystal</param><param>$counter_e</param><param>$multi4</param><param>24</param><param>$localcounter</param><param>$rank_inc</param><param>$distance</param>
		</actionRef>

		<w>30</w>
	</repeat>
	<vanish/>
</revenge>

<!-- 第２形態用 stageC キラ第１、第２、第５よりオマージュ -->
<create label="mahoujin_create_b_02">
	<speed>0</speed>
	<direction type="abs">0</direction>
	<cx>$_self_cx</cx><cy>$_self_cy</cy>
	<vital>1</vital>
	<child>1</child>
	<enemy l="b02_action">
		<score>0</score>
		<inv>0</inv>
		<prate>0</prate>
		<collision type="circle"><cx>-1</cx><cy>-1</cy><radius>0</radius></collision>

		<revengeRef l="b_02_rev"><p>$1</p></revengeRef>
		<definedAction type="synctoparentx"></definedAction>
		<definedAction type="synctoparenty"></definedAction>
		<action>
		<eval name="i">1</eval>
		<repeat><times>-1*$i</times>
			<eval name="i">1-($__boss_life-eq2)</eval>
			<w>1</w>
		</repeat>
		<global name="temp_counter">$_counter</global>
		<actionRef label="enemy_twilight_r_action2"><p>4</p><p>50</p><param>135</param><param>55</param><param>25</param></actionRef>
		<createRef l="boss_ring2"><p>$1</p></createRef>

		<w>30</w>

		<eval name="ch_vital">76</eval> <!-- 元は 84 -->
		<eval name="ad_vital">45</eval>
		<eval name="item">0</eval>
		<w>1</w>

		<repeat><times>-1</times>

		<!-- 難易度調整用 -->
		<global name="temp_grank">$__grank</global>
		<evaladd name="item">3</evaladd>

		<createRef l="enemy_create_b2_01"><p>90</p><p>($item%11)</p><p>0</p><p>$ch_vital</p></createRef>
		<createRef l="enemy_create_b2_01"><p>-90</p><p>(($item+1)%11)</p><p>0</p><p>$ch_vital</p></createRef>
		<w>50</w>
		<createRef l="enemy_create_b2_01"><p>90</p><p>(($item+2)%11)</p><p>15</p><p>$ch_vital</p></createRef>
		<createRef l="enemy_create_b2_01"><p>-90</p><p>(($item+3)%11)</p><p>15</p><p>$ch_vital</p></createRef>
		<w>50</w>
		<createRef l="enemy_create_b2_01"><p>90</p><p>0</p><p>30</p><p>$ch_vital</p></createRef>
		<createRef l="enemy_create_b2_01"><p>-90</p><p>0</p><p>30</p><p>$ch_vital</p></createRef>
		<add name="ch_vital">$ad_vital</add>
		<w>30</w>

		<!-- 難易度調整用 -->
		<global name="temp_grank">$__grank</global>

		<eval name="sp1">2.2+($__temp_grank*0.2)</eval>
		<eval name="off">18-($__temp_grank-gt1)*3-($__temp_grank-gt1)*2-($__temp_grank-gt2)*3-($__temp_grank-gt3)-($__temp_grank-gt4)</eval>
		<w>10</w>

		<repeat><times>2</times>
			<aRef l="enemy_bullet_action8"><p>64</p></aRef>
			<fRef l="enemy_fire_b_2_01"><p>$sp1</p><p>-8*$off</p></fRef>
			<fRef l="enemy_fire_b_2_01ds"><p>90</p><p>4+($__temp_grank-gt3)</p><p>-90</p><p>$sp1</p></fRef>
			<fRef l="enemy_fire_b_2_01ds"><p>180</p><p>4+($__temp_grank-gt3)</p><p>90</p><p>$sp1</p></fRef>
			<repeat><times>8</times>
			<fRef l="enemy_fire_b_2_01s"><p>$sp1</p><p>90+$off</p></fRef>
			<fRef l="enemy_fire_b_2_01ds"><p>90</p><p>4+($__temp_grank-gt3)</p><p>-90</p><p>$sp1</p></fRef>
			<fRef l="enemy_fire_b_2_01ds"><p>180</p><p>4+($__temp_grank-gt3)</p><p>90</p><p>$sp1</p></fRef>
			<w>3</w>
			</repeat>
			<aRef l="enemy_bullet_action8"><p>64</p></aRef>
			<repeat><times>9</times>
			<fRef l="enemy_fire_b_2_01s"><p>$sp1</p><p>90+$off</p></fRef>
			<fRef l="enemy_fire_b_2_01ds"><p>90</p><p>4+($__temp_grank-gt3)</p><p>-90</p><p>$sp1</p></fRef>
			<fRef l="enemy_fire_b_2_01ds"><p>180</p><p>4+($__temp_grank-gt3)</p><p>90</p><p>$sp1</p></fRef>
			<w>3</w>
			</repeat>
			<w>15</w>
		</repeat>

		<eval name="sp">1.8+($__temp_grank*0.15)</eval>
		<eval name="off">15-($__temp_grank-gt1)*3-($__temp_grank-gt2)*2-($__temp_grank-gt3)*2.5-($__temp_grank-gt4)*1.5</eval>
		<eval name="rp_tm">3+($__temp_grank-gt1)+($__temp_grank-gt2)+($__temp_grank-gt3)*2+($__temp_grank-gt4)*2</eval>

		<w>1</w>
		<repeat><times>2</times>
			<eval name="wt_tm">20</eval>
			<aRef l="enemy_bullet_action8"><p>64</p></aRef>
			<fRef l="enemy_fire_b_2_03"><p>0</p><p>$wt_tm</p><p>1</p><p>$sp</p></fRef>
			<repeat><times>5</times>
				<fRef l="enemy_fire_b_2_03s"><p>60</p><p>$wt_tm</p><p>1</p><p>$sp</p></fRef>
			</repeat>
			<repeat><times>$rp_tm</times>
			<w>1</w>
			<add name="wt_tm">-1</add>
			<fRef l="enemy_fire_b_2_03s"><p>60+$off</p><p>$wt_tm</p><p>1</p><p>$sp</p></fRef>
			<repeat><times>5</times>
				<fRef l="enemy_fire_b_2_03s"><p>60</p><p>$wt_tm</p><p>1</p><p>$sp</p></fRef>
			</repeat>
			</repeat>
			<w>11+(9-$rp_tm)</w>

			<eval name="wt_tm">20</eval>
			<aRef l="enemy_bullet_action8"><p>64</p></aRef>
			<fRef l="enemy_fire_b_2_03"><p>22</p><p>$wt_tm</p><p>-1</p><p>$sp</p></fRef>
			<repeat><times>5</times>
				<fRef l="enemy_fire_b_2_03s"><p>60</p><p>$wt_tm</p><p>-1</p><p>$sp</p></fRef>
			</repeat>
			<repeat><times>$rp_tm</times>
			<w>1</w>
			<add name="wt_tm">-1</add>
			<fRef l="enemy_fire_b_2_03s"><p>60+$off</p><p>$wt_tm</p><p>-1</p><p>$sp</p></fRef>
			<repeat><times>5</times>
				<fRef l="enemy_fire_b_2_03s"><p>60</p><p>$wt_tm</p><p>-1</p><p>$sp</p></fRef>
			</repeat>
			</repeat>
			<w>11+(9-$rp_tm)</w>
		</repeat>

		<!-- 難易度調整用 -->
		<global name="temp_grank">$__grank</global>

		<w>5</w>
		<eval name="off">20-($__temp_grank*2)</eval>

		<aRef l="enemy_bullet_action8"><p>64</p></aRef>
		<fRef l="enemy_fire_b_2_02d"><p>-3*$off</p></fRef>
		<repeat><times>6</times>
			<w>6</w>
			<fRef l="enemy_fire_b_2_02ds"><p>$off</p></fRef>
		</repeat>
		<w>25</w>

		<aRef l="enemy_bullet_action8"><p>64</p></aRef>
		<fRef l="enemy_fire_b_2_02d"><p>-3*$off</p></fRef>
		<repeat><times>6</times>
			<w>6</w>
			<fRef l="enemy_fire_b_2_02ds"><p>$off</p></fRef>
		</repeat>
		<w>25</w>

		<aRef l="enemy_bullet_action8"><p>64</p></aRef>
		<fRef l="enemy_fire_b_2_02d"><p>-3*$off</p></fRef>
		<repeat><times>6</times>
			<w>6</w>
			<fRef l="enemy_fire_b_2_02ds"><p>$off</p></fRef>
		</repeat>
		<w>25</w>

		</repeat>

		</action>
	</enemy>
</create>

<revenge l="b_02_rev">
	<repeat><times>1-($__end_flag-eq2)</times>
		<eval name="localcounter">$_counter</eval>
		<eval name="ttc_end">$_ttc_frame</eval>

		<!-- ランク変動値、クリスタル基本値、赤クリスタル基本値、４倍タイマー -->
		<eval name="rank_inc">3000*($_difficulty+1)</eval>
		<eval name="crystal">(14+$_difficulty*2)</eval>
		<eval name="multi4">1186</eval>
		<eval name="distance">$1</eval>


		<!-- 爆発アクション -->
		<actionRef label="boss_revenge_present_1"></actionRef>

		<!-- アイテムアクション -->
		<wait>1</wait>
		<changeBulletToItem/>
		<addScore><score>530000+($__grank*20000)</score></addScore>

		<eval name="counter_e">$__temp_counter</eval>
		<actionRef label="item_counter_01_boss_stageI_0">
		<param>$crystal</param><param>$counter_e</param><param>$multi4</param><param>24</param><param>$localcounter</param><param>$rank_inc</param><param>$distance</param>
		</actionRef>

		<w>30</w>
	</repeat>
	<vanish/>
</revenge>

<!-- 第３形態用 stageE第１および第３より -->
<create label="mahoujin_create_b_03">
	<speed>0</speed>
	<direction type="abs">0</direction>
	<cx>$_self_cx</cx><cy>$_self_cy</cy>
	<vital>1</vital>
	<child>1</child>
	<enemy l="b03_action">
		<score>0</score>
		<inv>0</inv>
		<prate>0</prate>
		<collision type="circle"><cx>-1</cx><cy>-1</cy><radius>0</radius></collision>
		<revengeRef l="b_03_rev"><p>$1</p></revengeRef>
		<definedAction type="synctoparentx"></definedAction>
		<definedAction type="synctoparenty"></definedAction>
		<action>
			<eval name="i">1</eval>
			<repeat><times>-1*$i</times>
				<eval name="i">1-($__boss_life-eq1)</eval>
				<w>1</w>
			</repeat>
			<global name="temp_counter">$_counter</global>
			<actionRef label="enemy_twilight_r_action2"><p>4</p><p>50</p><param>25</param><param>135</param><param>25</param></actionRef>
			<createRef l="boss_ring3"><p>$1</p></createRef>
			<w>30</w>

			<repeat><times>-1</times>
			<!-- 難易度調整用 -->
			<global name="temp_grank">$__grank</global>

			<repeat><times>3</times>
			<eval name="sp">2.5-($__temp_grank*0.1)</eval>
			<eval name="off">($_player_cx+$_player_cy+$_self_cx)%13</eval>
			<w>1</w>

			<fRef l="enemy_fire_b_03_1ab"><p>39</p><p>$sp</p></fRef>
			<fRef l="enemy_fire_b_03_1ab"><p>135</p><p>$sp</p></fRef>
			<fRef l="enemy_fire_b_03_1ab"><p>225</p><p>$sp</p></fRef>
			<fRef l="enemy_fire_b_03_1ab"><p>315</p><p>$sp</p></fRef>
			<w>69</w>
			</repeat>
			<w>110</w>
			
			<!-- 難易度調整用 -->
			<global name="temp_grank">$__grank</global>

			<eval name="sp">3.8+($__temp_grank*0.2)+($__temp_grank-gt3)*0.2</eval>
			<eval name="sp1">3+($__temp_grank*0.2)</eval>
			<eval name="dir">100-($__temp_grank-gt3)*30</eval>
			<eval name="dir2">17-($__temp_grank-gt3)*3-($__temp_grank-gt4)*2</eval>

			<w>2</w>

			<aRef l="enemy_bullet_action8"><p>64</p></aRef>
			<cRef l="enemy_fire_b_03_3d"><p>-1.5*$dir</p><p>$sp</p><p>$sp1</p></cRef>
			<w>1</w>
			<cRef l="enemy_fire_b_03_3ds"><p>$dir</p><p>$sp</p><p>$sp1</p></cRef>
			<w>5</w>
			<evaladd name="sp">-0.2</evaladd>
			<repeat><times>4</times>
				<cRef l="enemy_fire_b_03_3ds"><p>-1*$dir+$dir2</p><p>$sp</p><p>$sp1</p></cRef>
				<w>1</w>
				<cRef l="enemy_fire_b_03_3ds"><p>$dir</p><p>$sp</p><p>$sp1</p></cRef>
				<w>5</w>
				<evaladd name="sp">-0.2</evaladd>
			</repeat>

			<aRef l="enemy_bullet_action8"><p>64</p></aRef>
			<repeat><times>5</times>
				<cRef l="enemy_fire_b_03_3ds"><p>-1*$dir+$dir2</p><p>$sp</p><p>$sp1</p></cRef>
				<w>1</w>
				<cRef l="enemy_fire_b_03_3ds"><p>$dir</p><p>$sp</p><p>$sp1</p></cRef>
				<w>5</w>
				<evaladd name="sp">-0.2</evaladd>
			</repeat>

			<eval name="rp_tm">($__temp_grank-gt0)+($__temp_grank-gt1)</eval>
			<aRef l="enemy_bullet_action8"><p>64</p></aRef>
			<repeat><times>1+$rp_tm</times>
				<cRef l="enemy_fire_b_03_3ds"><p>-1*$dir+$dir2</p><p>$sp</p><p>$sp1</p></cRef>
				<w>1</w>
				<cRef l="enemy_fire_b_03_3ds"><p>$dir</p><p>$sp</p><p>$sp1</p></cRef>
				<w>5</w>
				<evaladd name="sp">-0.2</evaladd>
			</repeat>
			<w>13-$rp_tm*6</w>

			<eval name="sp">3.8+($__temp_grank*0.2)+($__temp_grank-gt3)*0.2</eval>
			<eval name="dir">-120+($__temp_grank-gt3)*30</eval>
			<eval name="dir2">-17+($__temp_grank-gt3)*3+($__temp_grank-gt4)*2</eval>

			<aRef l="enemy_bullet_action8"><p>64</p></aRef>
			<cRef l="enemy_fire_b_03_3d"><p>-1.5*$dir</p><p>$sp</p><p>$sp1</p></cRef>
			<w>1</w>
			<cRef l="enemy_fire_b_03_3ds"><p>$dir</p><p>$sp</p><p>$sp1</p></cRef>
			<w>5</w>
			<evaladd name="sp">-0.2</evaladd>
			<repeat><times>4</times>
				<cRef l="enemy_fire_b_03_3ds"><p>-1*$dir+$dir2</p><p>$sp</p><p>$sp1</p></cRef>
				<w>1</w>
				<cRef l="enemy_fire_b_03_3ds"><p>$dir</p><p>$sp</p><p>$sp1</p></cRef>
				<w>5</w>
				<evaladd name="sp">-0.2</evaladd>
			</repeat>

			<aRef l="enemy_bullet_action8"><p>64</p></aRef>
			<repeat><times>5</times>
				<cRef l="enemy_fire_b_03_3ds"><p>-1*$dir+$dir2</p><p>$sp</p><p>$sp1</p></cRef>
				<w>1</w>
				<cRef l="enemy_fire_b_03_3ds"><p>$dir</p><p>$sp</p><p>$sp1</p></cRef>
				<w>5</w>
				<evaladd name="sp">-0.2</evaladd>
			</repeat>

			<eval name="rp_tm">($__temp_grank-gt0)+($__temp_grank-gt1)</eval>
			<aRef l="enemy_bullet_action8"><p>64</p></aRef>
			<repeat><times>1+$rp_tm</times>
				<cRef l="enemy_fire_b_03_3ds"><p>-1*$dir+$dir2</p><p>$sp</p><p>$sp1</p></cRef>
				<w>1</w>
				<cRef l="enemy_fire_b_03_3ds"><p>$dir</p><p>$sp</p><p>$sp1</p></cRef>
				<w>5</w>
				<evaladd name="sp">-0.2</evaladd>
			</repeat>
			<w>13-$rp_tm*6</w>
			</repeat>

		</action>
	</enemy>
</create>


<revenge l="b_03_rev">
	<repeat><times>1-($__end_flag-eq2)</times>
		<eval name="localcounter">$_counter</eval>
		<eval name="ttc_end">$_ttc_frame</eval>

		<!-- ランク変動値、クリスタル基本値、赤クリスタル基本値、４倍タイマー -->
		<eval name="rank_inc">3000*($_difficulty+1)</eval>
		<eval name="crystal">(14+$_difficulty*2)</eval>
		<eval name="multi4">1186</eval>
		<eval name="distance">$1</eval>


		<!-- 爆発アクション -->
		<actionRef label="boss_revenge_present_1"></actionRef>

		<!-- アイテムアクション -->
		<wait>1</wait>
		<changeBulletToItem/>
		<addScore><score>560000+($__grank*25000)</score></addScore>

		<eval name="counter_e">$__temp_counter</eval>
		<actionRef label="item_counter_01_boss_stageI_0">
		<param>$crystal</param><param>$counter_e</param><param>$multi4</param><param>24</param><param>$localcounter</param><param>$rank_inc</param><param>$distance</param>
		</actionRef>

		<w>30</w>
	</repeat>
	<vanish/>
</revenge>


<!-- 第４形態用 stageG3最終形態より -->
<create label="mahoujin_create_b_04">
	<speed>0</speed>
	<direction type="abs">0</direction>
	<cx>$_self_cx</cx><cy>$_self_cy</cy>
	<vital>1</vital>
	<child>1</child>
	<enemy l="b04_action">
		<score>0</score>
		<inv>0</inv>
		<prate>0</prate>
		<collision type="circle"><cx>-1</cx><cy>-1</cy><radius>0</radius></collision>
		<revengeRef l="b_04_rev"><p>$1</p></revengeRef>
		<definedAction type="synctoparentx"></definedAction>
		<definedAction type="synctoparenty"></definedAction>
		<action>

			<eval name="i">1</eval>
			<repeat><times>-1*$i</times>
				<eval name="i">1-($__boss_life-eq0)</eval>
				<w>1</w>
			</repeat>

			<eval name="dir">1</eval>
			<global name="temp_counter">$_counter</global>
			<actionRef label="enemy_twilight_r_action3"><p>4</p><p>50</p><param>95</param><param>95</param><param>95</param></actionRef>
			<createRef l="boss_ring4"><p>$1</p></createRef>
			<w>20</w>

			<repeat><times>-1</times>
			<!-- 難易度調整用 -->
			<global name="temp_grank">$__grank</global>

			<repeat><times>$__temp_grank-eq0</times>
				<aRef l="mahoujin_create_b_04_act0"><p>$dir</p></aRef>
			</repeat>
			<repeat><times>$__temp_grank-eq1</times>
				<aRef l="mahoujin_create_b_04_act1"><p>$dir</p></aRef>
			</repeat>
			<repeat><times>$__temp_grank-gt1</times>
				<aRef l="mahoujin_create_b_04_act2"><p>$dir</p></aRef>
			</repeat>

			<eval name="dir">-1*$dir</eval>

			<w>165</w>
			</repeat>

		</action>
	</enemy>
</create>

<a l="mahoujin_create_b_04_act0">
	<eval name="color">0</eval>
	<cRef label="enemy_laser_create_b_04"><p>-120</p><p>$color</p></cRef>
	<repeat><times>44</times>
		<w>2</w>
		<eval name="color">($color+1)%7</eval>
		<cRef label="enemy_laser_create_b_04s"><p>8</p><p>$color</p></cRef>
	</repeat>

	<eval name="sp">1.0+($__temp_grank*0.1)</eval>
	<eval name="wt_tm">18-($__temp_grank*2)</eval>
	<w>1</w>
	<fRef l="enemy_fire_b_04_1ds"><p>-56</p><p>$color</p><p>$sp</p><p>$wt_tm</p><p>$1</p></fRef>
	<repeat><times>7</times>
		<w>2</w>
		<eval name="color">($color+1)%7</eval>
		<fRef l="enemy_fire_b_04_1ds"><p>8</p><p>$color</p><p>$sp</p><p>$wt_tm</p><p>$1</p></fRef>
	</repeat>
	<eval name="color">-1</eval>
	<repeat><times>37</times>
		<w>2</w>
		<eval name="color">($color+1)%7</eval>
		<fRef l="enemy_fire_b_04_1ds"><p>8</p><p>$color</p><p>$sp</p><p>$wt_tm</p><p>$1</p></fRef>
	</repeat>

</a>

<a l="mahoujin_create_b_04_act1">
	<eval name="color">0</eval>
	<cRef label="enemy_laser_create_b_04"><p>-144</p><p>$color</p></cRef>
	<repeat><times>49</times>
		<w>2</w>
		<eval name="color">($color+1)%7</eval>
		<cRef label="enemy_laser_create_b_04s"><p>7.2</p><p>$color</p></cRef>
	</repeat>

	<eval name="sp">1.0+($__temp_grank*0.1)</eval>
	<eval name="wt_tm">18-($__temp_grank*2)</eval>
	<w>1</w>
	<fRef l="enemy_fire_b_04_1ds"><p>-50.4</p><p>$color</p><p>$sp</p><p>$wt_tm</p><p>$1</p></fRef>
	<repeat><times>7</times>
		<w>2</w>
		<eval name="color">($color+1)%7</eval>
		<fRef l="enemy_fire_b_04_1ds"><p>7.2</p><p>$color</p><p>$sp</p><p>$wt_tm</p><p>$1</p></fRef>
	</repeat>
	<eval name="color">-1</eval>
	<repeat><times>42</times>
		<w>2</w>
		<eval name="color">($color+1)%7</eval>
		<fRef l="enemy_fire_b_04_1ds"><p>7.2</p><p>$color</p><p>$sp</p><p>$wt_tm</p><p>$1</p></fRef>
	</repeat>

</a>


<a l="mahoujin_create_b_04_act2">
	<eval name="color">0</eval>
	<cRef label="enemy_laser_create_b_04"><p>-120</p><p>$color</p></cRef>
	<repeat><times>59</times>
		<w>2</w>
		<eval name="color">($color+1)%7</eval>
		<cRef label="enemy_laser_create_b_04s"><p>6</p><p>$color</p></cRef>
	</repeat>

	<eval name="sp">1.0+($__temp_grank*0.1)+($__temp_grank-gt3)*0.1</eval>
	<eval name="wt_tm">16-$__temp_grank-($__temp_grank-gt3)</eval>
	<w>1</w>
	<fRef l="enemy_fire_b_04_1ds"><p>-42</p><p>$color</p><p>$sp</p><p>$wt_tm</p><p>$1</p></fRef>
	<repeat><times>7</times>
		<w>2</w>
		<eval name="color">($color+1)%7</eval>
		<fRef l="enemy_fire_b_04_1ds"><p>6</p><p>$color</p><p>$sp</p><p>$wt_tm</p><p>$1</p></fRef>
	</repeat>
	<eval name="color">-1</eval>
	<repeat><times>52</times>
		<w>2</w>
		<eval name="color">($color+1)%7</eval>
		<fRef l="enemy_fire_b_04_1ds"><p>6</p><p>$color</p><p>$sp</p><p>$wt_tm</p><p>$1</p></fRef>
	</repeat>

</a>

<revenge l="b_04_rev">
	<!-- 本体を壊すためなし　-->
	<vanish/>
</revenge>



<!-- ********************************************************************* -->
<!-- *** ボスのリベンジ　第１形態                                    *** -->
<!-- ***                                                               *** -->

<revenge label="stage_main_boss_01_revenge">
	<eval name="localcounter">$_counter</eval>
	<eval name="ttc_end">$_ttc_frame</eval>

	<!-- ランク変動値、ボーナススピリット、スピリット桁数、クリスタル基本値、赤クリスタル基本値、４倍タイマー -->
	<eval name="rank_inc">7500*($_difficulty+1)</eval>
	<eval name="crystal">(40+$_difficulty*2)</eval>
	<eval name="red_crystal">60</eval>
	<eval name="multi4">5000</eval>
	<eval name="distance">$1</eval>

	<!-- Enemy Magic Break -->
	<eval name="emb_prate">-999999</eval>
	<eval name="emb_score">1000000+($__grank-gt3)*100000+($__grank-gt4)*100000</eval>

	<targetRevenge label="boss_vital2_3"></targetRevenge>
	<targetRevenge label="boss_life2"></targetRevenge>
	<targetRevenge label="stage_boss_timer_fig"></targetRevenge>

	<changeSpeed>
		<speed>0</speed><tm>1</tm>
	</changeSpeed>

	<repeat><times>$__end_flag-eq1</times>
	<!-- 爆発アクション -->
	<actionRef label="boss_revenge_present_4"></actionRef>
	<actionRef l="bg_bossbossend_action"></actionRef>
	<presentRef label="stage_middle_boss_revnege_present_01"></presentRef>

	<!-- *** 弾幕のアイテム化 *** -->
	<!-- *** 自爆の場合は、弾けし *** -->
	<wait>1</wait>
	<changeBulletToItem/>
	<addScore><score>1000000+200000*$__grank</score></addScore>

	<wait>1</wait>

		<!-- *** ノーミスノーボムチェック *** -->

		<actionRef label="emb_letter3"></actionRef>

		<eval name="etb_j">(($ttc_end-$__ttc_start)-eq($localcounter-$__counter_tmp))</eval>
		<repeat><times>$etb_j</times>
			<addScore><score>$emb_score</score></addScore>
			<sysvar name="tbchain">$_tbchain+1</sysvar>
			<addRank><num>$rank_inc</num></addRank>
		</repeat>

		<eval name="counter_e">$__counter_tmp</eval>
		<actionRef label="item_counter_01_boss_stageI">
		<param>$crystal</param><param>$counter_e</param><param>$multi4</param><param>24</param><param>$localcounter+999999*(1-($__miss_temp-eq$_stagemisscount))</param><param>$rank_inc</param><param>$distance</param>
		</actionRef>
		<addPRate><num>$emb_prate</num></addPRate>

	<wait>60</wait>

	<actionRef label="stage_main_boss_final_revenge_action"/>
	<!-- *** 最後に自殺 *** -->
	<vanish></vanish>	

	</repeat>

	<repeat><times>1-($__end_flag-eq1)</times>
		<create>
			<speed>0</speed><direction>0</direction>
			<cx>320</cx><cy>240</cy><vital>0</vital>
			<bombRef label="bomb_clearbomb"></bombRef>
		</create>
		<w>1</w>
		<eval name="temp_prate">999999-($_prate+$red_crystal*300)</eval>
		<addRank><num>-2*$rank_inc</num></addRank>
		<actionRef label="item_counter_01_red_stageI"><param>$red_crystal</param></actionRef>
		<w>30</w>
		<global name="prate_check">1</global>
		<addPRate><num>$temp_prate</num></addPRate>
		<w>10</w>
		<!-- エンディング判定用フラグ -->
		<global name="saki_timeout">1</global>
		<actionRef label="stage_main_boss_final_revenge_action"/>
	</repeat>
</revenge>



<!-- ********************************************************************* -->
<!-- *** ボスのリベンジ・サブアクション　最終形態                    *** -->
<!-- ***                                                               *** -->
<action label="stage_main_boss_final_revenge_action">

	<!-- 画像の後始末 -->
<!--	<targetRevenge label="boss_life"></targetRevenge>
	<targetRevenge label="stage_boss_timer_fig"></targetRevenge>
	<targetRevenge label="namebox"></targetRevenge>
-->
	<!-- *** ボス戦ロックを解除 *** -->
	<releaseLock><num>10</num></releaseLock>

</action>
	
</exbulletml>
