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

<!-- ********************************************************************* -->
<!-- *** 中ボス戦                                                      *** -->
<!-- ***                                                               *** -->

<action label="stage_middle_boss_action">

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

	<!-- *** デバッグ用secret *** -->
<!--
	<global name="boss_secret">0</global>
-->
	<!-- *** 最初のボスオブジェクト作成 *** -->
	<!-- ｘ座標、y座標、体力、inv、スコア、侵食率 -->
	<createRef label="enemy_create_middle_boss">
		<p>380</p>
		<p>-12</p>
		<p>13500+$__grank*200</p>
		<p>0</p>
		<p>95000+$__grank*2000</p>
		<p>$__middle_boss_prate</p>
	</createRef>
	<wait>1</wait>

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

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

</action>

<!-- ********************************************************************* -->
<!-- *** 中ボスオブジェクト作成                                        *** -->
<!-- ***                                                               *** -->
<create label="enemy_create_middle_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>
	<enemyRef label="enemy_middle_boss"></enemyRef>
</create>

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

	<collision type="circle"><cx>-1</cx><cy>-1</cy><radius>0</radius></collision>
	<presentRef label="stage_middle_boss_present_01"></presentRef>

	<!-- *** VITAL ゲージはボスの子オブジェクトなのでここで作成 *** -->
	<createRef label="boss_vital_create"></createRef>

	<!-- *** 画面下のボス表示を作成 *** -->
	<createRef label="boss_underbar_create"></createRef>

	<!-- タイマー差分初期化 -->
	<global name="end_offset">0</global>
	<global name="end_flag">0</global>
<!--
	<debugstr><string>ecrystal2</string></debugstr>
	<debugval><num>$_ecrystal2</num></debugval>
-->
	<!-- *** 第 N 形態ごとのアクション *** -->
	<repeat><times>$__boss_state-eq1</times>
		<eval name="cross_over">80</eval>
		<revengeRef label="stage_middle_boss_01_revenge"><p>$cross_over</p></revengeRef>

		<global name="timer">12</global>
		<global name="timerwait">230</global>
		<actionRef  label="create_timer0"></actionRef>
		<actionRef  label="stage_middle_boss_01_action"><p>$cross_over</p></actionRef> 
	</repeat>

	<repeat><times>$__boss_state-eq2*(1-$__boss_secret)</times>
		<aRef l="p_avrage_add"/>
		<eval name="cross_over">90</eval>
		<revengeRef label="stage_middle_boss_02_revenge"><p>$cross_over</p></revengeRef>

		<global name="timer">12</global>
		<global name="timerwait">225</global>
<!--		<actionRef  label="create_timer"></actionRef> -->
		<actionRef  label="stage_middle_boss_02_action"><p>$cross_over</p></actionRef> 
	</repeat>

	<repeat><times>$__boss_state-eq2*$__boss_secret</times>
		<aRef l="p_avrage_add"/>
		<eval name="cross_over">100</eval>
		<revengeRef label="stage_middle_boss_03_revenge"><p>$cross_over</p></revengeRef>

		<global name="timer">12</global>
		<global name="timerwait">220</global>
<!--		<actionRef  label="create_timer"></actionRef> -->
		<actionRef  label="stage_middle_boss_03_action"><p>$cross_over</p></actionRef> 
	</repeat>

</enemy>


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

<action  label="stage_middle_boss_01_action">
	<changeSpeed>
		<speed>4</speed><tm>0</tm>
	</changeSpeed>
	<changeDirection>
		<dir type="abs">221</dir><tm>0</tm>
	</changeDirection>
	<wait>34</wait>


	<changeSpeed>
		<speed>0</speed><tm>40</tm>
	</changeSpeed>
	<wait>45</wait>

	<collision type="circle"><cx>-1</cx><cy>-1</cy><radius>20</radius></collision>
	<createRef l="boss_ring"><p>$1</p></createRef>

	<!-- 弾幕開始 -->
	<actionRef label="start_boss_bullet"/>
	<eval name="ch_vital">76</eval> <!-- 元は 84 -->
	<eval name="ad_vital">120</eval>
	<eval name="ad_count">0</eval>


