function main()
while true do
key_reset();
yield();
end
end
- 上記解説のようなもの:
『function main() ~ end』:main関数。全ては、この『main関数』から実行される。必須。
『while true do ~ end』:ループ構造。このループの中に、各状況への対処が記述される。ループ文ならなんでもいいが、大抵のAIはこれを使っている。
『yield();』:yield関数。1F間待機し、情報を更新する。記述場所は人により変わる。必須。
『key_reset();』:key_reset関数。押しているボタンを全て離す。ボタンの押しっぱなし等を回避するために挿入している。記述によっては必要ない。
- 使い方:
テキストファイルにコピペしたあと、if文による分岐と、実行する内容を、key_reset関数とyield関数の間に記述してゆけばよい。
function main()
while true do
key_reset();
--グレイズ
--近距離
if dis<=500 and enemy_act>=400 and enemy_act<=600 then
key_event2(ACT_D,front);
--遠距離
elseif dis>500 and obj_dis<150 then
key_event2(ACT_D,front);
--ガード
elseif ey==0 and enemy_act>=300 and enemy_act<700 then
if battle_time%2==0 then
key_on(back);
else key_on(d_back);
end
elseif ey>0 and enemy_act>=300 and enemy_act<700 then
key_on(back);
--攻撃
elseif dis<250 and ey<200 and y==0 and ey>0 then
if my_card==101 then
key_event(ACT_BC);
else
key_event(front);
key_event(ACT_DOWN);
key_on(d_front);
key_event(ACT_C);
key_reset();
key_event(ACT_AB);
end
elseif my_act>=400 and my_act<700 then
key_on(u_front);
elseif y>0 and dis<200 and dis_y<200 then
key_event2(ACT_A,ACT_DOWN);
elseif dis<150 and ey<50 then
key_event2(ACT_A,ACT_DOWN);
elseif dis<150 and ey<100 then
key_reset();
key_event2(ACT_A,back);
elseif dis<200 and ey<50 and enemy_act<=10 then
key_reset();
key_event(ACT_A);
elseif dis<300 and ey<200 and math.random(10)==1 then
key_event(ACT_B);
elseif dis<400 and ey<200 and math.random(10)==1 then
key_event(ACT_C);
elseif my_card~=101 and math.random(30)==1 then
key_event(ACT_BC);
key_event(ACT_AB);
--移動
else
key_reset();
key_on(front);
end
yield();
end
end
--▼紅 美鈴AI用▼
--アーケードLunaをクリアする程度の強さ。
--仕様:地面に張り付き、紅砲対空をメインに戦う。またカードをでたらめ発動する。
--推奨カード:紅砲*4 烈虹拳*4 天龍脚*4 人魂灯*4 龍魚の羽衣*4
--非推奨カード:他の623スキル(紅砲と被る)。宵越しの銭(使用しない)。
function main() --メイン関数。「main」以外の名称は不可。
while true do --必須。コレがない場合、アプリは強制終了する。
key_reset();--ボタンのおしっぱなど解除する。
--グレイズ。
--近距離。B,Cのモーションを見てグレイズ。自身のモーションを条件に入れていないため、とにかく連打する。そのため意図しない回避結界を発動する。
if not(my_act>=150 and my_act<=158) and enemy_act>=400 and enemy_act<500 and enemy_act~=408 and enemy_act~=418 and dis<500 and enemy_frame<=8 then
if math.random(4)==1 then
if enemy_cahr==9 and enemy_act==402 then--萃香2B対策。
key_on(d_back);
elseif enemy_char~=9 then
key_event2(ACT_D,front);
end
else
key_on(back);
end
--中距離以上。オブジェとの距離を見てグレイズ。
elseif obj_dis<150 and dis>=500 then
key_event2(ACT_D,front);
--ガード行動。
--ガー反、羽衣使用
elseif my_card~=13 and my_act>=50 and my_act<=196 and my_hitstop==0 then
key_on(ACT_AB); yield(); key_off(ACT_AB);
elseif my_card==13 and my_act>=150 and my_act<=157 and enemy_frame==1 and y==0 and dis<=250 and dis_y<=50 and my_hitstop==0 then
key_event(ACT_BC);
--オブジェが至近距離の場合、ガード
elseif obj_dis<=50 then
key_on(d_back);
--地上はスイッチガード。1Fごとにガード方向を切り替える。苦肉の策。
elseif ey==0 and enemy_act>=300 and enemy_act<=700 then
key_reset();
if battle_time%2==0 then
key_on(back);
elseif battle_time%2==1 then
key_on(d_back);
end
--相手が空中なら、諏訪子J8Aを除き、立ちガード
elseif enemy_char==19 and enemy_act==309 then
key_reset(); key_on(d_back);
elseif ey>0 and enemy_act>=300 and enemy_act<=700 then
key_reset(); key_on(back);
--空中行動。J2Aのみ使用。
elseif y>0 and dis<=300 and dis_y<=200 then
key_event2(ACT_A,ACT_DOWN);
--地上行動。
--紅砲。基本対空狙い。コマンド、スキカ両方使用。
elseif y==0 and ey>0 and ey<=200 and dis<=300 then
if my_card==101 then
key_event(ACT_BC);
elseif my_card~=101 then
key_on(front); yield();key_off(front);
key_on(ACT_DOWN); yield(); key_off(ACT_DOWN);
key_on(d_front);
key_event(ACT_B);
key_event(ACT_AB);
end
key_reset();
--214。螺光歩、降華蹴用。中距離からの奇襲。
elseif (dis<=500 and dis_y<=200 and math.random(30)==1) or (dis<=500 and dis_y<=200 and enemy_act>=400) then
if my_card==100 and my_card==108 then
key_event(ACT_BC);
elseif my_card~=101 and my_card~=100 and my_card~=108 then
key_on(ACT_DOWN); yield();key_off(ACT_DOWN);
key_on(d_back); yield();key_off(d_back);
key_on(back);
if dis<=250 and (get_skill_lv(0,0)>=3 or get_skill_lv(0,8)>=1) then
key_event(ACT_B);
elseif dis>250 then
if get_skill_lv(0,0)>=0 then
key_event(ACT_C);
elseif get_skill_lv(0,8)>=1 then
key_event(ACT_B);
end
end
key_event(ACT_AB);
end
key_reset();
--214。烈虹拳。コンボ用。
elseif my_act>=300 and my_act<=305 and enemy_act>=50 and enemy_act<=166 and enemy_act~=97 and enemy_act~=98 and my_combo>=2 then
if my_card==104 then
key_event(ACT_BC);
elseif my_card~=101 and my_card~=104 then
key_on(ACT_DOWN); yield();key_off(ACT_DOWN);
key_on(d_back); yield();key_off(d_back);
key_on(back);
if dis<=200 and get_skill_lv(0,4)>=1 then
key_event(ACT_B);
end
key_event(ACT_AB);
end
key_reset();
--22。天龍脚。
elseif y==0 and dis<=500 and dis<=250 and ((ey>0 and ey<=50)or(enemy_act>=200 and enemy_act<=226)) and enemy_frame<=7 and is_dir_front then
if my_card==110 then
key_event(ACT_BC);
elseif my_card~=101 and my_card~=110 then
key_on(ACT_DOWN); yield();key_off(ACT_DOWN);
yield();
key_on(ACT_DOWN);
if get_skill_lv(0,10)>=1 then
key_event(ACT_B);
end
key_event(ACT_AB);
end
key_reset();
--射撃キャンセル用。だけどスキル後なんかでも飛ぶ。電波ジャンプ。
elseif y==0 and my_act>400 then
key_on(u_front);
--2A。条件の設定上、ひたすら連打。確立で、6A、3Aに分岐。
elseif y==0 and ey<=50 and dis<=120 and my_act<400 and enemy_act~=97 and enemy_act~=98 and enemy_act~=197 and enemy_act~=198 and enemy_act~=199 then
key_event2(ACT_A,ACT_DOWN);
if math.random(5)==1 then
key_reset();
yield();
key_event2(ACT_A,front);
elseif math.random(5)==1 then
key_event2(ACT_A,d_front);
end
--4A。命令の優先順位上、実質低空にいる相手への打撃となる。
elseif y==0 and ey<100 and dis<=120 and obj_dis>50 and my_act<400 then
key_event2(ACT_A,back);
--5A。大抵は遠Aになる。相手がほぼ何もしていない時のみに振る。
elseif y==0 and ey<50 and dis<=200 and obj_dis>50 and my_act<400 and enemy_act<=10 then
key_event(ACT_A);
--5B。発生の早さと、キャンセルの早さから採用。あまり役に立たないかもしれない。確立で振り、たまに6Bに化ける。
elseif y==0 and ey<=50 and dis<=300 and obj_dis>50 and math.random(10)==1 then
key_event(ACT_B);
--5C。なんとなく採用。Bと同じく確立で振る。6Cに化ける時がある。
elseif y==0 and ey<=50 and dis<=400 and obj_dis>50 and math.random(10)==1 then
key_event(ACT_C);
--6C。遠距離からおもむろに出す。確立で振る。
elseif dis>400 and obj_dis>200 and math.random(30)==1 then
key_reset();
yield();
key_event2(ACT_C,front);
--でたらめブッパ。おもむろにカードを使用する。
elseif my_card~=101 and obj_dis>50 and math.random(10)==1 then
if my_card<200 and dis<500 and dis_y<400 then
key_event(ACT_BC);
elseif my_card>=200 and dis<=500 and dis_y<400 then
key_event(ACT_BC);
end
key_event(ACT_AB);
--以上が当てはまらない場合は前進。
else
key_on(front);
end
yield(); --仕様上必須。document.txt参照。
end
end