=begin RGSS3 エネミーのスキル不発挙動とテキスト表示 Ver0.2 mo-to TKOOL COOL http://mototkool.blog.fc2.com/ アイデア提供 FSM 朋さん ★概要★ エネミーがMP不足や魔法封じでもスキルを行動に選び、失敗するようになる。 ★使用法★ 挙動を変えたいエネミーのメモ欄に <スキル不発選択> と記入する。 ★注意★ Scene_Battle#process_actionを再定義していますので そこを弄っているスクリプトとは競合します。 ★更新履歴★ 0.1公開 0.2メソッド内の間違いを修正&整理 ●=再定義 ○=エイリアス定義 ☆=新規メソッド =end module Vocab #エネミーがスキル封じ状態でスキルを使用したときのテキスト SkillSeal_Misfire_TEXT = "しかし スキルは封じ込まれている!" #エネミーがMP不足でスキルを使用したときのテキスト SkillMP_Lack_TEXT = "しかし MPが足りない!" end class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ○ 現在の状況で戦闘行動が有効か否かを判定 # action : RPG::Enemy::Action #-------------------------------------------------------------------------- alias enemy_misfire_skill_action_valid? action_valid? def action_valid?(action) if /<スキル不発選択>/ =~ self.enemy.note conditions_met?(action) else enemy_misfire_skill_action_valid?(action) end end end class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● 戦闘行動の処理  #-------------------------------------------------------------------------- def process_action return if scene_changing? if !@subject || !@subject.current_action @subject = BattleManager.next_subject end return turn_end unless @subject if @subject.current_action @subject.current_action.prepare if @subject.enemy? && !@subject.current_action.attack? && (!@subject.skill_cost_payable?(@subject.current_action.item) || subject_seal_skill_id.any? { |i| i == @subject.current_action.item.stype_id }) @status_window.open execute_action_misfire elsif @subject.current_action.valid? @status_window.open execute_action end @subject.remove_current_action end process_action_end unless @subject.current_action end #-------------------------------------------------------------------------- # ☆ 攻撃者の現在封じ込まれているスキルタイプIDの取得 #-------------------------------------------------------------------------- def subject_seal_skill_id seal_type_id = [] seal = @subject.features(Game_BattlerBase::FEATURE_STYPE_SEAL) seal.each { |i| seal_type_id << i.data_id } return seal_type_id end #-------------------------------------------------------------------------- # ☆ 戦闘行動(不発) #-------------------------------------------------------------------------- def execute_action_misfire @subject.sprite_effect_type = :whiten misfire_use_item @log_window.wait_and_clear end #-------------------------------------------------------------------------- # ☆ スキルの使用不発 #-------------------------------------------------------------------------- def misfire_use_item item = @subject.current_action.item @log_window.display_use_item(@subject, item) @log_window.display_use_skill_misfire(@subject) end end class Window_BattleLog < Window_Selectable #-------------------------------------------------------------------------- # ☆ エネミーのスキルが不発の場合のテキスト表示 #-------------------------------------------------------------------------- def display_use_skill_misfire(subject) wait if subject.skill_type_sealed?(subject.current_action.item.stype_id) add_text(Vocab::SkillSeal_Misfire_TEXT) else add_text(Vocab::SkillMP_Lack_TEXT) end end end