<repeat><times>3</times>
<!--
	<debugstr><string>midboss1_place1</string></debugstr>
	<debugval><num>$_self_cx</num></debugval>
	<debugval><num>$_self_cy</num></debugval>
-->
	<!-- タイマーチェック -->
	<eval name="time_check1">$_stageplayframe</eval>
	<!-- 難易度調整用 -->
	<global name="temp_grank">$__grank</global>


	<!-- 通り雨 -->
	<aRef l="enemy_bullet_action4"><p>64</p></aRef>
	<fRef l="enemy_fire_mb_01ab"><p>90</p><p>5.0</p></fRef>
	<fRef l="enemy_fire_mb_01s"><p>0</p><p>3.7</p></fRef>
	<w>1</w>
	<fRef l="enemy_fire_mb_01s"><p>0</p><p>2.4</p></fRef>
	<fRef l="enemy_fire_mb_01s"><p>0</p><p>1.1</p></fRef>

	<w>90</w>

	<chD><dir type="absolute">90</dir><tm>1</tm></chD>
	<chS><sp type="absolute">2</sp><tm>20</tm></chS>
	<w>80</w>
	<chS><sp type="absolute">0</sp><tm>20</tm></chS>
	<w>70</w>

	<aRef l="enemy_bullet_action4"><p>64</p></aRef>
	<fRef l="enemy_fire_mb_01ab"><p>-90</p><p>5.0</p></fRef>
	<fRef l="enemy_fire_mb_01s"><p>0</p><p>3.7</p></fRef>
	<w>1</w>
	<fRef l="enemy_fire_mb_01s"><p>0</p><p>2.4</p></fRef>
	<fRef l="enemy_fire_mb_01s"><p>0</p><p>1.1</p></fRef>
	<w>120</w>
<!--
	<debugstr><string>midboss1_place2</string></debugstr>
	<debugval><num>$_self_cx</num></debugval>
	<debugval><num>$_self_cy</num></debugval>
-->
	<chD><dir type="absolute">-79</dir><tm>1</tm></chD>
	<chS><sp type="absolute">1.8</sp><tm>20</tm></chS>
	<w>45</w>
	<chS><sp type="absolute">0</sp><tm>20</tm></chS>
	<w>90</w>
<!--
	<debugstr><string>midboss1_place3</string></debugstr>
	<debugval><num>$_self_cx</num></debugval>
	<debugval><num>$_self_cy</num></debugval>
