class Scene_Battle STOP_AUTO_HP = 10 #-------------------------------------------------------------------------- # ● 刷新画面 (角色命令回合 : 基本命令) #-------------------------------------------------------------------------- alias super_update_phase3_basic_command update_phase3_basic_command def update_phase3_basic_command # 按下 A 键的情况下 if Input.trigger?(Input::A) # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 设置默认攻击目标,启用自动普攻 @auto_enemy_index = 0 auto return end super_update_phase3_basic_command end #-------------------------------------------------------------------------- # ● 设置角色指令窗口 #-------------------------------------------------------------------------- alias super_phase3_setup_command_window phase3_setup_command_window def phase3_setup_command_window # 如果启用自动普攻 if @auto_enemy_index != nil auto return end super_phase3_setup_command_window end ########################## def auto # 如果角色的血量小于指定比例, 停止自动普攻 for actor in $game_party.actors if actor.hp * 100.0 / actor.maxhp <= STOP_AUTO_HP # 演奏取消 SE $game_system.se_play($data_system.cancel_se) @auto_enemy_index = nil # 设置角色的命令窗口 phase3_setup_command_window return end end # 找下个行动的敌人,作为攻击目标(如果不是CP战斗,可以删掉这段) fast = nil for enemy in $game_troop.enemies if enemy.exist? if fast == nil fast = enemy elsif fast.cp < enemy.cp fast = enemy end end end @auto_enemy_index = fast.index # 普攻行动 @active_battler.current_action.kind = 0 @active_battler.current_action.basic = 0 # 选择敌人 @active_battler.current_action.target_index = @auto_enemy_index # 无效化角色指令窗口 @actor_command_window.active = false @actor_command_window.visible = false phase3_next_actor end end
915.45 KB, 下载次数: 1
demo
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |