--****************************************************************************** --[[ @brief 150_AC_HASEN11 @author Yoshikazu KOIDE ]] --****************************************************************************** -- @@@@@@ 垂直ミサイルの方 @@@@@@ -- 本ミッション用定数 DIST_EMERGENCY = 300; -- この距離まで近づかれたら危機感を感じる DIST_OPERATION = 600; -- 行動開始距離 DIST_ATTACK_MAX = 400; -- 適正距離最大値 DIST_ATTACK_MIN = 200; -- 適正距離最小値 DIST_SUBATK_MAX = 900; -- サブ武器の適正距離最大値 DIST_SUBATK_MIN = 300; -- サブ武器の適正距離最小値 -- 依存ファイル dofile("game:\\common\\airesource\\script\\include\\include.lua"); dofile("game:\\common\\Event\\include\\m150\\PointID.lua"); dofile("game:\\common\\Event\\include\\m150\\EntityID.lua"); -- スクリプト初期化 function InitialSetup( context) -- 最初のオペレーションレイヤーを作成する。 --== 移動 -- 最初のオペレーションレイヤーを作成する。 AddInitialLayer_EveryFrame( context, "InitMove", "Move"); --== メイン攻撃 -- 最初のオペレーションレイヤーを作成する。 AddInitialLayer_EveryFrame( context, "InitMainAttack", "MainAttack"); --== サブ攻撃 -- 最初のオペレーションレイヤーを作成する。 AddInitialLayer_EveryFrame( context, "InitSubAttack", "SubAttack"); DefaultSetup( context, false); -- こいつは重いので飛ばない end -- 初期化する。 RegistInitializeFuncitonName( "InitialSetup"); --///////////////////////////////////////////////////////////////////////////////////////////// --///////////////////////////////////////////////////////////////////////////////////////////// --///////////////////////////////////////////////////////////////////////////////////////////// --****************************************************************************** --[[ @brief 移動 ]] --****************************************************************************** function InitMove() debug_out("testメイン関数初期化。"); end function Move( context) local dist = GetToTargetDistance( context); local dicent = ( DIST_SUBATK_MAX + DIST_SUBATK_MIN ) / 2; -- パラメータ取得 local BASE_ID = GetCommonParam( context, 0); -- 自分はどこからきた? 0:普通 2:ミサイル部隊�A 3:ミサイル部隊�B -- /////高度設定 local alt = GetInitialAltitude( context); -- /////ターゲット補足関数 Targetting_CatchUpWithConeInSide( context, 800, 180); -- 800m, 360 レーダー Targetting_CatchUpWithConeInSide( context, 5500, 20); -- 2500m, ミサイル撃たないといけないので -- /////行動オペレーション -- じっとしており、敵を遠くから狙い撃つ if ( dist > DIST_OPERATION ) then Op_Shoot( context, OperationIdentifier(99), 3, 6, 1, nil, 0, false, 1, 1); -- 何もしない Op_RandomWalk( context, OperationIdentifier(98), 8, 10, 1, nil, 50, 1.5); -- ウロウロする else if ( IsExistTarget( context) ) then -- ターゲット認識 if ( dist > DIST_ATTACK_MAX ) then -- すごく遠い -- /////高度調整 SetAdjustAltitudeBase( context, ADJUST_ALTITUDE_BASE__TARGET_RELATIVE); -- 相対高度を見る SetAltitudeParam( context, alt, 10); -- 常に50m上をとる -- /////ブースト SetEstimation_WalkDashRate( context, 0, 1); -- walk, dash 確率 SetEstimation_BoostEnableEnergyRange( context, 0, 1, 0.2, 0.7); -- Op_RandomWalk( context, OperationIdentifier(1), 8, 10, 1, nil, 50, 1.5); -- ウロウロする Op_KeepDist( context, OperationIdentifier(2), 3, 5, 1, nil, DIST_ATTACK_MAX-100, 50 ); -- とりあえずミサイル距離まで elseif ( dist < DIST_ATTACK_MIN ) then -- すごく近づかれたら -- /////高度調整 SetAdjustAltitudeBase( context, ADJUST_ALTITUDE_BASE__TARGET_RELATIVE); -- 相対高度を見る SetAltitudeParam( context, alt, 10); -- 常に50m上をとる SetEstimation_WalkDashRate( context, 0, 1); -- walk, dash 確率 SetEstimation_BoostEnableEnergyRange( context, 0, 1, 0.2, 0.7); -- Op_MoveTargetRelation( context, OperationIdentifier(9), 6, 10, 1, nil, dicent, 120, 30, 0, true); Op_MoveTargetRelation( context, OperationIdentifier(10), 6, 10, 1, nil, dicent, -120, 30, 0, true); else -- ちょうどいい距離 -- /////高度調整 SetAdjustAltitudeBase( context, ADJUST_ALTITUDE_BASE__TARGET_RELATIVE); -- 相対高度を見る SetAltitudeParam( context, alt, 10); -- 常に50m上をとる -- /////ブースト SetEstimation_WalkDashRate( context, 0.4, 0.6); -- walk, dash 確率 SetEstimation_BoostEnableEnergyRange( context, 0, 1, 0.2, 0.7); -- Op_MoveTargetRelation( context, OperationIdentifier(3), 4, 10, 1, nil, dicent, 60, 30, 0, true); Op_MoveTargetRelation( context, OperationIdentifier(4), 4, 10, 1, nil, dicent, -60, 30, 0, true); end else -- 自機を捕捉していない -- /////ブースト SetEstimation_WalkDashRate( context, 0.4, 0.6); -- walk, dash 確率 SetEstimation_BoostEnableEnergyRange( context, 0, 1, 0.2, 0.7); -- if ( BASE_ID == 2 ) then -- ミサイル部隊2所属 Op_MoveToMoveTarget( context, OperationIdentifier(7), 20, 24, 1, "OnMoveToMoveTarget_2", 10); elseif ( BASE_ID == 4 ) then -- ミサイル部隊4所属 Op_MoveToMoveTarget( context, OperationIdentifier(8), 20, 24, 1, "OnMoveToMoveTarget_4", 10); else -- 友軍と戦わない部隊 Op_RandomWalk( context, OperationIdentifier(5), 8, 10, 1, nil, 50, 1.5); -- ウロウロする Op_Shoot( context, OperationIdentifier(6), 3, 6, 1, nil, 0, false, 1, 1); -- 何もしない end end end end -- 目的地設定 function OnMoveToMoveTarget_2( context) SetTargetPositionByPointID( context, m150_PT_INTERCEPTION2); end function OnMoveToMoveTarget_4( context) SetTargetPositionByPointID( context, m150_PT_INTERCEPTION4); end --****************************************************************************** --[[ @brief Main 攻撃 ]] --****************************************************************************** function InitMainAttack() -- end -- function MainAttack( context) local dist = GetToTargetDistance( context); if ( dist > DIST_OPERATION ) then Op_Shoot( context, OperationIdentifier(99), 3, 6, 1, nil, 0, false, 1.0, 1.0); -- 何もしない else if( PlayerIsInRegion( context, m150_CENTRAL_TOWER ) ) then Op_Shoot( context, OperationIdentifier(4), 3, 6, 1, nil, 0, false, 1.0, 1.0); else if( IsExistTarget( context) ) then -- 自機を捉えた if( dist < DIST_ATTACK_MIN ) then -- 適正距離よりずっと近い ⇒めちゃくちゃに撃つ Op_Shoot2( context, OperationIdentifier(1), 3, 6, 1, nil, 100, false, 0.5, 0.5, 1.0, 1.0); elseif( dist > DIST_ATTACK_MAX ) then-- すごく遠い Op_Shoot( context, OperationIdentifier(99), 3, 6, 1, nil, 0, false, 1.0, 1.0); -- 何もしない else -- 適正距離の中にいる ⇒ 狙い撃ち Op_SShoot2( context, OperationIdentifier(2), 3, 4, 1, nil, 100, true, 0.5, 0.5, 3.0, 4.5); end else Op_Shoot( context, OperationIdentifier(99), 3, 6, 1, nil, 0, false, 1.0, 1.0); -- 何もしない end end end end --****************************************************************************** --[[ @brief Sub 攻撃 ]] --****************************************************************************** function InitSubAttack() -- end -- function SubAttack( context) -- パラメータ取得 local BASE_ID = GetCommonParam( context, 0); -- 自分はどこからきた? 0:普通 2:ミサイル部隊�A 3:ミサイル部隊�B --LogAI( string.format(" Get Base ID = %d ",BASE_ID)); if ( PlayerIsInRegion( context, m150_PT_INTERCEPTION2 ) or PlayerIsInRegion( context, m150_PT_INTERCEPTION3 ) ) then Op_SubShoot2( context, OperationIdentifier(1), 1.0, 1.0, 1, nil, 100, true, 0.5, 0.5, 0.1, 0.1); -- 垂直ミサイル一斉発射 else Op_SubShoot( context, OperationIdentifier(98), 2, 4, 1, nil, 0, false, 2, 4); -- 何もしない end end --[[ if ( PlayerIsInRegion( context, m150_PT_INTERCEPTION2 ) ) then -- �Aポイントに入ったら --LogAI( string.format(" I'm in 2. BASE_ID = %d ",BASE_ID)); if ( BASE_ID == 2 ) then Op_SubShoot2( context, OperationIdentifier(1), 1.0, 1.0, 1, nil, 100, true, 0.5, 0.5, 0.0, 0.0); -- 垂直ミサイル一斉発射 --LogAI( string.format("Virtical Missile Shooting [2].")); else Op_SubShoot( context, OperationIdentifier(97), 2, 4, 1, nil, 0, false, 2, 4); -- 何もしない end elseif ( PlayerIsInRegion( context, m150_PT_INTERCEPTION3 ) ) then -- �Bポイントに入ったら --LogAI( string.format(" I'm in 3. BASE_ID = %d ",BASE_ID)); if ( BASE_ID == 3 ) then Op_SubShoot2( context, OperationIdentifier(2), 1.0, 1.0, 1, nil, 100, true, 0.5, 0.5, 0.0, 0.0); -- 垂直ミサイル一斉発射 --LogAI( string.format("Virtical Missile Shooting [3].")); else Op_SubShoot( context, OperationIdentifier(98), 2, 4, 1, nil, 0, false, 2, 4); -- 何もしない end else Op_SubShoot( context, OperationIdentifier(99), 2, 4, 1, nil, 0, false, 2, 4); -- 何もしない end end ]]