-->
	<!-- 雑魚＋ばらまき -->
	<createRef l="enemy_create_mb1_01"><p>115</p><p>0</p><p>20</p><p>$ch_vital</p></createRef>
	<createRef l="enemy_create_mb1_01"><p>-115</p><p>0</p><p>20</p><p>$ch_vital</p></createRef>
	<w>3</w>
	<createRef l="enemy_create_mb1_01"><p>135</p><p>0</p><p>15</p><p>$ch_vital</p></createRef>
	<createRef l="enemy_create_mb1_01"><p>-135</p><p>0</p><p>15</p><p>$ch_vital</p></createRef>
	<w>45</w>
	<repeat><times>$__temp_grank-lt3</times>
	<w>45</w>
	</repeat>
	<repeat><times>($__temp_grank-eq3)*3</times>
		<aRef l="enemy_bullet_action8"><p>32</p></aRef>
		<fRef l="enemy_fire_mb_3ab"><p>170-(($_player_cx+$_player_cy)%21)</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>45</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>-90</p></fRef>
		<w>15</w>
	</repeat>
	<repeat><times>($__temp_grank-gt3)*5</times>
		<aRef l="enemy_bullet_action8"><p>32</p></aRef>
		<fRef l="enemy_fire_mb_3ab"><p>170-(($_player_cx+$_player_cy)%21)</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>-60</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>30</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>30</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>30</p></fRef>
		<w>9</w>
	</repeat>

	<createRef l="enemy_create_mb1_01"><p>115</p><p>0</p><p>20</p><p>$ch_vital</p></createRef>
	<createRef l="enemy_create_mb1_01"><p>-115</p><p>0</p><p>20</p><p>$ch_vital</p></createRef>
	<w>3</w>
	<createRef l="enemy_create_mb1_01"><p>135</p><p>0</p><p>15</p><p>$ch_vital</p></createRef>
	<createRef l="enemy_create_mb1_01"><p>-135</p><p>0</p><p>15</p><p>$ch_vital</p></createRef>

	<evaladd name="ad_count">1</evaladd>
	<eval name="ch_vital">76+$ad_count*$ad_vital</eval>

	<w>45</w>
	<repeat><times>$__temp_grank-lt3</times>
	<w>45</w>
	</repeat>
	<repeat><times>($__temp_grank-eq3)*3</times>
		<aRef l="enemy_bullet_action8"><p>32</p></aRef>
		<fRef l="enemy_fire_mb_3ab"><p>170-(($_player_cx+$_player_cy)%21)</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>45</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>-90</p></fRef>
		<w>15</w>
	</repeat>
	<repeat><times>($__temp_grank-gt3)*5</times>
		<aRef l="enemy_bullet_action8"><p>32</p></aRef>
		<fRef l="enemy_fire_mb_3ab"><p>170-(($_player_cx+$_player_cy)%21)</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>-60</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>30</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>30</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>30</p></fRef>
		<w>5</w>
		<fRef l="enemy_fire_mb_3s"><p>30</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>-110</p></fRef>
		<fRef l="enemy_fire_mb_3s"><p>55</p></fRef>
		<w>4</w>
	</repeat>
	<w>30</w>
	
	<!-- 下方向ばらまき -->
	<aRef l="enemy_bullet_action4"><p>64</p></aRef>
	<repeat><times>$__temp_grank-gt2</times>
		<fRef l="enemy_fire_mb_04ab"><p>45+($__temp_grank-eq1)*8+($__temp_grank-eq0)*15</p><p>13</p></fRef>
		<fRef l="enemy_fire_mb_04ab"><p>-45-($__temp_grank-eq1)*8-($__temp_grank-eq0)*15</p><p>13</p></fRef>
	</repeat>
	<repeat><times>$__temp_grank-lt3</times>
		<fRef l="enemy_fire_mb_04ab"><p>0</p><p>15</p></fRef>
	</repeat>

	<w>1</w>
	<repeat><times>$__temp_grank-gt3</times>
		<fRef l="enemy_fire_mb_04ab"><p>67.5</p><p>19</p></fRef>
		<fRef l="enemy_fire_mb_04ab"><p>-67.5</p><p>19</p></fRef>
	</repeat>
	<w>1</w>
	<repeat><times>$__temp_grank-gt1</times>
		<fRef l="enemy_fire_mb_04ab"><p>70</p><p>25</p></fRef>
		<fRef l="enemy_fire_mb_04ab"><p>-70</p><p>25</p></fRef>
	</repeat>
	
	<w>20</w>

	<chD><dir type="absolute">-101</dir><tm>1</tm></chD>
	<chS><sp type="absolute">1.8</sp><tm>20</tm></chS>
	<w>45</w>
	<chS><sp type="absolute">0</sp><tm>20</tm></chS>
	<w>120</w>

	<!-- タイマーチェック -->
<!--
	<eval name="time_check2">$_stageplayframe-$time_check1</eval>
	<debugstr><string>midboss1</string></debugstr>
	<debugval><num>$time_check2</num></debugval>
	<debugstr><string>midboss1_place2</string></debugstr>
	<debugval><num>$_self_cx</num></debugval>
	<debugval><num>$_self_cy</num></debugval>
