#============================================================================== # ■ RGSS2 エネミー攻撃アニメーション設定 Ver1.00 by 星潟 #------------------------------------------------------------------------------ # エネミーの通常攻撃にアニメーションを設定します。 # ただし、デフォルト戦闘ではアニメーションの音とフラッシュしか意味がありません。 #------------------------------------------------------------------------------ # ★設定例 #------------------------------------------------------------------------------ # エネミーのメモ欄に<攻撃アニメ:2>と記入すると # そのエネミーの通常攻撃時のアニメIDは2になります。 # # エネミーのメモ欄に<攻撃アニメ:1,2,3,4,5>と記入すると # そのエネミーの通常攻撃時のアニメIDは1、2、3、4、5になります。 #============================================================================== module ENEMY_ATTACK_ANIMATION #攻撃アニメーション設定用のキーワードを指定します。 WORD = "攻撃アニメ" end class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # 通常攻撃アニメーション #-------------------------------------------------------------------------- alias display_attack_animation_enemy_attack_animation display_attack_animation def display_attack_animation(targets) #バトラーがエネミーで、なおかつ攻撃アニメーション配列が空ではない場合 if @active_battler.is_a?(Game_Enemy) && !@active_battler.enemy.attack_animation.empty? #反転フラグを設定。 mirror_flag = false #設定された攻撃アニメーションIDごとに順番に処理する。 for i in @active_battler.enemy.attack_animation #通常攻撃アニメーションを表示する。 display_normal_animation(targets, i, mirror_flag) #反転フラグを反転させる。 mirror_flag = mirror_flag == false ? true : false end #アニメーション終了までウェイト。 wait_for_animation else #本来の処理を実行する。 display_attack_animation_enemy_attack_animation(targets) end end end class RPG::Enemy #-------------------------------------------------------------------------- # 攻撃アニメーション配列 #-------------------------------------------------------------------------- def attack_animation #キャッシュを返す。 return @attack_animation if @attack_animation != nil #空の配列を作成。 @attack_animation = [] #メモ欄からデータを取得。 data = self.note.scan(/<#{ENEMY_ATTACK_ANIMATION::WORD}[::](\S+)>/).flatten #データが存在する場合はそのデータを分割して配列を作成する。 if data != nil && !data.empty? data = data[0].split(/\s*,\s*/) for i in data @attack_animation.push(i.to_i) end end #データを返す。 @attack_animation end end