-->

</repeat>
<global name="end_flag">1</global>
<wait>120</wait>

</action>



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

<action  label="stage_middle_boss_02_action">

<!-- センターポイントへ移動 -->
	<changeSpeed>
		<speed type="absolute">2</speed><term>25</term>
	</changeSpeed>

	<changePosition type="center">
		<x>320</x><y>140</y>
	</changePosition>
	<changeSpeed>
		<speed type="absolute">0</speed><term>2</term>
	</changeSpeed>

	<wait>2</wait>

	<collision type="circle"><cx>-1</cx><cy>-1</cy><radius>20</radius></collision>
	<createRef l="boss_ring"><p>$1</p></createRef>

	<!-- 弾幕開始 -->
	<actionRef label="start_boss_bullet"/>

	<wait>1</wait>

	<global name="st2_m_flag_blue">0</global>
	<global name="st2_m_flag_red">0</global>
	<createRef label="watcher"></createRef>

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

	<!-- タイマーチェック -->
	<eval name="time_check1">$_stageplayframe</eval>

	<repeat><times>($__st2_m_flag_blue-eq0)</times>
		<createRef l="enemy_create_m01"><p>70</p></createRef>
		<createRef l="enemy_create_m01"><p>-70</p></createRef>
		<global name="st2_m_flag_blue">$__st2_m_flag_blue+1</global>
	</repeat>

	<w>60</w>
	<aRef l="enemy_bullet_action8"><p>64</p></aRef>
	<fRef l="enemy_fire_mb_2_02"><p>60-(($_prate+$_player_cx)%11)</p></fRef>
	<repeat><times>4+($__temp_grank-gt2)</times>
		<fRef l="enemy_fire_mb_2_02s"><p>20-($__temp_grank-gt2)*4</p></fRef>
	</repeat>
	<w>5</w>
	<repeat><times>5+($__temp_grank-gt3)*2+($__temp_grank-gt4)*2</times>
		<fRef l="enemy_fire_mb_2_02s"><p>-80</p></fRef>
		<repeat><times>4+($__temp_grank-gt2)</times>
			<fRef l="enemy_fire_mb_2_02s"><p>20-($__temp_grank-gt2)*4</p></fRef>
		</repeat>
		<w>5</w>
	</repeat>

	<repeat><times>($__st2_m_flag_red-eq0)*($__temp_grank-gt2)</times>
		<createRef l="enemy_create_m01_2"><p>70</p></createRef>
		<createRef l="enemy_create_m01_2"><p>-70</p></createRef>
		<global name="st2_m_flag_red">$__st2_m_flag_red+1</global>
	</repeat>

	<chS><sp type="abs">0.8</sp><tm>20</tm></chS>
	<chD><dir type="abs">80-160*(($_player_cx+$_player_cy)%2)</dir><tm>1</tm></chD>
	<w>20</w>
	<chS><sp type="abs">0</sp><tm>20</tm></chS>

	<w>110-($__temp_grank-gt3)*10-($__temp_grank-gt4)*10</w>

	<aRef l="enemy_bullet_action8"><p>64</p></aRef>
	<fRef l="enemy_fire_mb_2_02"><p>-55-(($_prate+$_player_cy)%11)</p></fRef>
	<repeat><times>4+($__temp_grank-gt2)</times>
		<fRef l="enemy_fire_mb_2_02s"><p>-20+($__temp_grank-gt2)*4</p></fRef>
	</repeat>
	<w>5</w>
	<repeat><times>5+($__temp_grank-gt3)*2+($__temp_grank-gt4)*2</times>
		<fRef l="enemy_fire_mb_2_02s"><p>80</p></fRef>
		<repeat><times>4+($__temp_grank-gt2)</times>
			<fRef l="enemy_fire_mb_2_02s"><p>-20+($__temp_grank-gt2)*4</p></fRef>
		</repeat>
		<w>5</w>
	</repeat>

	<w>180-($__temp_grank-gt3)*10-($__temp_grank-gt4)*10</w>

	<aRef l="enemy_bullet_action8"><p>64</p></aRef>
	<fRef l="enemy_fire_mb_2_02a"><p>-5+(($_player_cx*3+$_prate)%11)</p></fRef>
	<repeat><times>7+($__temp_grank-gt2)-($__temp_grank-lt2)*2</times>
		<fRef l="enemy_fire_mb_2_02s"><p>45-($__temp_grank-gt2)*5+($__temp_grank-lt2)*15</p></fRef>
	</repeat>
	<w>4</w>
	<repeat><times>3+($__temp_grank-gt3)*2+($__temp_grank-gt4)*3</times>
		<fRef l="enemy_fire_mb_2_02s"><p>45+13-($__temp_grank-gt2)*5+($__temp_grank-lt2)*15</p></fRef>
		<repeat><times>7+($__temp_grank-gt2)-($__temp_grank-lt2)*2</times>
			<fRef l="enemy_fire_mb_2_02s"><p>45-($__temp_grank-gt2)*5+($__temp_grank-lt2)*15</p></fRef>
		</repeat>
		<w>4</w>
		<fRef l="enemy_fire_mb_2_02s"><p>45+16-($__temp_grank-gt2)*5+($__temp_grank-lt2)*15</p></fRef>
		<repeat><times>7+($__temp_grank-gt2)-($__temp_grank-lt2)*2</times>
			<fRef l="enemy_fire_mb_2_02s"><p>45-($__temp_grank-gt2)*5+($__temp_grank-lt2)*15</p></fRef>
		</repeat>
		<w>4</w>
	</repeat>

	<chS><sp type="abs">0.8</sp><tm>20</tm></chS>
	<chD><dir type="relative">180</dir><tm>1</tm></chD>
	<w>20</w>
	<chS><sp type="abs">0</sp><tm>20</tm></chS>

	<w>170-($__temp_grank-gt3)*16-($__temp_grank-gt4)*24</w>

	<!-- タイマーチェック -->
<!--	<eval name="time_check2">$_stageplayframe</eval>
	<debugstr><string>midboss2</string></debugstr>
	<debugval><num>$time_check2-$time_check1</num></debugval>
-->
</repeat>
<global name="end_flag">1</global>
<wait>120</wait>
</action>


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

<action  label="stage_middle_boss_03_action">
<!-- SECRET MAGIC 演出 0:mid enemy magic  1:mid secret magic 2:boss enemy magic 3:boss secret magic -->
<actionRef label="enemy_magic_action"><p>1</p><p>50</p><p>135</p><p>55</p><p>25</p></actionRef>

<!-- センターポイントへ移動 -->
	<changeSpeed>
		<speed type="absolute">2</speed><term>25</term>
	</changeSpeed>

	<changePosition type="center">
		<x>320</x><y>130</y>
	</changePosition>
	<changeSpeed>
		<speed type="absolute">0</speed><term>2</term>
	</changeSpeed>

	<wait>2</wait>
	<wait>55</wait>

	<collision type="circle"><cx>-1</cx><cy>-1</cy><radius>20</radius></collision>
	<createRef l="boss_ring"><p>$1</p></createRef>

<!-- 弾幕開始 -->
	<actionRef label="start_boss_bullet"/>

	<!-- タイマーチェック -->
	<eval name="time_check1">$_stageplayframe</eval>

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

	<createRef label="mahoujin_create_mb03"><p>140+16</p><p>80</p><p>90</p></createRef>
	<w>5</w>
	<createRef label="mahoujin_create_mb03"><p>500-16</p><p>180</p><p>-90</p></createRef>

	<repeat><times>15</times>
		<aRef l="boss_rand_move02"/>
		<!-- wait70 -->
		<repeat><times>$__temp_grank-gt2</times>
			<aRef l="enemy_bullet_action"><p>64</p></aRef>
			<fRef l="enemy_fire_mb_3_03b"><p>0</p></fRef>
		</repeat>
		<w>50</w>
		<repeat><times>$__temp_grank-gt4</times>
			<aRef l="enemy_bullet_action"><p>64</p></aRef>
			<fRef l="enemy_fire_mb_3_03b"><p>0</p></fRef>
		</repeat>
		<w>50</w>
		<repeat><times>$__temp_grank-gt3</times>
			<aRef l="enemy_bullet_action"><p>64</p></aRef>
			<fRef l="enemy_fire_mb_3_03b"><p>0</p></fRef>
		</repeat>
		<w>70</w>

	</repeat>

	<!-- タイマーチェック -->
<!--	<eval name="time_check2">$_stageplayframe</eval>
	<debugstr><string>midboss3</string></debugstr>
	<debugval><num>$time_check2-$time_check1</num></debugval>
-->
<global name="end_flag">1</global>

</action>



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

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

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

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

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

	<!-- *** 形態変数の増加 *** -->
	<global name="boss_state">$__boss_state+1</global>

	<!-- *** 表示ライフ減少 *** -->
	<global name="boss_life">$__boss_life-1</global>

	<!-- *** 弾幕のアイテム化 *** -->
	<repeat><times>$_revenge_state-eq1</times>
		<wait>1</wait>
		<changeBulletToItem/>
	</repeat>

	<wait>1</wait>

	<repeat><times>$_revenge_state-eq1</times>

		<eval name="counter_e">$__counter_tmp</eval>
		<actionRef label="item_counter_01_boss">
		<param>$crystal</param><param>$counter_e</param><param>$multi4</param><param>24</param><param>$localcounter</param><param>$rank_inc</param><param>$distance</param>
		</actionRef>
	</repeat>
	<repeat><times>$_revenge_state-eq3</times>
		<addRank><num>-2*$rank_inc</num></addRank>
		<actionRef label="item_counter_01_red"><param>$red_crystal</param></actionRef>
	</repeat>

	<wait>60</wait>

	<!-- *** 次の形態のボスの作成 *** -->
	<createRef label="enemy_create_middle_boss">
		<p>$_self_cx</p><p>$_self_cy</p><p>14000+200*$__grank</p><p>0</p><p>110000+2000*$__grank</p><p>$__middle_boss_prate2</p>
	</createRef>

	<!-- *** 最後に自殺 *** -->
	<vanish></vanish>	
</revenge>

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

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

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

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

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

	<!-- *** 弾幕のアイテム化 *** -->
	<!-- *** 自爆の場合は、弾けし *** -->
	<repeat><times>$_revenge_state-eq1</times>
		<wait>1</wait>
		<changeBulletToItem/>
	</repeat>
	<repeat><times>$_revenge_state-eq3</times>
		<wait>1</wait>
		<create>
			<speed>0</speed><direction>0</direction>
			<cx>320</cx><cy>240</cy><vital>0</vital>
			<bombRef label="bomb_clearbomb"></bombRef>
		</create>
	</repeat>

	<wait>1</wait>

	<repeat><times>$_revenge_state-eq1</times>
		
		<eval name="counter_e">$__counter_tmp</eval>
		<actionRef label="item_counter_01_boss">
		<param>$crystal</param><param>$counter_e</param><param>$multi4</param><param>24</param><param>$localcounter</param><param>$rank_inc</param><param>$distance</param>
		</actionRef>
	</repeat>
	<repeat><times>$_revenge_state-eq3</times>
		<addRank><num>-2*$rank_inc</num></addRank>
		<actionRef label="item_counter_01_red"><param>$red_crystal</param></actionRef>
	</repeat>

	<wait>60</wait>

	<!-- *** itemの数 40 より大きいで第３形態へ *** -->
<!--
	<debugstr><string>secret_debug</string></debugstr>
	<debugval><num>$__item_count</num></debugval>
-->
	<eval name="base">40+($__temp_grank-gt2)*5</eval>

	<repeat><times>($__item_count-gt$base)*($_stagemisscount-eq0)</times>
		<aRef l="secret_hint"><p>$base</p></aRef>
		<global name="boss_secret">1</global>
		<sysvar name="secret">$_secret+1</sysvar>
		<actionRef label="boss_revenge_present_3"/>
		<createRef label="enemy_create_middle_boss">
			<p>$_self_cx</p><p>$_self_cy</p><p>13800+300*$__grank</p><p>0</p><p>130000+2000*$__grank</p><p>$__middle_boss_prate3</p>
		</createRef>
		<vanish/>
	</repeat>

	<repeat><times>1-(($__item_count-gt$base)*($_stagemisscount-eq0))</times>
		<actionRef label="stage_middle_boss_final_revenge_action"></actionRef>
	</repeat>
</revenge>

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

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

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

	<!-- Enemy Magic Break -->
	<eval name="emb_prate">-10000-($__grank-gt3)*2000-($__grank-gt4)*2000</eval>
	<eval name="emb_prate_tmp1">((-1*$emb_prate)/10000)%10</eval>
	<eval name="emb_prate_tmp2">((-1*$emb_prate)/1000)%10</eval>
	<eval name="emb_score">100000+($__grank-gt3)*20000+($__grank-gt4)*20000</eval>

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

	<!-- 爆発アクション -->
	<actionRef label="boss_revenge_present_4"></actionRef>
	<actionRef label="bg_bossend_action"></actionRef>
	<presentRef label="stage_middle_boss_revnege_present_01"></presentRef>


	<!-- *** 弾幕のアイテム化 *** -->
	<!-- *** 自爆の場合は、弾けし *** -->
	<repeat><times>$_revenge_state-eq1</times>
		<wait>1</wait>
		<changeBulletToItem/>
	</repeat>
	<repeat><times>$_revenge_state-eq3</times>
		<wait>1</wait>
		<create>
			<speed>0</speed><direction>0</direction>
			<cx>320</cx><cy>240</cy><vital>0</vital>
			<bombRef label="bomb_clearbomb"></bombRef>
		</create>
	</repeat>

	<wait>1</wait>

	<repeat><times>$_revenge_state-eq1</times>
		<!-- *** ノーミスノーボムチェック *** -->
		<eval name="etb_j">(($ttc_end-$__ttc_start)-eq($localcounter-$__counter_tmp))*($__ttc_start-gt((300*$_magic_rate/100)-60))</eval>
		<repeat><times>$etb_j</times>
			<actionRef label="emb_letter"><p>$emb_prate_tmp1</p><p>$emb_prate_tmp2</p></actionRef>
			<addPRate><num>$emb_prate</num></addPRate>
			<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">
		<param>$crystal</param><param>$counter_e</param><param>$multi4</param><param>24</param><param>$localcounter</param><param>$rank_inc</param><param>$distance</param>
		</actionRef>
	</repeat>
	<repeat><times>$_revenge_state-eq3</times>
		<addRank><num>-3*$rank_inc</num></addRank>
		<actionRef label="item_counter_01_red"><param>$red_crystal</param></actionRef>
	</repeat>
	<wait>60</wait>

	<actionRef label="stage_middle_boss_final_revenge_action"></actionRef>
</revenge>


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

	<!-- 画像の後始末 -->
	<targetRevenge label="stage_boss_timer_fig"></targetRevenge>
	<targetRevenge label="namebox"></targetRevenge>

	<targetRevenge label="boss_life"></targetRevenge>
	<actionRef l="bg_midbossend_action"></actionRef>

	<!-- *** ボス戦ロックを解除 *** -->
	<releaseLock><num>10</num></releaseLock>

	<!-- *** 終了 *** -->
	<vanish></vanish>	
</action>
	



</exbulletml>
